HealBucket: create the bucket if it is missing in one of the disks. (#2924)

This commit is contained in:
Krishna Srinivas
2016-10-14 23:42:17 +05:30
committed by Harshavardhana
parent 3349153058
commit 0320a77dc0
4 changed files with 56 additions and 0 deletions

View File

@@ -345,4 +345,21 @@ func TestHealObject(t *testing.T) {
if !reflect.DeepEqual(xlMetaPreHeal, xlMetaPostHeal) {
t.Fatal("HealObject failed")
}
// Remove the bucket - to simulate the case where bucket was created when the
// disk was down.
err = os.RemoveAll(path.Join(fsDirs[0], bucket))
if err != nil {
t.Fatal(err)
}
// This would create the bucket.
err = xl.HealObject(bucket, "")
if err != nil {
t.Fatal(err)
}
// Stat the bucket to make sure that it was created.
_, err = xl.storageDisks[0].StatVol(bucket)
if err != nil {
t.Fatal(err)
}
}