summaryrefslogtreecommitdiff
path: root/pkg/pool
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-08-14 20:52:58 +0300
committerValery Piashchynski <[email protected]>2021-08-14 20:52:58 +0300
commit891df1a8c8db3d61ce7f4e9ba77076369a9a9ce3 (patch)
treecf5a9390d1f5c1c851e75e1f4c4f6e971aee7444 /pkg/pool
parent560ca1e80c7e110d245bd28eaa1835bb9515f8b7 (diff)
Wait for a second to prevent Process not ready error
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'pkg/pool')
-rwxr-xr-xpkg/pool/static_pool_test.go22
1 files changed, 14 insertions, 8 deletions
diff --git a/pkg/pool/static_pool_test.go b/pkg/pool/static_pool_test.go
index b72b8c32..cb6578a8 100755
--- a/pkg/pool/static_pool_test.go
+++ b/pkg/pool/static_pool_test.go
@@ -227,9 +227,9 @@ func Test_StaticPool_Broken_FromOutside(t *testing.T) {
AddListeners(listener),
)
assert.NoError(t, err)
- defer p.Destroy(ctx)
-
assert.NotNil(t, p)
+ defer p.Destroy(ctx)
+ time.Sleep(time.Second)
res, err := p.Exec(&payload.Payload{Body: []byte("hello")})
@@ -290,10 +290,12 @@ func Test_StaticPool_Replace_Worker(t *testing.T) {
},
)
assert.NoError(t, err)
- defer p.Destroy(ctx)
-
assert.NotNil(t, p)
+ defer p.Destroy(ctx)
+ // prevent process is not ready
+ time.Sleep(time.Second)
+
var lastPID string
lastPID = strconv.Itoa(int(p.Workers()[0].Pid()))
@@ -326,10 +328,12 @@ func Test_StaticPool_Debug_Worker(t *testing.T) {
},
)
assert.NoError(t, err)
- defer p.Destroy(ctx)
-
assert.NotNil(t, p)
+ defer p.Destroy(ctx)
+
+ // prevent process is not ready
+ time.Sleep(time.Second)
assert.Len(t, p.Workers(), 0)
var lastPID string
@@ -366,10 +370,11 @@ func Test_StaticPool_Stop_Worker(t *testing.T) {
},
)
assert.NoError(t, err)
- defer p.Destroy(ctx)
-
assert.NotNil(t, p)
+ defer p.Destroy(ctx)
+ time.Sleep(time.Second)
+
var lastPID string
lastPID = strconv.Itoa(int(p.Workers()[0].Pid()))
@@ -460,6 +465,7 @@ func Test_Static_Pool_Handle_Dead(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, p)
+ time.Sleep(time.Second)
for i := range p.Workers() {
p.Workers()[i].State().Set(worker.StateErrored)
}