summaryrefslogtreecommitdiff
path: root/static_pool_test.go
diff options
context:
space:
mode:
authorAnton Titov <[email protected]>2019-12-23 14:52:06 +0300
committerGitHub <[email protected]>2019-12-23 14:52:06 +0300
commit921e1f55e23ab75b8250045916c8d1ffad1b8bde (patch)
tree00b16331b9ff3b3b846ba22989dddde721cc959d /static_pool_test.go
parent921354df1aa4687837e3ba6ac0eb04d39321c149 (diff)
parent2093cb9058f94668fff0a97beb76b0cab66c7b63 (diff)
Merge branch 'master' into Fix_warning_and_issues
Diffstat (limited to 'static_pool_test.go')
-rw-r--r--static_pool_test.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/static_pool_test.go b/static_pool_test.go
index f8ad4a4d..1f185f58 100644
--- a/static_pool_test.go
+++ b/static_pool_test.go
@@ -6,6 +6,7 @@ import (
"os/exec"
"runtime"
"strconv"
+ "strings"
"sync"
"testing"
"time"
@@ -154,9 +155,12 @@ func Test_StaticPool_Broken_Replace(t *testing.T) {
assert.NotNil(t, p)
+ done := make(chan interface{})
p.Listen(func(e int, ctx interface{}) {
if err, ok := ctx.(error); ok {
- assert.Contains(t, err.Error(), "undefined_function()")
+ if strings.Contains(err.Error(), "undefined_function()") {
+ close(done)
+ }
}
})
@@ -164,6 +168,8 @@ func Test_StaticPool_Broken_Replace(t *testing.T) {
assert.Error(t, err)
assert.Nil(t, res)
+
+ <-done
}
func Test_StaticPool_Broken_FromOutside(t *testing.T) {
@@ -195,12 +201,10 @@ func Test_StaticPool_Broken_FromOutside(t *testing.T) {
})
// killing random worker and expecting pool to replace it
- p.muw.Lock()
err = p.Workers()[0].cmd.Process.Kill()
if err != nil {
t.Errorf("error killing the process: error %v", err)
}
- p.muw.Unlock()
<-destructed
for _, w := range p.Workers() {