diff options
Diffstat (limited to 'pkg/socket/socket_factory_test.go')
-rwxr-xr-x | pkg/socket/socket_factory_test.go | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/pkg/socket/socket_factory_test.go b/pkg/socket/socket_factory_test.go index 6a88713a..983f3e8e 100755 --- a/pkg/socket/socket_factory_test.go +++ b/pkg/socket/socket_factory_test.go @@ -31,7 +31,7 @@ func Test_Tcp_Start(t *testing.T) { cmd := exec.Command("php", "../../tests/client.php", "echo", "tcp") - w, err := NewSocketServer(ls, time.Minute).SpawnWorkerWithContext(ctx, cmd) + w, err := NewSocketServer(ls, time.Minute).SpawnWorkerWithTimeout(ctx, cmd) assert.NoError(t, err) assert.NotNil(t, w) @@ -39,7 +39,7 @@ func Test_Tcp_Start(t *testing.T) { assert.NoError(t, w.Wait()) }() - err = w.Stop(ctx) + err = w.Stop() if err != nil { t.Errorf("error stopping the Process: error %v", err) } @@ -64,11 +64,11 @@ func Test_Tcp_StartCloseFactory(t *testing.T) { } }() - w, err := f.SpawnWorkerWithContext(ctx, cmd) + w, err := f.SpawnWorkerWithTimeout(ctx, cmd) assert.NoError(t, err) assert.NotNil(t, w) - err = w.Stop(ctx) + err = w.Stop() if err != nil { t.Errorf("error stopping the Process: error %v", err) } @@ -95,7 +95,7 @@ func Test_Tcp_StartError(t *testing.T) { t.Errorf("error executing the command: error %v", err) } - w, err := NewSocketServer(ls, time.Minute).SpawnWorkerWithContext(ctx, cmd) + w, err := NewSocketServer(ls, time.Minute).SpawnWorkerWithTimeout(ctx, cmd) assert.Error(t, err) assert.Nil(t, w) } @@ -118,7 +118,7 @@ func Test_Tcp_Failboot(t *testing.T) { cmd := exec.Command("php", "../../tests/failboot.php") - w, err2 := NewSocketServer(ls, time.Second*5).SpawnWorkerWithContext(ctx, cmd) + w, err2 := NewSocketServer(ls, time.Second*5).SpawnWorkerWithTimeout(ctx, cmd) assert.Nil(t, w) assert.Error(t, err2) assert.Contains(t, err2.Error(), "failboot") @@ -141,7 +141,7 @@ func Test_Tcp_Timeout(t *testing.T) { cmd := exec.Command("php", "../../tests/slow-client.php", "echo", "tcp", "200", "0") - w, err := NewSocketServer(ls, time.Millisecond*1).SpawnWorkerWithContext(ctx, cmd) + w, err := NewSocketServer(ls, time.Millisecond*1).SpawnWorkerWithTimeout(ctx, cmd) assert.Nil(t, w) assert.Error(t, err) assert.Contains(t, err.Error(), "context deadline exceeded") @@ -164,7 +164,7 @@ func Test_Tcp_Invalid(t *testing.T) { cmd := exec.Command("php", "../../tests/invalid.php") - w, err := NewSocketServer(ls, time.Second*1).SpawnWorkerWithContext(ctx, cmd) + w, err := NewSocketServer(ls, time.Second*1).SpawnWorkerWithTimeout(ctx, cmd) assert.Error(t, err) assert.Nil(t, w) } @@ -186,7 +186,7 @@ func Test_Tcp_Broken(t *testing.T) { cmd := exec.Command("php", "../../tests/client.php", "broken", "tcp") - w, err := NewSocketServer(ls, time.Minute).SpawnWorkerWithContext(ctx, cmd) + w, err := NewSocketServer(ls, time.Minute).SpawnWorkerWithTimeout(ctx, cmd) if err != nil { t.Fatal(err) } @@ -201,7 +201,7 @@ func Test_Tcp_Broken(t *testing.T) { defer func() { time.Sleep(time.Second) - err2 := w.Stop(ctx) + err2 := w.Stop() // write tcp 127.0.0.1:9007->127.0.0.1:34204: use of closed network connection assert.Error(t, err2) }() @@ -235,12 +235,12 @@ func Test_Tcp_Echo(t *testing.T) { cmd := exec.Command("php", "../../tests/client.php", "echo", "tcp") - w, _ := NewSocketServer(ls, time.Minute).SpawnWorkerWithContext(ctx, cmd) + w, _ := NewSocketServer(ls, time.Minute).SpawnWorkerWithTimeout(ctx, cmd) go func() { assert.NoError(t, w.Wait()) }() defer func() { - err = w.Stop(ctx) + err = w.Stop() if err != nil { t.Errorf("error stopping the Process: error %v", err) } @@ -277,7 +277,7 @@ func Test_Unix_Start(t *testing.T) { cmd := exec.Command("php", "../../tests/client.php", "echo", "unix") - w, err := NewSocketServer(ls, time.Minute).SpawnWorkerWithContext(ctx, cmd) + w, err := NewSocketServer(ls, time.Minute).SpawnWorkerWithTimeout(ctx, cmd) assert.NoError(t, err) assert.NotNil(t, w) @@ -285,7 +285,7 @@ func Test_Unix_Start(t *testing.T) { assert.NoError(t, w.Wait()) }() - err = w.Stop(ctx) + err = w.Stop() if err != nil { t.Errorf("error stopping the Process: error %v", err) } @@ -307,7 +307,7 @@ func Test_Unix_Failboot(t *testing.T) { cmd := exec.Command("php", "../../tests/failboot.php") - w, err := NewSocketServer(ls, time.Second*5).SpawnWorkerWithContext(ctx, cmd) + w, err := NewSocketServer(ls, time.Second*5).SpawnWorkerWithTimeout(ctx, cmd) assert.Nil(t, w) assert.Error(t, err) assert.Contains(t, err.Error(), "failboot") @@ -329,7 +329,7 @@ func Test_Unix_Timeout(t *testing.T) { cmd := exec.Command("php", "../../tests/slow-client.php", "echo", "unix", "200", "0") - w, err := NewSocketServer(ls, time.Millisecond*100).SpawnWorkerWithContext(ctx, cmd) + w, err := NewSocketServer(ls, time.Millisecond*100).SpawnWorkerWithTimeout(ctx, cmd) assert.Nil(t, w) assert.Error(t, err) assert.Contains(t, err.Error(), "context deadline exceeded") @@ -351,7 +351,7 @@ func Test_Unix_Invalid(t *testing.T) { cmd := exec.Command("php", "../../tests/invalid.php") - w, err := NewSocketServer(ls, time.Second*10).SpawnWorkerWithContext(ctx, cmd) + w, err := NewSocketServer(ls, time.Second*10).SpawnWorkerWithTimeout(ctx, cmd) assert.Error(t, err) assert.Nil(t, w) } @@ -372,7 +372,7 @@ func Test_Unix_Broken(t *testing.T) { cmd := exec.Command("php", "../../tests/client.php", "broken", "unix") - w, err := NewSocketServer(ls, time.Minute).SpawnWorkerWithContext(ctx, cmd) + w, err := NewSocketServer(ls, time.Minute).SpawnWorkerWithTimeout(ctx, cmd) if err != nil { t.Fatal(err) } @@ -387,7 +387,7 @@ func Test_Unix_Broken(t *testing.T) { defer func() { time.Sleep(time.Second) - err = w.Stop(ctx) + err = w.Stop() assert.Error(t, err) }() @@ -420,7 +420,7 @@ func Test_Unix_Echo(t *testing.T) { cmd := exec.Command("php", "../../tests/client.php", "echo", "unix") - w, err := NewSocketServer(ls, time.Minute).SpawnWorkerWithContext(ctx, cmd) + w, err := NewSocketServer(ls, time.Minute).SpawnWorkerWithTimeout(ctx, cmd) if err != nil { t.Fatal(err) } @@ -428,7 +428,7 @@ func Test_Unix_Echo(t *testing.T) { assert.NoError(t, w.Wait()) }() defer func() { - err = w.Stop(ctx) + err = w.Stop() if err != nil { t.Errorf("error stopping the Process: error %v", err) } @@ -467,7 +467,7 @@ func Benchmark_Tcp_SpawnWorker_Stop(b *testing.B) { for n := 0; n < b.N; n++ { cmd := exec.Command("php", "../../tests/client.php", "echo", "tcp") - w, err := f.SpawnWorkerWithContext(ctx, cmd) + w, err := f.SpawnWorkerWithTimeout(ctx, cmd) if err != nil { b.Fatal(err) } @@ -475,7 +475,7 @@ func Benchmark_Tcp_SpawnWorker_Stop(b *testing.B) { assert.NoError(b, w.Wait()) }() - err = w.Stop(ctx) + err = w.Stop() if err != nil { b.Errorf("error stopping the Process: error %v", err) } @@ -498,12 +498,12 @@ func Benchmark_Tcp_Worker_ExecEcho(b *testing.B) { cmd := exec.Command("php", "../../tests/client.php", "echo", "tcp") - w, err := NewSocketServer(ls, time.Minute).SpawnWorkerWithContext(ctx, cmd) + w, err := NewSocketServer(ls, time.Minute).SpawnWorkerWithTimeout(ctx, cmd) if err != nil { b.Fatal(err) } defer func() { - err = w.Stop(ctx) + err = w.Stop() if err != nil { b.Errorf("error stopping the Process: error %v", err) } @@ -539,11 +539,11 @@ func Benchmark_Unix_SpawnWorker_Stop(b *testing.B) { for n := 0; n < b.N; n++ { cmd := exec.Command("php", "../../tests/client.php", "echo", "unix") - w, err := f.SpawnWorkerWithContext(ctx, cmd) + w, err := f.SpawnWorkerWithTimeout(ctx, cmd) if err != nil { b.Fatal(err) } - err = w.Stop(ctx) + err = w.Stop() if err != nil { b.Errorf("error stopping the Process: error %v", err) } @@ -566,12 +566,12 @@ func Benchmark_Unix_Worker_ExecEcho(b *testing.B) { cmd := exec.Command("php", "../../tests/client.php", "echo", "unix") - w, err := NewSocketServer(ls, time.Minute).SpawnWorkerWithContext(ctx, cmd) + w, err := NewSocketServer(ls, time.Minute).SpawnWorkerWithTimeout(ctx, cmd) if err != nil { b.Fatal(err) } defer func() { - err = w.Stop(ctx) + err = w.Stop() if err != nil { b.Errorf("error stopping the Process: error %v", err) } |