|
29 | 29 | end
|
30 | 30 |
|
31 | 31 | it "returns successful result if there are allowed exceptions" do
|
32 |
| - error_body = { "error" => { "status" => "PERMISSION_DENIED", "code" => 403, "message" => "APK specifies a version code that has already been used" } } |
| 32 | + error_body = {"error" => {"status" => "PERMISSION_DENIED", "code" => 403, "message" => "APK specifies a version code that has already been used"}} |
33 | 33 | error = ::Google::Apis::ClientError.new("Error", body: error_body.to_json)
|
34 | 34 | allow(api_double).to receive(:upload).and_raise(Installations::Google::PlayDeveloper::Error.new(error))
|
35 | 35 |
|
|
38 | 38 | end
|
39 | 39 |
|
40 | 40 | it "retries if there are retryable exceptions" do
|
41 |
| - error_body = { "error" => { "status" => "FAILED_PRECONDITION", "code" => 400, "message" => "This Edit has been deleted" } } |
| 41 | + error_body = {"error" => {"status" => "FAILED_PRECONDITION", "code" => 400, "message" => "This Edit has been deleted"}} |
42 | 42 | error = Google::Apis::ClientError.new("Error", body: error_body.to_json)
|
43 | 43 | allow(api_double).to receive(:upload).and_raise(Installations::Google::PlayDeveloper::Error.new(error))
|
44 | 44 |
|
|
47 | 47 | end
|
48 | 48 |
|
49 | 49 | it "returns failed result if there are disallowed exceptions" do
|
50 |
| - error_body = { "error" => { "status" => "NOT_FOUND", "code" => 404, "message" => "Package not found:" } } |
| 50 | + error_body = {"error" => {"status" => "NOT_FOUND", "code" => 404, "message" => "Package not found:"}} |
51 | 51 | error = ::Google::Apis::ClientError.new("Error", body: error_body.to_json)
|
52 | 52 | allow(api_double).to receive(:upload).and_raise(Installations::Google::PlayDeveloper::Error.new(error))
|
53 | 53 |
|
|
166 | 166 | name: :track,
|
167 | 167 | releases: [
|
168 | 168 | {
|
169 |
| - localizations: [{ release_notes: { language: "en-US", text: "text" } }], |
| 169 | + localizations: [{release_notes: {language: "en-US", text: "text"}}], |
170 | 170 | version_string: "1.0.0",
|
171 | 171 | status: "inProgress",
|
172 | 172 | user_fraction: 0.99,
|
|
180 | 180 | name: :track,
|
181 | 181 | releases: [
|
182 | 182 | {
|
183 |
| - localizations: [{ release_notes: { language: "en-US", text: "text" } }], |
| 183 | + localizations: [{release_notes: {language: "en-US", text: "text"}}], |
184 | 184 | version_string: "1.0.0",
|
185 | 185 | status: "completed",
|
186 | 186 | user_fraction: 1.0,
|
|
244 | 244 | end
|
245 | 245 |
|
246 | 246 | it "allows the retries to drain out if the lock could not be acquired on time" do
|
247 |
| - begin |
248 |
| - # pre-acquire lock elsewhere |
249 |
| - allow(api_double).to receive(:halt_release) { sleep 10 } |
250 |
| - Thread.new { google_integration.halt_release(anything, anything, anything, anything) } |
251 |
| - sleep 1 |
252 |
| - |
253 |
| - allow(google_integration).to receive(:api_lock_params).and_return(retry_count: 1, retry_delay: 1) |
254 |
| - allow(api_double).to receive(:create_release) |
255 |
| - |
256 |
| - # queue new request that cannot acquire the lock |
257 |
| - r = google_integration.rollout_release(anything, anything, anything, anything, anything) |
258 |
| - expect(r.ok?).to be false |
259 |
| - puts r.error.backtrace |
260 |
| - expect(r.error.reason).to eq(GooglePlayStoreIntegration::LOCK_ACQUISITION_FAILURE_REASON) |
261 |
| - rescue => e |
262 |
| - puts e.backtrace |
263 |
| - end |
| 247 | + # pre-acquire lock elsewhere |
| 248 | + allow(api_double).to receive(:halt_release) { sleep 10 } |
| 249 | + Thread.new { google_integration.halt_release(anything, anything, anything, anything) } |
| 250 | + sleep 1 |
| 251 | + |
| 252 | + allow(google_integration).to receive(:api_lock_params).and_return(retry_count: 1, retry_delay: 1) |
| 253 | + allow(api_double).to receive(:create_release) |
| 254 | + |
| 255 | + # queue new request that cannot acquire the lock |
| 256 | + r = google_integration.rollout_release(anything, anything, anything, anything, anything) |
| 257 | + expect(r.ok?).to be false |
| 258 | + puts r.error.backtrace |
| 259 | + expect(r.error.reason).to eq(GooglePlayStoreIntegration::LOCK_ACQUISITION_FAILURE_REASON) |
| 260 | + rescue => e |
| 261 | + puts e.backtrace |
264 | 262 | end
|
265 | 263 | end
|
266 | 264 | end
|
0 commit comments