@@ -1160,95 +1160,6 @@ func (h *failPartHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
1160
1160
h .failsRemaining --
1161
1161
}
1162
1162
1163
- // TestUploadRequestChecksumCalculation tests that checksum behavior respects
1164
- // the RequestChecksumCalculation setting for backwards compatibility.
1165
- func TestUploadRequestChecksumCalculation (t * testing.T ) {
1166
- testCases := []struct {
1167
- name string
1168
- requestChecksumCalculation aws.RequestChecksumCalculation
1169
- inputChecksumAlgorithm types.ChecksumAlgorithm
1170
- expectedChecksumAlgorithm types.ChecksumAlgorithm
1171
- description string
1172
- }{
1173
- {
1174
- name : "WhenRequired_NoDefault" ,
1175
- requestChecksumCalculation : aws .RequestChecksumCalculationWhenRequired ,
1176
- inputChecksumAlgorithm : "" ,
1177
- expectedChecksumAlgorithm : "" ,
1178
- description : "When RequestChecksumCalculationWhenRequired is set, no default checksum should be applied (backwards compatibility)" ,
1179
- },
1180
- {
1181
- name : "WhenSupported_HasDefault" ,
1182
- requestChecksumCalculation : aws .RequestChecksumCalculationWhenSupported ,
1183
- inputChecksumAlgorithm : "" ,
1184
- expectedChecksumAlgorithm : types .ChecksumAlgorithmCrc32 ,
1185
- description : "When RequestChecksumCalculationWhenSupported is set, default CRC32 checksum should be applied" ,
1186
- },
1187
- {
1188
- name : "WhenRequired_ExplicitPreserved" ,
1189
- requestChecksumCalculation : aws .RequestChecksumCalculationWhenRequired ,
1190
- inputChecksumAlgorithm : types .ChecksumAlgorithmSha256 ,
1191
- expectedChecksumAlgorithm : types .ChecksumAlgorithmSha256 ,
1192
- description : "Explicit checksums should always be preserved regardless of RequestChecksumCalculation setting" ,
1193
- },
1194
- {
1195
- name : "WhenSupported_ExplicitPreserved" ,
1196
- requestChecksumCalculation : aws .RequestChecksumCalculationWhenSupported ,
1197
- inputChecksumAlgorithm : types .ChecksumAlgorithmSha1 ,
1198
- expectedChecksumAlgorithm : types .ChecksumAlgorithmSha1 ,
1199
- description : "Explicit checksums should override defaults even with WhenSupported" ,
1200
- },
1201
- }
1202
-
1203
- for _ , tc := range testCases {
1204
- t .Run (tc .name , func (t * testing.T ) {
1205
- c , invocations , args := s3testing .NewUploadLoggingClient (nil )
1206
-
1207
- mgr := manager .NewUploader (c ,
1208
- manager .WithUploaderRequestOptions (func (o * s3.Options ) {
1209
- o .RequestChecksumCalculation = tc .requestChecksumCalculation
1210
- }))
1211
-
1212
- input := & s3.PutObjectInput {
1213
- Bucket : aws .String ("Bucket" ),
1214
- Key : aws .String ("Key" ),
1215
- Body : bytes .NewReader (buf12MB ), // Large enough to trigger multipart upload
1216
- }
1217
- if tc .inputChecksumAlgorithm != "" {
1218
- input .ChecksumAlgorithm = tc .inputChecksumAlgorithm
1219
- }
1220
-
1221
- resp , err := mgr .Upload (context .Background (), input )
1222
- if err != nil {
1223
- t .Errorf ("Expected no error but received %v" , err )
1224
- }
1225
-
1226
- expectedOps := []string {"CreateMultipartUpload" , "UploadPart" , "UploadPart" , "UploadPart" , "CompleteMultipartUpload" }
1227
- if diff := cmpDiff (expectedOps , * invocations ); len (diff ) > 0 {
1228
- t .Error (diff )
1229
- }
1230
-
1231
- if resp .UploadID != "UPLOAD-ID" {
1232
- t .Errorf ("expect %q, got %q" , "UPLOAD-ID" , resp .UploadID )
1233
- }
1234
-
1235
- cmu := (* args )[0 ].(* s3.CreateMultipartUploadInput )
1236
- if cmu .ChecksumAlgorithm != tc .expectedChecksumAlgorithm {
1237
- t .Errorf ("%s: Expected checksum algorithm %v in CreateMultipartUpload, but got %v" ,
1238
- tc .description , tc .expectedChecksumAlgorithm , cmu .ChecksumAlgorithm )
1239
- }
1240
-
1241
- for i := 1 ; i <= 3 ; i ++ {
1242
- uploadPart := (* args )[i ].(* s3.UploadPartInput )
1243
- if uploadPart .ChecksumAlgorithm != tc .expectedChecksumAlgorithm {
1244
- t .Errorf ("%s: Expected checksum algorithm %v in UploadPart %d, but got %v" ,
1245
- tc .description , tc .expectedChecksumAlgorithm , i , uploadPart .ChecksumAlgorithm )
1246
- }
1247
- }
1248
- })
1249
- }
1250
- }
1251
-
1252
1163
type recordedBufferProvider struct {
1253
1164
content []byte
1254
1165
size int
0 commit comments