diff --git a/inotify_test.go b/inotify_test.go index 54f3f00e..2c11d2ed 100644 --- a/inotify_test.go +++ b/inotify_test.go @@ -11,6 +11,7 @@ import ( "os" "path/filepath" "strings" + "sync" "testing" "time" ) @@ -390,9 +391,12 @@ func TestInotifyOverflow(t *testing.T) { errChan := make(chan error, numDirs*numFiles) + // All events need to be in the inotify queue before pulling events off it to trigger this error. + wg := sync.WaitGroup{} for dn := 0; dn < numDirs; dn++ { testSubdir := fmt.Sprintf("%s/%d", testDir, dn) + wg.Add(1) go func() { for fn := 0; fn < numFiles; fn++ { testFile := fmt.Sprintf("%s/%d", testSubdir, fn) @@ -409,8 +413,10 @@ func TestInotifyOverflow(t *testing.T) { continue } } + wg.Done() }() } + wg.Wait() creates := 0 overflows := 0