diff options
Diffstat (limited to 'sync_worker_test.go')
-rwxr-xr-x | sync_worker_test.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sync_worker_test.go b/sync_worker_test.go index 59216880..db46ea6e 100755 --- a/sync_worker_test.go +++ b/sync_worker_test.go @@ -4,6 +4,7 @@ import ( "context" "os/exec" "testing" + "time" "github.com/spiral/errors" "github.com/stretchr/testify/assert" @@ -158,9 +159,17 @@ func Test_Broken(t *testing.T) { if err != nil { t.Fatal(err) } - ch := make(chan struct{}) + go func() { + tt := time.NewTimer(time.Second * 10) + select { + case <-tt.C: + tt.Stop() + ch <- struct{}{} + } + }() + w.AddListener(func(event interface{}) { assert.Contains(t, string(event.(WorkerEvent).Payload.([]byte)), "undefined_function()") ch <- struct{}{} |