summaryrefslogtreecommitdiff
path: root/static_pool_test.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-11-09 14:51:34 +0300
committerValery Piashchynski <[email protected]>2020-11-09 14:51:34 +0300
commit83c14cbad2d7d403b08efbb3cf900df9b52b4938 (patch)
treeb084a2ca99eb7523232f477678f8aa2a82cd5812 /static_pool_test.go
parentb7b533dbe13d2c1a8e78c0e33a4a388c56884440 (diff)
Add spiral errors
Diffstat (limited to 'static_pool_test.go')
-rwxr-xr-xstatic_pool_test.go20
1 files changed, 11 insertions, 9 deletions
diff --git a/static_pool_test.go b/static_pool_test.go
index 309449ab..8f8a6f56 100755
--- a/static_pool_test.go
+++ b/static_pool_test.go
@@ -157,7 +157,7 @@ func Test_StaticPool_JobError(t *testing.T) {
t.Fatal("error should be of type errors.Exec")
}
- assert.Contains(t, err.Error(), "exec_payload: Exec: hello")
+ assert.Contains(t, err.Error(), "exec payload: Exec: hello")
}
func Test_StaticPool_Broken_Replace(t *testing.T) {
@@ -174,22 +174,24 @@ func Test_StaticPool_Broken_Replace(t *testing.T) {
wg := &sync.WaitGroup{}
wg.Add(1)
- p.AddListener(func(event interface{}) {
- if pev, ok := event.(PoolEvent); ok {
- sw := pev.Payload.(SyncWorker)
- sw.AddListener(func(event interface{}) {
- if wev, ok := event.(WorkerEvent); ok {
+ 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
}
- })
- }
- })
+ }
+ })
+ }
+
res, err := p.ExecWithContext(ctx, Payload{Body: []byte("hello")})
assert.Error(t, err)
assert.Nil(t, res.Context)
assert.Nil(t, res.Body)
+
wg.Wait()
p.Destroy(ctx)