Skip to content

Commit

Permalink
Fix TestInotifyOverflow (#265)
Browse files Browse the repository at this point in the history
* Queued inotify events could have been read by the test before max_queued_events was hit
  • Loading branch information
matthias-stone authored and nathany committed Aug 30, 2018
1 parent 1d13583 commit 70cc4a1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions inotify_test.go
Expand Up @@ -11,6 +11,7 @@ import (
"os"
"path/filepath"
"strings"
"sync"
"testing"
"time"
)
Expand Down Expand Up @@ -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)
Expand All @@ -409,8 +413,10 @@ func TestInotifyOverflow(t *testing.T) {
continue
}
}
wg.Done()
}()
}
wg.Wait()

creates := 0
overflows := 0
Expand Down

0 comments on commit 70cc4a1

Please sign in to comment.