summaryrefslogtreecommitdiff
path: root/supervisor_test.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-10-27 15:34:05 +0300
committerValery Piashchynski <[email protected]>2020-10-27 15:34:05 +0300
commit0e68fe1d5aa5ffff699e4dfa8d482ece1a347117 (patch)
tree292da221aa5244d0d58b0448d865f0b4320011e8 /supervisor_test.go
parentd199ef71b9644afbbba064c317cd0991be1c2443 (diff)
Update supervisor_test
Diffstat (limited to 'supervisor_test.go')
-rw-r--r--supervisor_test.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/supervisor_test.go b/supervisor_test.go
index 68c2ddaf..b6aa8372 100644
--- a/supervisor_test.go
+++ b/supervisor_test.go
@@ -103,13 +103,12 @@ func TestSupervisedPool_ExecTTL_TimedOut(t *testing.T) {
assert.Error(t, err)
assert.Empty(t, resp)
- time.Sleep(time.Second * 3)
+ time.Sleep(time.Second * 1)
// should be new worker with new pid
assert.NotEqual(t, pid, p.Workers()[0].Pid())
}
-func
-TestSupervisedPool_ExecTTL_OK(t *testing.T) {
+func TestSupervisedPool_ExecTTL_OK(t *testing.T) {
var cfgExecTTL = Config{
NumWorkers: int64(1),
AllocateTimeout: time.Second,
@@ -134,6 +133,8 @@ TestSupervisedPool_ExecTTL_OK(t *testing.T) {
assert.NotNil(t, p)
defer p.Destroy(context.Background())
+ pid := p.Workers()[0].Pid()
+
time.Sleep(time.Millisecond * 100)
resp, err := p.Exec(Payload{
Context: []byte(""),
@@ -142,4 +143,8 @@ TestSupervisedPool_ExecTTL_OK(t *testing.T) {
assert.NoError(t, err)
assert.Empty(t, resp)
+
+ time.Sleep(time.Second * 1)
+ // should be the same pid
+ assert.Equal(t, pid, p.Workers()[0].Pid())
}