From 7a44242ae0b2346239fbb6abac1a146ee0e31847 Mon Sep 17 00:00:00 2001 From: Wolfy-J Date: Thu, 7 Jun 2018 21:09:51 +0300 Subject: tests --- worker_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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") -- cgit v1.2.3