summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-11-26 02:06:34 +0300
committerValery Piashchynski <[email protected]>2020-11-26 02:06:34 +0300
commit01d4963613980cec928577e01223001b94e1ac55 (patch)
treecd74138e64ad41b9fcb7fe0a09e2937e7d77fb7c
parentd68d0473cc804110627aa8adf680ea260adf5d40 (diff)
Fix negative waitgroup count in the Test_Broken test
-rwxr-xr-xsync_worker_test.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/sync_worker_test.go b/sync_worker_test.go
index df3222d8..59216880 100755
--- a/sync_worker_test.go
+++ b/sync_worker_test.go
@@ -3,7 +3,6 @@ package roadrunner
import (
"context"
"os/exec"
- "sync"
"testing"
"github.com/spiral/errors"
@@ -160,12 +159,11 @@ func Test_Broken(t *testing.T) {
t.Fatal(err)
}
- wg := &sync.WaitGroup{}
- wg.Add(1)
+ ch := make(chan struct{})
w.AddListener(func(event interface{}) {
assert.Contains(t, string(event.(WorkerEvent).Payload.([]byte)), "undefined_function()")
- wg.Done()
+ ch <- struct{}{}
})
syncWorker, err := NewSyncWorker(w)
@@ -178,7 +176,7 @@ func Test_Broken(t *testing.T) {
assert.Nil(t, res.Body)
assert.Nil(t, res.Context)
- wg.Wait()
+ <-ch
assert.Error(t, w.Stop(ctx))
}