summaryrefslogtreecommitdiff
path: root/worker_test.go
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-06-07 21:09:51 +0300
committerWolfy-J <[email protected]>2018-06-07 21:09:51 +0300
commit7a44242ae0b2346239fbb6abac1a146ee0e31847 (patch)
tree6e331ecdb9bb9eed0b7671a8b76c0d7e366d4a2c /worker_test.go
parent1ddc26e58f24a0683f68437ccf5fd27bcb4265ef (diff)
tests
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")