Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

mounttest: wait for files to disappear from the directory listing

Nick Craig-Wood00b46a8b969a
diff --git a/cmd/mountlib/mounttest/fs.go b/cmd/mountlib/mounttest/fs.go
index cf6489e65..02b832a6a 100644
--- a/cmd/mountlib/mounttest/fs.go
+++ b/cmd/mountlib/mounttest/fs.go
@@ -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) {