Skip to content

Commit

Permalink
add copyObject test changing metadata and preserving etag
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana authored and minio-trusted committed Mar 9, 2018
1 parent 01327a0 commit 9814daf
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions functional_tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -2705,6 +2705,37 @@ func testCopyObject() {
return
}

// Perform the Copy which should update only metadata.
src = minio.NewSourceInfo(bucketName, objectName, nil)
dst, err = minio.NewDestinationInfo(bucketName, objectName, nil, map[string]string{
"Copy": "should be same",
})
args["dst"] = dst
args["src"] = src
if err != nil {
logError(testName, function, args, startTime, "", "NewDestinationInfo failed", err)
return
}

err = c.CopyObject(dst, src)
if err != nil {
logError(testName, function, args, startTime, "", "CopyObject shouldn't fail", err)
return
}

stOpts := minio.StatObjectOptions{}
stOpts.SetMatchETag(objInfo.ETag)
objInfo, err = c.StatObject(bucketName, objectName, stOpts)
if err != nil {
logError(testName, function, args, startTime, "", "CopyObject ETag should match and not fail", err)
return
}

if objInfo.Metadata.Get("x-amz-meta-copy") != "should be same" {
logError(testName, function, args, startTime, "", "CopyObject modified metadata should match", err)
return
}

// Delete all objects and buckets
if err = cleanupBucket(bucketName, c); err != nil {
logError(testName, function, args, startTime, "", "Cleanup failed", err)
Expand Down

0 comments on commit 9814daf

Please sign in to comment.