Add retry for eventual consistency in findObject test

This commit is contained in:
Nick Craig-Wood 2015-12-30 10:46:04 +00:00
parent 2f4b9f619d
commit acd350d833

View file

@ -137,7 +137,16 @@ func TestFsNewFsObjectNotFound(t *testing.T) {
}
func findObject(t *testing.T, Name string) fs.Object {
obj := remote.NewFsObject(Name)
var obj fs.Object
const retries = 10
for i := 1; i <= retries; i++ {
obj = remote.NewFsObject(Name)
if obj != nil {
break
}
t.Logf("Sleeping for 1 second for findObject eventual consistency: %d/%d", i, retries)
time.Sleep(1 * time.Second)
}
if obj == nil {
t.Fatalf("Object not found: %q", Name)
}