// Case with valid UploadID, existing bucket name.
// But using the bucket name from which NewMultipartUpload is not constructed from.
{"unused-bucket",object,uploadID,1,"","",0,false,"",fmt.Errorf("%s","Invalid upload id "+uploadID)},
// Test Case - 10.
// Test Case - 11.
// Case with valid UploadID, existing bucket name.
// But using the object name from which NewMultipartUpload is not constructed from.
{bucket,"none-object",uploadID,1,"","",0,false,"",fmt.Errorf("%s","Invalid upload id "+uploadID)},
// Test case - 11.
// Test case - 12.
// Input to replicate Md5 mismatch.
{bucket,object,uploadID,1,"","a35",0,false,"",
fmt.Errorf("%s","Bad digest: Expected a35 is not valid with what we calculated "+"d41d8cd98f00b204e9800998ecf8427e")},
// Test case - 12.
// Input with size more than the size of actual data inside the reader.
{bucket,object,uploadID,1,"abcd","a35",int64(len("abcd")+1),false,"",fmt.Errorf("%s","Bad digest: Expected a35 is not valid with what we calculated e2fc714c4727ee9395f324cd2e7f331f")},
// Test case - 13.
// Input with size more than the size of actual data inside the reader.
t.Errorf("Test %d: %s: Expected to fail with error \"%s\", but instead failed with error \"%s\" instead",i+1,instanceType,testCase.expectedErr.Error(),actualErr.Error())
}
}
// Passes as expected, but asserting the results.
ifactualErr==nil&&testCase.shouldPass{
expectedResult:=testCase.expectedResult
// Asserting the MaxParts.
ifactualResult.MaxParts!=expectedResult.MaxParts{
t.Errorf("Test %d: %s: Expected the MaxParts to be %d, but instead found it to be %d",i+1,instanceType,expectedResult.MaxParts,actualResult.MaxParts)
}
// Asserting Object Name.
ifactualResult.Object!=expectedResult.Object{
t.Errorf("Test %d: %s: Expected Object name to be \"%s\", but instead found it to be \"%s\"",i+1,instanceType,expectedResult.Object,actualResult.Object)
}
// Asserting UploadID.
ifactualResult.UploadID!=expectedResult.UploadID{
t.Errorf("Test %d: %s: Expected UploadID to be \"%s\", but instead found it to be \"%s\"",i+1,instanceType,expectedResult.UploadID,actualResult.UploadID)
t.Errorf("Test %d: %s: Expected NextPartNumberMarker to be \"%d\", but instead found it to be \"%d\"",i+1,instanceType,expectedResult.NextPartNumberMarker,actualResult.NextPartNumberMarker)
t.Errorf("Test %d: %s: Expected PartNumberMarker to be \"%d\", but instead found it to be \"%d\"",i+1,instanceType,expectedResult.PartNumberMarker,actualResult.PartNumberMarker)
}
// Asserting the BucketName.
ifactualResult.Bucket!=expectedResult.Bucket{
t.Errorf("Test %d: %s: Expected Bucket to be \"%s\", but instead found it to be \"%s\"",i+1,instanceType,expectedResult.Bucket,actualResult.Bucket)
t.Errorf("Test %d: %s: Expected IsTruncated to be \"%v\", but found it to \"%v\"",i+1,instanceType,expectedResult.IsTruncated,actualResult.IsTruncated)
t.Errorf("Test %d: %s: Expected the result to contain info of %d Parts, but found %d instead",i+1,instanceType,len(expectedResult.Parts),len(actualResult.Parts))
}else{
// Iterating over the partInfos and asserting the fields.
t.Errorf("Test %d: %s: Part %d: Expected PartNumber to be \"%d\", but instead found \"%d\"",i+1,instanceType,j+1,expectedResult.Parts[j].PartNumber,actualMetaData.PartNumber)
t.Errorf("Test %d: %s: Part %d: Expected Part Size to be \"%d\", but instead found \"%d\"",i+1,instanceType,j+1,expectedResult.Parts[j].Size,actualMetaData.Size)
t.Errorf("Test %d: %s: Part %d: Expected Etag to be \"%s\", but instead found \"%s\"",i+1,instanceType,j+1,expectedResult.Parts[j].ETag,actualMetaData.ETag)