summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2019-05-03 12:54:15 +0300
committerWolfy-J <[email protected]>2019-05-03 12:54:15 +0300
commit457ec8eac0f5267e61871de87c3f4daa9f595be0 (patch)
tree3a6d114593af1b28929e68a52a549b13e5157d9a
parent9ec8db5642eec7f5ef85f91aaf09743db82d2710 (diff)
more tests
-rw-r--r--Makefile1
-rw-r--r--util/state_test.go22
2 files changed, 23 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 954dff7a..4b92ed5b 100644
--- a/Makefile
+++ b/Makefile
@@ -13,6 +13,7 @@ test:
go test -v -race -cover
go test -v -race -cover ./util
go test -v -race -cover ./service
+ go test -v -race -cover ./service/util
go test -v -race -cover ./service/env
go test -v -race -cover ./service/rpc
go test -v -race -cover ./service/http
diff --git a/util/state_test.go b/util/state_test.go
index 2afe682e..150f8533 100644
--- a/util/state_test.go
+++ b/util/state_test.go
@@ -30,6 +30,28 @@ func TestServerState(t *testing.T) {
assert.Len(t, state, runtime.NumCPU())
}
+func TestDeadWorker(t *testing.T) {
+ rr := roadrunner.NewServer(
+ &roadrunner.ServerConfig{
+ Command: "php ../tests/client.php echo tcp",
+ Relay: "tcp://:9007",
+ RelayTimeout: 10 * time.Second,
+ Pool: &roadrunner.Config{
+ NumWorkers: 1,
+ AllocateTimeout: time.Second,
+ DestroyTimeout: time.Second,
+ },
+ })
+
+ assert.NoError(t, rr.Start())
+ w := rr.Workers()[0]
+ rr.Stop()
+ *w.Pid = 0
+
+ _, err := WorkerState(w)
+ assert.Error(t, err)
+}
+
func TestServerState_Err(t *testing.T) {
_, err := ServerState(nil)
assert.Error(t, err)