mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -05:00
fix testListMultipartUpload
in aws-sdk-go (#11122)
Currently, the test doesn't complete nor abort the multipart upload after tesing the list operation. It caused the `cleanup()` to fail since the object can't not be deleted which causes the bucket deletion to fail. This PR adds a `CompleteMultipartUpload` call to commit the object so the cleanup can successfully delete the object and bucket.
This commit is contained in:
parent
90158f1e33
commit
cce5d7152a
@ -921,15 +921,32 @@ func testListMultipartUploads(s3Client *s3.S3) {
|
||||
return
|
||||
}
|
||||
|
||||
completedParts := make([]*s3.CompletedPart, len(parts))
|
||||
for _, part := range listParts.Parts {
|
||||
if tag, ok := parts[part.PartNumber]; ok {
|
||||
if tag != part.ETag {
|
||||
failureLog(function, args, startTime, "", fmt.Sprintf("AWS SDK Go ListParts.Parts output mismatch want: %v got: %v", tag, part.ETag), err).Fatal()
|
||||
return
|
||||
}
|
||||
completedParts = append(completedParts, &s3.CompletedPart{
|
||||
ETag: part.ETag,
|
||||
PartNumber: part.PartNumber,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
_, err = s3Client.CompleteMultipartUpload(&s3.CompleteMultipartUploadInput{
|
||||
Bucket: aws.String(bucket),
|
||||
Key: aws.String(object),
|
||||
MultipartUpload: &s3.CompletedMultipartUpload{
|
||||
Parts: completedParts},
|
||||
UploadId: multipartUpload.UploadId,
|
||||
})
|
||||
if err != nil {
|
||||
failureLog(function, args, startTime, "", fmt.Sprintf("AWS SDK Go CompleteMultipartUpload failed"), err).Fatal()
|
||||
return
|
||||
}
|
||||
|
||||
successLogger(function, args, startTime).Info()
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user