]> go.fuhry.dev Git - fsnotify.git/commitdiff
inotify: fix race in test
authorNathan Youngman <git@nathany.com>
Thu, 17 Dec 2015 04:41:17 +0000 (21:41 -0700)
committerNathan Youngman <git@nathany.com>
Thu, 17 Dec 2015 05:18:39 +0000 (22:18 -0700)
inotify_test.go

index 4b5c4b18492a0cdfe41debaf58862d85ee3a671e..31660f8e13ea6c10416992444f68a7aae122955d 100644 (file)
@@ -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)
        }