summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--worker.go2
-rw-r--r--worker_test.go14
2 files changed, 15 insertions, 1 deletions
diff --git a/worker.go b/worker.go
index d505c54b..b62cf86e 100644
--- a/worker.go
+++ b/worker.go
@@ -76,7 +76,7 @@ func (w *Worker) State() State {
func (w *Worker) String() string {
state := w.state.String()
if w.Pid != nil {
- state = state + ", pid.php:" + strconv.Itoa(*w.Pid)
+ state = state + ", pid:" + strconv.Itoa(*w.Pid)
}
return fmt.Sprintf(
diff --git a/worker_test.go b/worker_test.go
index 0cb6f2d4..65adae28 100644
--- a/worker_test.go
+++ b/worker_test.go
@@ -42,6 +42,20 @@ func Test_Echo(t *testing.T) {
assert.Equal(t, "hello", res.String())
}
+func Test_String(t *testing.T) {
+ cmd := exec.Command("php", "tests/client.php", "echo", "pipes")
+
+ w, _ := NewPipeFactory().SpawnWorker(cmd)
+ go func() {
+ assert.NoError(t, w.Wait())
+ }()
+ defer w.Stop()
+
+ assert.Contains(t, w.String(), "php tests/client.php echo pipes")
+ assert.Contains(t, w.String(), "ready")
+ assert.Contains(t, w.String(), "numExecs: 0")
+}
+
func Test_Echo_Slow(t *testing.T) {
cmd := exec.Command("php", "tests/slow-client.php", "echo", "pipes", "10", "10")