diff options
author | Valery Piashchynski <[email protected]> | 2020-12-03 13:41:23 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-12-03 13:41:23 +0300 |
commit | 1a2d525dfb5b8d1d59c93da79fabcf2ca3f5c56d (patch) | |
tree | 46a0d9250b2a5b37e0b93887e28e9a06bc960021 /sync_worker_test.go | |
parent | 9f6933832a006030c61321914c84cd4aed80718b (diff) |
Experimental to replace wg with strings compare
Diffstat (limited to 'sync_worker_test.go')
-rwxr-xr-x | sync_worker_test.go | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/sync_worker_test.go b/sync_worker_test.go index c4febbb4..b44efd2e 100755 --- a/sync_worker_test.go +++ b/sync_worker_test.go @@ -3,8 +3,9 @@ package roadrunner import ( "context" "os/exec" - "sync" + "strings" "testing" + "time" "github.com/spiral/errors" "github.com/stretchr/testify/assert" @@ -160,13 +161,11 @@ func Test_Broken(t *testing.T) { t.Fatal(err) } - wg := &sync.WaitGroup{} - wg.Add(1) - + data := "" w.AddListener(func(event interface{}) { - assert.Contains(t, string(event.(WorkerEvent).Payload.([]byte)), "undefined_function()") - wg.Done() - return + if wev, ok := event.(WorkerEvent); ok { + data = string(wev.Payload.([]byte)) + } }) syncWorker, err := NewSyncWorker(w) @@ -179,7 +178,10 @@ func Test_Broken(t *testing.T) { assert.Nil(t, res.Body) assert.Nil(t, res.Context) - wg.Wait() + time.Sleep(time.Second * 3) + if strings.ContainsAny(data, "undefined_function()") == false { + t.Fail() + } assert.Error(t, w.Stop(ctx)) } |