diff options
author | Valery Piashchynski <[email protected]> | 2020-11-26 02:21:26 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-11-26 02:21:26 +0300 |
commit | 1dd72a324cabfc84c463181efb2573a54be1df4a (patch) | |
tree | 0adaf906e0cc99f8069e4fc0dda5ab96788bcd79 /sync_worker_test.go | |
parent | 01d4963613980cec928577e01223001b94e1ac55 (diff) |
Add force exit from Test_Broken
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{}{} |