summaryrefslogtreecommitdiff
path: root/server_test.go
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-06-06 18:38:15 +0300
committerWolfy-J <[email protected]>2018-06-06 18:38:15 +0300
commitb8dc7cf3b90f5290edf67eb997f01e213e987265 (patch)
treee783be996945b3aca3f798ac074b5016ba34cc0c /server_test.go
parent63e505bd354378ec3cc11c10881fd816b3cb55f4 (diff)
dead functions
Diffstat (limited to 'server_test.go')
-rw-r--r--server_test.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/server_test.go b/server_test.go
index 6cc07c4d..8fecd927 100644
--- a/server_test.go
+++ b/server_test.go
@@ -59,6 +59,42 @@ func TestServer_SocketEcho(t *testing.T) {
assert.Equal(t, "hello", res.String())
}
+func TestServer_Configure_BeforeStart(t *testing.T) {
+ srv := NewServer(
+ func() *exec.Cmd { return exec.Command("php", "php-src/tests/client.php", "echo", "pipes") },
+ &ServerConfig{
+ Relay: "pipes",
+ Pool: Config{
+ NumWorkers: uint64(runtime.NumCPU()),
+ AllocateTimeout: time.Second,
+ DestroyTimeout: time.Second,
+ },
+ })
+ defer srv.Stop()
+
+ err := srv.Reconfigure(&ServerConfig{
+ Relay: "pipes",
+ Pool: Config{
+ NumWorkers: 2,
+ AllocateTimeout: time.Second,
+ DestroyTimeout: time.Second,
+ },
+ })
+ assert.NoError(t, err)
+
+ assert.NoError(t, srv.Start())
+
+ res, err := srv.Exec(&Payload{Body: []byte("hello")})
+
+ assert.NoError(t, err)
+ assert.NotNil(t, res)
+ assert.NotNil(t, res.Body)
+ assert.Nil(t, res.Context)
+
+ assert.Equal(t, "hello", res.String())
+ assert.Len(t, srv.Workers(), 2)
+}
+
func TestServer_Reconfigure(t *testing.T) {
srv := NewServer(
func() *exec.Cmd { return exec.Command("php", "php-src/tests/client.php", "echo", "pipes") },