|
105 | 105 | to_return(status: 200, body: 'this is not json') |
106 | 106 | end |
107 | 107 |
|
108 | | - it 'fails the job and does not perform orphan mitigation' do |
| 108 | + it 'retries the job and does not perform orphan mitigation' do |
109 | 109 | execute_all_jobs(expected_successes: 1, expected_failures: 0) |
110 | 110 |
|
| 111 | + assert_polling_job(binding, job) |
111 | 112 | assert_no_orphan_mitigation_performed(plan_id, offering_id) |
112 | 113 | end |
113 | 114 | end |
|
121 | 122 | to_return(status: 410, body: '{}') |
122 | 123 | end |
123 | 124 |
|
124 | | - it 'retries and does not perform orphan mitigation' do |
| 125 | + it 'retries the job does not perform orphan mitigation' do |
125 | 126 | execute_all_jobs(expected_successes: 1, expected_failures: 0) |
126 | 127 |
|
| 128 | + assert_polling_job(binding, job) |
127 | 129 | assert_no_orphan_mitigation_performed(plan_id, offering_id) |
128 | 130 | end |
129 | 131 | end |
|
139 | 141 | it 'retries and does not perform orphan mitigation' do |
140 | 142 | execute_all_jobs(expected_successes: 1, expected_failures: 0) |
141 | 143 |
|
| 144 | + assert_polling_job(binding, job) |
142 | 145 | assert_no_orphan_mitigation_performed(plan_id, offering_id) |
143 | 146 | end |
144 | 147 | end |
|
151 | 154 | to_return(status: 400, body: '{}') |
152 | 155 | end |
153 | 156 |
|
154 | | - it 'retries and does not perform orphan mitigation' do |
| 157 | + it 'fails the job and does not perform orphan mitigation' do |
155 | 158 | execute_all_jobs(expected_successes: 0, expected_failures: 1) |
156 | 159 |
|
| 160 | + assert_failed_job(binding, job) |
157 | 161 | assert_no_orphan_mitigation_performed(plan_id, offering_id) |
158 | 162 | end |
159 | 163 | end |
@@ -265,6 +269,13 @@ def assert_failed_job(binding, job) |
265 | 269 | expect(job.state).to eq(VCAP::CloudController::PollableJobModel::FAILED_STATE) |
266 | 270 | end |
267 | 271 |
|
| 272 | +def assert_polling_job(binding, job) |
| 273 | + binding.reload |
| 274 | + expect(binding.last_operation.type).to eq('create') |
| 275 | + expect(binding.last_operation.state).to eq('in progress') |
| 276 | + expect(job.state).to eq(VCAP::CloudController::PollableJobModel::POLLING_STATE) |
| 277 | +end |
| 278 | + |
268 | 279 | def assert_orphan_mitigation_performed(plan_id, offering_id) |
269 | 280 | expect(delete_request(plan_id, offering_id)).to have_been_made.once |
270 | 281 | end |
|
0 commit comments