HealObject should succeed when only N/2 disks have data (#3952)

This commit is contained in:
Krishnan Parthasarathi
2017-03-22 22:45:16 +05:30
committed by Harshavardhana
parent fbfb4fc5a0
commit 417ec0df56
4 changed files with 38 additions and 7 deletions

View File

@@ -518,15 +518,36 @@ func TestHealObjectXL(t *testing.T) {
bucket := "bucket"
object := "object"
data := []byte("hello")
data := bytes.Repeat([]byte("a"), 5*1024*1024)
err = obj.MakeBucket(bucket)
if err != nil {
t.Fatalf("Failed to make a bucket - %v", err)
}
_, err = obj.PutObject(bucket, object, int64(len(data)), bytes.NewReader(data), nil, "")
// Create an object with multiple parts uploaded in decreasing
// part number.
uploadID, err := obj.NewMultipartUpload(bucket, object, nil)
if err != nil {
t.Fatalf("Failed to put an object - %v", err)
t.Fatalf("Failed to create a multipart upload - %v", err)
}
var uploadedParts []completePart
for _, partID := range []int{2, 1} {
pInfo, err := obj.PutObjectPart(bucket, object, uploadID, partID,
int64(len(data)), bytes.NewReader(data), "", "")
if err != nil {
t.Fatalf("Failed to upload a part - %v", err)
}
uploadedParts = append(uploadedParts, completePart{
PartNumber: pInfo.PartNumber,
ETag: pInfo.ETag,
})
}
_, err = obj.CompleteMultipartUpload(bucket, object, uploadID, uploadedParts)
if err != nil {
t.Fatalf("Failed to complete multipart upload - %v", err)
}
// Remove the object backend files from the first disk.