From: Nathan Youngman Date: Thu, 17 Dec 2015 04:41:17 +0000 (-0700) Subject: inotify: fix race in test X-Git-Tag: v1.7.2~209 X-Git-Url: https://go.fuhry.dev/?a=commitdiff_plain;h=b0cd95be6096bb4ae1c38f2e0909c773599f6143;p=fsnotify.git inotify: fix race in test --- diff --git a/inotify_test.go b/inotify_test.go index 4b5c4b1..31660f8 100644 --- a/inotify_test.go +++ b/inotify_test.go @@ -332,6 +332,8 @@ func TestInotifyInnerMapLength(t *testing.T) { _ = <-w.Events // consume Remove event <-time.After(50 * time.Millisecond) // wait IN_IGNORE propagated + w.mu.Lock() + defer w.mu.Unlock() if len(w.watches) != 0 { t.Fatalf("Expected watches len is 0, but got: %d, %v", len(w.watches), w.watches) }