|
109 | 109 | expect(retry_set.count).to eq(1)
|
110 | 110 | end
|
111 | 111 |
|
| 112 | + def retry_last_failed_job |
| 113 | + retry_set.first.add_to_queue |
| 114 | + job = queue.first |
| 115 | + work = Sidekiq::BasicFetch::UnitOfWork.new('queue:default', job.value) |
| 116 | + process_work(processor, work) |
| 117 | + end |
| 118 | + |
| 119 | + context "with attempt_threshold" do |
| 120 | + it "doesn't report the error until attempts equal the threshold" do |
| 121 | + worker = Class.new(SadWorker) |
| 122 | + worker.sidekiq_options attempt_threshold: 3 |
| 123 | + |
| 124 | + execute_worker(processor, worker) |
| 125 | + expect(transport.events.count).to eq(0) |
| 126 | + |
| 127 | + retry_last_failed_job |
| 128 | + expect(transport.events.count).to eq(0) |
| 129 | + |
| 130 | + retry_last_failed_job |
| 131 | + expect(transport.events.count).to eq(1) |
| 132 | + end |
| 133 | + |
| 134 | + it "doesn't report the error when threshold is not reached" do |
| 135 | + worker = Class.new(SadWorker) |
| 136 | + worker.sidekiq_options attempt_threshold: 3 |
| 137 | + |
| 138 | + execute_worker(processor, worker) |
| 139 | + expect(transport.events.count).to eq(0) |
| 140 | + |
| 141 | + retry_last_failed_job |
| 142 | + expect(transport.events.count).to eq(0) |
| 143 | + end |
| 144 | + end |
| 145 | + |
112 | 146 | context "with config.report_after_job_retries = true" do
|
113 | 147 | before do
|
114 | 148 | Sentry.configuration.sidekiq.report_after_job_retries = true
|
115 | 149 | end
|
116 | 150 |
|
117 |
| - def retry_last_failed_job |
118 |
| - retry_set.first.add_to_queue |
119 |
| - job = queue.first |
120 |
| - work = Sidekiq::BasicFetch::UnitOfWork.new('queue:default', job.value) |
121 |
| - process_work(processor, work) |
122 |
| - end |
123 |
| - |
124 | 151 | context "when retry: is specified" do
|
125 | 152 | it "doesn't report the error until retries are exhuasted" do
|
126 | 153 | worker = Class.new(SadWorker)
|
|
0 commit comments