summaryrefslogtreecommitdiff
path: root/pool_test.go
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-01-28 15:30:43 +0300
committerWolfy-J <[email protected]>2018-01-28 15:30:43 +0300
commit68f318b14987e5602d2a4f81f13d7c2c15afc56b (patch)
tree0f63790b16f346d0db90b76f92191c52c5c437d0 /pool_test.go
parent75fb6c2f358ee728147da5bcd9ba089ae3323cbb (diff)
job error
Diffstat (limited to 'pool_test.go')
-rw-r--r--pool_test.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/pool_test.go b/pool_test.go
index 76c93b60..153ce0f9 100644
--- a/pool_test.go
+++ b/pool_test.go
@@ -117,6 +117,26 @@ func Test_Pool_Echo_Head(t *testing.T) {
assert.Equal(t, "world", string(res.Head))
}
+func Test_Pool_JobError(t *testing.T) {
+ p, err := NewPool(
+ func() *exec.Cmd { return exec.Command("php", "tests/client.php", "error", "pipes") },
+ NewPipeFactory(),
+ cfg,
+ )
+ defer p.Destroy()
+
+ assert.NotNil(t, p)
+ assert.NoError(t, err)
+
+ res, err := p.Exec(&Payload{Body: []byte("hello")})
+
+ assert.Error(t, err)
+ assert.Nil(t, res)
+
+ assert.IsType(t, JobError{}, err)
+ assert.Equal(t, "hello", err.Error())
+}
+
func Test_Pool_AllocateTimeout(t *testing.T) {
p, err := NewPool(
func() *exec.Cmd { return exec.Command("php", "tests/client.php", "delay", "pipes") },