summaryrefslogtreecommitdiff
path: root/server_test.go
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-06-06 18:33:55 +0300
committerWolfy-J <[email protected]>2018-06-06 18:33:55 +0300
commit304b891eec532ca9d8c14f4c605493160a53370b (patch)
tree85256c64552e271a80b7cfe73eb49344f4cae607 /server_test.go
parentacc86b65b75c26b0b3d730775acac44637b696b3 (diff)
tests fixed for windows
Diffstat (limited to 'server_test.go')
-rw-r--r--server_test.go84
1 files changed, 44 insertions, 40 deletions
diff --git a/server_test.go b/server_test.go
index cfc75265..6cc07c4d 100644
--- a/server_test.go
+++ b/server_test.go
@@ -5,18 +5,20 @@ import (
"github.com/stretchr/testify/assert"
"runtime"
"time"
+ "os/exec"
)
func TestServer_PipesEcho(t *testing.T) {
- srv := NewServer(&ServerConfig{
- Command: "php php-src/tests/client.php echo pipes",
- Relay: "pipes",
- Pool: &Config{
- NumWorkers: uint64(runtime.NumCPU()),
- AllocateTimeout: time.Second,
- DestroyTimeout: time.Second,
- },
- }, nil)
+ 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()
assert.NoError(t, srv.Start())
@@ -32,16 +34,17 @@ func TestServer_PipesEcho(t *testing.T) {
}
func TestServer_SocketEcho(t *testing.T) {
- srv := NewServer(&ServerConfig{
- Command: "php php-src/tests/client.php echo tcp",
- Relay: "tcp://:9007",
- RelayTimeout: 10 * time.Second,
- Pool: &Config{
- NumWorkers: uint64(runtime.NumCPU()),
- AllocateTimeout: time.Second,
- DestroyTimeout: time.Second,
- },
- }, nil)
+ srv := NewServer(
+ func() *exec.Cmd { return exec.Command("php", "php-src/tests/client.php", "echo", "tcp") },
+ &ServerConfig{
+ Relay: "tcp://:9007",
+ RelayTimeout: 10 * time.Second,
+ Pool: Config{
+ NumWorkers: uint64(runtime.NumCPU()),
+ AllocateTimeout: time.Second,
+ DestroyTimeout: time.Second,
+ },
+ })
defer srv.Stop()
assert.NoError(t, srv.Start())
@@ -57,24 +60,24 @@ func TestServer_SocketEcho(t *testing.T) {
}
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)
+ srv := NewServer(
+ func() *exec.Cmd { return exec.Command("php", "php-src/tests/client.php", "echo", "pipes") },
+ &ServerConfig{
+ Relay: "pipes",
+ Pool: Config{
+ NumWorkers: 1,
+ AllocateTimeout: time.Second,
+ DestroyTimeout: time.Second,
+ },
+ })
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{
+ Relay: "pipes",
+ Pool: Config{
NumWorkers: 2,
AllocateTimeout: time.Second,
DestroyTimeout: time.Second,
@@ -86,15 +89,16 @@ func TestServer_Reconfigure(t *testing.T) {
}
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)
+ srv := NewServer(
+ func() *exec.Cmd { return exec.Command("php", "php-src/tests/client.php", "echo", "pipes") },
+ &ServerConfig{
+ Relay: "pipes",
+ Pool: Config{
+ NumWorkers: 1,
+ AllocateTimeout: time.Second,
+ DestroyTimeout: time.Second,
+ },
+ })
defer srv.Stop()
assert.NoError(t, srv.Start())