c.Errorf("%s: Number of objects in the result different from expected value.",instanceType)
}
ifresult.IsTruncated!=false{
c.Errorf("%s: Expected IsTruncated to be `false`, but instead found it to be `%v`",instanceType,result.IsTruncated)
}
uploadContent:="The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed."
// check before paging occurs.
fori:=0;i<5;i++{
key:="obj"+strconv.Itoa(i)
_,err=obj.PutObject("bucket",key,int64(len("The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed.")),bytes.NewBufferString("The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed."),nil)
c.Errorf("%s: Expected length of objects to be %d, instead found to be %d",instanceType,len(result.Objects),i+1)
}
ifresult.IsTruncated!=false{
c.Errorf("%s: Expected IsTruncated to be `false`, but instead found it to be `%v`",instanceType,result.IsTruncated)
}
}
// check after paging occurs pages work.
fori:=6;i<=10;i++{
key:="obj"+strconv.Itoa(i)
_,err=obj.PutObject("bucket",key,int64(len("The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed.")),bytes.NewBufferString("The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed."),nil)
c.Errorf("%s: Expected length of objects to be %d, instead found to be %d",instanceType,5,len(result.Objects))
}
ifresult.IsTruncated!=true{
c.Errorf("%s: Expected IsTruncated to be `true`, but instead found it to be `%v`",instanceType,result.IsTruncated)
}
}
// check paging with prefix at end returns less objects.
{
_,err=obj.PutObject("bucket","newPrefix",int64(len("The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed.")),bytes.NewBufferString("The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed."),nil)
c.Assert(err,check.IsNil)
_,err=obj.PutObject("bucket","newPrefix2",int64(len("The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed.")),bytes.NewBufferString("The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed."),nil)
c.Errorf("%s: Expected the object name to be `%s`, but instead found `%s`",instanceType,"newPrefix",result.Objects[0].Name)
}
ifresult.Objects[1].Name!="newPrefix2"{
c.Errorf("%s: Expected the object name to be `%s`, but instead found `%s`",instanceType,"newPrefix",result.Objects[1].Name)
}
ifresult.Objects[2].Name!="obj0"{
c.Errorf("%s: Expected the object name to be `%s`, but instead found `%s`",instanceType,"newPrefix",result.Objects[2].Name)
}
ifresult.Objects[3].Name!="obj1"{
c.Errorf("%s: Expected the object name to be `%s`, but instead found `%s`",instanceType,"newPrefix",result.Objects[3].Name)
}
ifresult.Objects[4].Name!="obj10"{
c.Errorf("%s: Expected the object name to be `%s`, but instead found `%s`",instanceType,"newPrefix",result.Objects[4].Name)
}
}
// check delimited results with delimiter and prefix.
{
_,err=obj.PutObject("bucket","this/is/delimited",int64(len("The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed.")),bytes.NewBufferString("The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed."),nil)
c.Assert(err,check.IsNil)
_,err=obj.PutObject("bucket","this/is/also/a/delimited/file",int64(len("The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed.")),bytes.NewBufferString("The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed."),nil)
_,err=obj.PutObject("bucket","object",int64(len("The list of parts was not in ascending order. The parts list must be specified in order by part number.")),bytes.NewBufferString("The list of parts was not in ascending order. The parts list must be specified in order by part number."),nil)
c.Assert(err,check.IsNil)
iferr!=nil{
c.Fatalf("%s: <ERROR> %s",instanceType,err)
}
length:=int64(len("The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed."))
_,err=obj.PutObject("bucket","object",length,bytes.NewBufferString("The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed."),nil)
c.Assert(err,check.IsNil)
uploadContent:="The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed."
c.Assert(string(bytesBuffer.Bytes()),check.Equals,"The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed.")
iferr!=nil{
c.Fatalf("%s: <ERROR> %s",instanceType,err)
}
ifstring(bytesBuffer.Bytes())!="The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed."{
c.Errorf("%s: Invalid upload ID error mismatch.",instanceType)
}
}
// Wrapper for calling testNonExistantBucketOperations for both XL and FS.
length:=int64(len("The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed."))
_,err=obj.PutObject("bucket","dir1/dir2/object",length,bytes.NewBufferString("The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed."),nil)
c.Assert(len(bytesBuffer.Bytes()),check.Equals,len("The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed."))
iferr!=nil{
c.Fatalf("%s: <ERROR> %s",instanceType,err)
}
iflen(bytesBuffer.Bytes())!=len(uploadContent){
c.Errorf("%s: Expected length of downloaded data to be `%d`, but instead found `%d`",
_,err=obj.PutObject("bucket","dir1/dir3/object",int64(len("The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed.")),bytes.NewBufferString("One or more of the specified parts could not be found. The part might not have been uploaded, or the specified entity tag might not have matched the part's entity tag."),nil)
c.Assert(err,check.IsNil)
_,err=obj.PutObject("bucket","dir1/dir3/object",
int64(len("The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed.")),
bytes.NewBufferString("One or more of the specified parts could not be found. The part might not have been uploaded, or the specified entity tag might not have matched the part's entity tag."),nil)
iferr!=nil{
c.Fatalf("%s: <ERROR> %s",instanceType,err)
}
_,err=obj.GetObjectInfo("bucket","dir1")
switcherr:=err.(type){
caseObjectNotFound:
c.Assert(err.Bucket,check.Equals,"bucket")
c.Assert(err.Object,check.Equals,"dir1")
iferr.Bucket!="bucket"{
c.Errorf("%s: Expected the bucket name in the error message to be `%s`, but instead found `%s`",instanceType,"bucket",err.Bucket)
}
iferr.Object!="dir1"{
c.Errorf("%s: Expected the object name in the error message to be `%s`, but instead found `%s`",instanceType,"dir1",err.Object)
}
default:
// force a failure with a line number.
c.Assert(err,check.Equals,"ObjectNotFound")
iferr.Error()!="ObjectNotFound"{
c.Errorf("%s: Expected the error message to be `%s`, but instead found `%s`",instanceType,"ObjectNotFound",err.Error())
}
}
_,err=obj.GetObjectInfo("bucket","dir1/")
switcherr:=err.(type){
caseObjectNameInvalid:
c.Assert(err.Bucket,check.Equals,"bucket")
c.Assert(err.Object,check.Equals,"dir1/")
iferr.Bucket!="bucket"{
c.Errorf("%s: Expected the bucket name in the error message to be `%s`, but instead found `%s`",instanceType,"bucket",err.Bucket)
}
iferr.Object!="dir1/"{
c.Errorf("%s: Expected the object name in the error message to be `%s`, but instead found `%s`",instanceType,"dir1/",err.Object)
}
default:
// force a failure with a line number.
c.Assert(err,check.Equals,"ObjectNotFound")
iferr.Error()!="ObjectNotFound"{
c.Errorf("%s: Expected the error message to be `%s`, but instead found `%s`",instanceType,"ObjectNotFound",err.Error())
}
}
}
// Test content-type
functestContentType(c*check.C,objObjectLayer){
err:=obj.MakeBucket("bucket")
c.Assert(err,check.IsNil)
// Wrapper for calling testContentType for both XL and FS.
uploadContent:="The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed."
// Test empty.
_,err=obj.PutObject("bucket","minio.png",int64(len("The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed.")),bytes.NewBufferString("The specified multipart upload does not exist. The upload ID might be invalid, or the multipart upload might have been aborted or completed."),nil)