summaryrefslogtreecommitdiff
path: root/static_pool_test.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-12-01 16:35:46 +0300
committerValery Piashchynski <[email protected]>2020-12-01 16:35:46 +0300
commitb8070b240480519fd4bcaa9fda1e4c518b0af4dd (patch)
treed2fb712234d21645dbfd326fa8b141265e31bfcc /static_pool_test.go
parent394e7cb4a0e31549f9bf078adb99154abfaa8321 (diff)
Replace waitgroup with channel
Diffstat (limited to 'static_pool_test.go')
-rwxr-xr-xstatic_pool_test.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/static_pool_test.go b/static_pool_test.go
index 91721db5..88585318 100755
--- a/static_pool_test.go
+++ b/static_pool_test.go
@@ -172,15 +172,14 @@ func Test_StaticPool_Broken_Replace(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, p)
- wg := &sync.WaitGroup{}
- wg.Add(1)
+ block := make(chan struct{})
p.AddListener(func(event interface{}) {
if wev, ok := event.(WorkerEvent); ok {
if wev.Event == EventWorkerLog {
e := string(wev.Payload.([]byte))
if strings.ContainsAny(e, "undefined_function()") {
- wg.Done()
+ block <- struct{}{}
return
}
}
@@ -192,7 +191,7 @@ func Test_StaticPool_Broken_Replace(t *testing.T) {
assert.Nil(t, res.Context)
assert.Nil(t, res.Body)
- wg.Wait()
+ <-block
p.Destroy(ctx)
}