diff options
author | Wolfy-J <[email protected]> | 2018-09-23 15:30:03 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2018-09-23 15:30:03 +0300 |
commit | dac0e9cb81cf49cb5967c04eb494709ee3f164d9 (patch) | |
tree | 5fc0356eef973097c7565709bbe731e4fb9b3202 /static_pool_test.go | |
parent | 892d5949ae95e0b8284746ef368e6f0b6316680d (diff) |
more coverage
Diffstat (limited to 'static_pool_test.go')
-rw-r--r-- | static_pool_test.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/static_pool_test.go b/static_pool_test.go index 036cd092..102717dd 100644 --- a/static_pool_test.go +++ b/static_pool_test.go @@ -346,6 +346,30 @@ func Test_Static_Pool_Destroy_And_Close_While_Wait(t *testing.T) { assert.Error(t, err) } +// identical to replace but controlled on worker side +func Test_Static_Pool_Handle_Dead(t *testing.T) { + p, err := NewPool( + func() *exec.Cmd { return exec.Command("php", "tests/client.php", "echo", "pipes") }, + NewPipeFactory(), + Config{ + NumWorkers: 5, + AllocateTimeout: time.Second, + DestroyTimeout: time.Second, + }, + ) + defer p.Destroy() + + assert.NotNil(t, p) + assert.NoError(t, err) + + for _, w := range p.workers { + w.state.value = StateErrored + } + + _, err = p.Exec(&Payload{Body: []byte("hello")}) + assert.Error(t, err) +} + func Benchmark_Pool_Allocate(b *testing.B) { p, _ := NewPool( func() *exec.Cmd { return exec.Command("php", "tests/client.php", "echo", "pipes") }, |