diff options
author | Valery Piashchynski <[email protected]> | 2020-12-01 00:06:06 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-12-01 00:06:06 +0300 |
commit | 5e9a4653fb62cc8c16ca8060f3d13c2e02081eb0 (patch) | |
tree | c986140f84f6e8597d06d33000188cc0f2c333bc /static_pool_test.go | |
parent | 870f2459c56a1e8c7050fa621e256c3e57a33ac2 (diff) |
Correct litener in TestBrokenReplace test
Diffstat (limited to 'static_pool_test.go')
-rwxr-xr-x | static_pool_test.go | 33 |
1 files changed, 8 insertions, 25 deletions
diff --git a/static_pool_test.go b/static_pool_test.go index 2823cbc4..15545e9a 100755 --- a/static_pool_test.go +++ b/static_pool_test.go @@ -174,31 +174,15 @@ func Test_StaticPool_Broken_Replace(t *testing.T) { wg := &sync.WaitGroup{} wg.Add(1) - // force test to finish - tt := time.NewTimer(time.Second * 20) - go func() { - select { - case <-tt.C: - tt.Stop() - assert.Fail(t, "force exit from the test") - wg.Done() - } - }() - - time.Sleep(time.Second) - - workers := p.Workers() - for i := 0; i < len(workers); i++ { - workers[i].AddListener(func(event interface{}) { - if wev, ok := event.(WorkerEvent); ok { - if wev.Event == EventWorkerLog { - assert.Contains(t, string(wev.Payload.([]byte)), "undefined_function()") - wg.Done() - return - } + p.AddListener(func(event interface{}) { + if wev, ok := event.(WorkerEvent); ok { + if wev.Event == EventWorkerLog { + assert.Contains(t, string(wev.Payload.([]byte)), "undefined_function()") + wg.Done() + return } - }) - } + } + }) res, err := p.ExecWithContext(ctx, Payload{Body: []byte("hello")}) assert.Error(t, err) @@ -206,7 +190,6 @@ func Test_StaticPool_Broken_Replace(t *testing.T) { assert.Nil(t, res.Body) wg.Wait() - tt.Stop() p.Destroy(ctx) } |