From 141c13381858271368936353cd1518084ac9f58b Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Fri, 16 Nov 2018 07:45:24 +0000 Subject: [PATCH] fstest: Wait for longer if neccessary in TestFsChangeNotify --- fstest/fstests/fstests.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fstest/fstests/fstests.go b/fstest/fstests/fstests.go index 8222947e4..972c414ca 100644 --- a/fstest/fstests/fstests.go +++ b/fstest/fstests/fstests.go @@ -1035,7 +1035,14 @@ func Run(t *testing.T, opt *Opt) { objs = append(objs, o) } - time.Sleep(3 * time.Second) + // Wait a little while for the changes to come in + for tries := 1; tries < 10; tries++ { + if len(dirChanges) == 3 && len(objChanges) == 3 { + break + } + t.Logf("Try %d/10 waiting for dirChanges and objChanges", tries) + time.Sleep(3 * time.Second) + } assert.Equal(t, []string{"dir/subdir1", "dir/subdir3", "dir/subdir2"}, dirChanges) assert.Equal(t, []string{"dir/file2", "dir/file4", "dir/file3"}, objChanges)