summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--static_pool_test.go24
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") },