@@ -58,28 +58,24 @@ def test_s3_object_multipart(self):
58
58
def test_s3_object_multipart_non_sequential (self ):
59
59
bucket = s3_bucket .create_bucket_s3 (self .s3_client , bucket_configuration = "rep-1" )
60
60
set_bucket_versioning (self .s3_client , bucket , s3_bucket .VersioningStatus .ENABLED )
61
- parts_count = 5
61
+ parts_count = 11
62
62
file_name_large = generate_file (PART_SIZE * parts_count ) # 5Mb - min part
63
63
object_key = object_key_from_file_path (file_name_large )
64
64
part_files = split_file (file_name_large , parts_count )
65
65
parts = []
66
66
67
- with allure .step ("Upload second part " ):
67
+ with allure .step ("Create multipart upload " ):
68
68
upload_id = s3_object .create_multipart_upload_s3 (self .s3_client , bucket , object_key )
69
69
uploads = s3_object .list_multipart_uploads_s3 (self .s3_client , bucket )
70
- etag = s3_object .upload_part_s3 (self .s3_client , bucket , object_key , upload_id , 2 , part_files [1 ])
71
- parts .append ((2 , etag ))
72
70
73
- with allure .step ("Upload first part" ):
74
- etag = s3_object .upload_part_s3 (self .s3_client , bucket , object_key , upload_id , 1 , part_files [0 ])
75
- parts .append ((1 , etag ))
76
- got_parts = s3_object .list_parts_s3 (self .s3_client , bucket , object_key , upload_id )
77
- assert len (got_parts ) == 2 , f"Expected { 1 } parts, got\n { got_parts } "
71
+ with allure .step ("Upload all parts in random order" ):
72
+ part_orders = list (enumerate (part_files , start = 1 ))
73
+ random .shuffle (part_orders )
78
74
79
- with allure .step ("Upload last parts" ):
80
- for part_id , file_path in enumerate (part_files [2 :], start = 3 ):
75
+ for part_id , file_path in part_orders :
81
76
etag = s3_object .upload_part_s3 (self .s3_client , bucket , object_key , upload_id , part_id , file_path )
82
77
parts .append ((part_id , etag ))
78
+
83
79
got_parts = s3_object .list_parts_s3 (self .s3_client , bucket , object_key , upload_id )
84
80
sorted_parts = sorted (parts , key = lambda x : x [0 ])
85
81
s3_object .complete_multipart_upload_s3 (self .s3_client , bucket , object_key , upload_id , sorted_parts )
0 commit comments