summaryrefslogtreecommitdiff
path: root/worker_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'worker_test.go')
-rw-r--r--worker_test.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/worker_test.go b/worker_test.go
index 31b14098..5f6d336d 100644
--- a/worker_test.go
+++ b/worker_test.go
@@ -23,6 +23,22 @@ func Test_GetState(t *testing.T) {
w.Stop()
}
+func Test_Kill(t *testing.T) {
+ cmd := exec.Command("php", "php-src/tests/client.php", "echo", "pipes")
+
+ w, err := NewPipeFactory().SpawnWorker(cmd)
+ go func() {
+ assert.Error(t, w.Wait())
+ assert.Equal(t, StateStopped, w.State().Value())
+ }()
+
+ assert.NoError(t, err)
+ assert.NotNil(t, w)
+
+ assert.Equal(t, StateReady, w.State().Value())
+ w.Kill()
+}
+
func Test_Echo(t *testing.T) {
cmd := exec.Command("php", "php-src/tests/client.php", "echo", "pipes")