Skip to content

Commit

Permalink
dirwatcher_test: avoid test-harness log race
Browse files Browse the repository at this point in the history
Don't log after the test has completed
  • Loading branch information
w-miller authored and illarion committed Sep 12, 2024
1 parent 7e37fc4 commit 94e0ba3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dirwatcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
"sync"
"testing"
"time"
)
Expand Down Expand Up @@ -89,7 +90,12 @@ func TestDirWatcher(t *testing.T) {
t.Error(err)
}

var wg sync.WaitGroup
defer wg.Wait()

wg.Add(1)
go func() {
defer wg.Done()
for e := range dw.C {
t.Logf("Event received: %v", e)
}
Expand Down

0 comments on commit 94e0ba3

Please sign in to comment.