mounttest: wait for files to disappear from the directory listing

This commit is contained in:
Nick Craig-Wood 2017-11-18 18:40:28 +00:00
parent b21f227bd3
commit 00b46a8b96

View file

@ -338,6 +338,16 @@ func (r *Run) rm(t *testing.T, filepath string) {
filepath = r.path(filepath)
err := os.Remove(filepath)
require.NoError(t, err)
// Wait for file to disappear from listing
for i := 0; i < 10; i++ {
_, err := os.Stat(filepath)
if os.IsNotExist(err) {
return
}
time.Sleep(100 * time.Millisecond)
}
assert.Fail(t, "failed to delete file", filepath)
}
func (r *Run) rmdir(t *testing.T, filepath string) {