12684: Test that plain 403 responses are not retried 12684-pysdk-auto-retry
authorBrett Smith <brett.smith@curii.com>
Thu, 18 May 2023 12:48:13 +0000 (08:48 -0400)
committerBrett Smith <brett.smith@curii.com>
Thu, 18 May 2023 12:53:38 +0000 (08:53 -0400)
Requested in review.

Arvados-DCO-1.1-Signed-off-by: Brett Smith <brett.smith@curii.com>

sdk/python/tests/test_api.py

index e54f387b3951a944cef30375cafc671502d2366c..8667d5160cb5332d9c7154ad67a42764e1d75da1 100644 (file)
@@ -168,7 +168,10 @@ class ArvadosApiTest(run_test_server.TestCaseWithServers):
 
     def test_4xx_not_retried(self):
         client = arvados.api('v1', num_retries=3)
-        for code in [400, 401, 404, 422]:
+        # Note that googleapiclient does retry 403 *if* the response JSON
+        # includes flags that say the request was denied by rate limiting.
+        # An empty JSON response like we use here should not be retried.
+        for code in [400, 401, 403, 404, 422]:
             with self.subTest(f'error {code}'), mock.patch('time.sleep'):
                 with mock_api_responses(
                         client,