summaryrefslogtreecommitdiff
path: root/pool/supervisor_test.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-12-23 20:57:41 +0300
committerValery Piashchynski <[email protected]>2021-12-23 20:57:41 +0300
commit5a9c81a4aee940a9bc476f2f3bafd13b411e2786 (patch)
treed53386065c22bd624bb8f92cb5733d6e728221d7 /pool/supervisor_test.go
parent31112495808ae37f38f7b514de1f40b8b8a75238 (diff)
add Reset method to the pool
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'pool/supervisor_test.go')
-rw-r--r--pool/supervisor_test.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/pool/supervisor_test.go b/pool/supervisor_test.go
index 98af918a..6e8ab552 100644
--- a/pool/supervisor_test.go
+++ b/pool/supervisor_test.go
@@ -58,6 +58,33 @@ func TestSupervisedPool_Exec(t *testing.T) {
p.Destroy(context.Background())
}
+func Test_SupervisedPoolReset(t *testing.T) {
+ ctx := context.Background()
+ p, err := Initialize(
+ ctx,
+ func() *exec.Cmd { return exec.Command("php", "../tests/client.php", "echo", "pipes") },
+ pipe.NewPipeFactory(),
+ cfgSupervised,
+ )
+ assert.NoError(t, err)
+ assert.NotNil(t, p)
+
+ w := p.Workers()
+ if len(w) == 0 {
+ t.Fatal("should be workers inside")
+ }
+
+ pid := w[0].Pid()
+ require.NoError(t, p.Reset(context.Background()))
+
+ w2 := p.Workers()
+ if len(w2) == 0 {
+ t.Fatal("should be workers inside")
+ }
+
+ require.NotEqual(t, pid, w2[0].Pid())
+}
+
// This test should finish without freezes
func TestSupervisedPool_ExecWithDebugMode(t *testing.T) {
var cfgSupervised = cfgSupervised