diff options
author | Wolfy-J <[email protected]> | 2018-06-06 16:37:44 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2018-06-06 16:37:44 +0300 |
commit | ee3f93a57df3a8d6dbf852c1b371dae88806a177 (patch) | |
tree | 6ffa13fdb03b7058583138c554de4408520f8cd4 /server_test.go | |
parent | 78fee1f14e39bbb36204737d2fc6be985614911d (diff) |
more stuff
Diffstat (limited to 'server_test.go')
-rw-r--r-- | server_test.go | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/server_test.go b/server_test.go index bb31bada..cfc75265 100644 --- a/server_test.go +++ b/server_test.go @@ -55,3 +55,53 @@ func TestServer_SocketEcho(t *testing.T) { assert.Equal(t, "hello", res.String()) } + +func TestServer_Reconfigure(t *testing.T) { + srv := NewServer(&ServerConfig{ + Command: "php php-src/tests/client.php echo pipes", + Relay: "pipes", + Pool: &Config{ + NumWorkers: 1, + AllocateTimeout: time.Second, + DestroyTimeout: time.Second, + }, + }, nil) + defer srv.Stop() + + assert.NoError(t, srv.Start()) + assert.Len(t, srv.Workers(), 1) + + err := srv.Reconfigure(&ServerConfig{ + Command: "php php-src/tests/client.php echo pipes", + Relay: "pipes", + Pool: &Config{ + NumWorkers: 2, + AllocateTimeout: time.Second, + DestroyTimeout: time.Second, + }, + }) + assert.NoError(t, err) + + assert.Len(t, srv.Workers(), 2) +} + +func TestServer_Reset(t *testing.T) { + srv := NewServer(&ServerConfig{ + Command: "php php-src/tests/client.php echo pipes", + Relay: "pipes", + Pool: &Config{ + NumWorkers: 1, + AllocateTimeout: time.Second, + DestroyTimeout: time.Second, + }, + }, nil) + defer srv.Stop() + + assert.NoError(t, srv.Start()) + assert.Len(t, srv.Workers(), 1) + + pid := *srv.Workers()[0].Pid + assert.NoError(t, srv.Reset()) + assert.Len(t, srv.Workers(), 1) + assert.NotEqual(t, pid, srv.Workers()[0].Pid) +} |