@@ -454,7 +454,7 @@ def test_call_rpc(self):
454
454
"Call is repeated up to 3 times" ,
455
455
)
456
456
457
- def test_upload_s3 (self ):
457
+ def test_upload_s3_503 (self ):
458
458
"""
459
459
Test 503 response is retried when uploading to S3.
460
460
"""
@@ -476,6 +476,30 @@ def test_upload_s3(self):
476
476
self .assertTrue (
477
477
max_attempts == self .sg ._make_upload_request .call_count ,
478
478
"Call is repeated up to 3 times" )
479
+
480
+ def test_upload_s3_500 (self ):
481
+ """
482
+ Test 500 response is retried when uploading to S3.
483
+ """
484
+ self ._setup_mock (s3_status_code_error = 500 )
485
+ this_dir , _ = os .path .split (__file__ )
486
+ storage_url = "http://foo.com/"
487
+ path = os .path .abspath (os .path .expanduser (
488
+ os .path .join (this_dir , "sg_logo.jpg" )))
489
+ max_attempts = 4 # Max retries to S3 server attempts
490
+ # Expected HTTPError exception error message
491
+ expected = "The server is currently down or to busy to reply." \
492
+ "Please try again later."
493
+
494
+ # Test the Internal function that is used to upload each
495
+ # data part in the context of multi-part uploads to S3, we
496
+ # simulate the HTTPError exception raised with 503 status errors
497
+ with self .assertRaises (api .ShotgunError , msg = expected ):
498
+ self .sg ._upload_file_to_storage (path , storage_url )
499
+ # Test the max retries attempt
500
+ self .assertTrue (
501
+ max_attempts == self .sg ._make_upload_request .call_count ,
502
+ "Call is repeated up to 3 times" )
479
503
480
504
def test_transform_data (self ):
481
505
"""Outbound data is transformed"""
0 commit comments