summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-11-26 12:55:50 +0300
committerValery Piashchynski <[email protected]>2020-11-26 12:55:50 +0300
commitc765c70c1ff628044ccae15a24d0e200bb9304cb (patch)
treeb23fbd875dd624e95bb54e193f1d56cb41d9283d
parent574f351aaecdee1176b9700bb6d7eb61fe170906 (diff)
Remove context from Wait in all tests
-rwxr-xr-xpipe_factory_test.go7
-rwxr-xr-xsocket_factory_test.go14
-rwxr-xr-xworker_test.go4
3 files changed, 12 insertions, 13 deletions
diff --git a/pipe_factory_test.go b/pipe_factory_test.go
index ee2510f3..bdb861de 100755
--- a/pipe_factory_test.go
+++ b/pipe_factory_test.go
@@ -18,8 +18,7 @@ func Test_Pipe_Start(t *testing.T) {
assert.NotNil(t, w)
go func() {
- ctx := context.Background()
- assert.NoError(t, w.Wait(ctx))
+ assert.NoError(t, w.Wait())
}()
assert.NoError(t, w.Stop(ctx))
@@ -142,7 +141,7 @@ func Benchmark_Pipe_SpawnWorker_Stop(b *testing.B) {
cmd := exec.Command("php", "tests/client.php", "echo", "pipes")
w, _ := f.SpawnWorkerWithContext(context.Background(), cmd)
go func() {
- if w.Wait(context.Background()) != nil {
+ if w.Wait() != nil {
b.Fail()
}
}()
@@ -165,7 +164,7 @@ func Benchmark_Pipe_Worker_ExecEcho(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()
go func() {
- err := w.Wait(context.Background())
+ err := w.Wait()
if err != nil {
b.Errorf("error waiting the worker: error %v", err)
}
diff --git a/socket_factory_test.go b/socket_factory_test.go
index f7b2e69a..3663bf89 100755
--- a/socket_factory_test.go
+++ b/socket_factory_test.go
@@ -34,7 +34,7 @@ func Test_Tcp_Start(t *testing.T) {
assert.NotNil(t, w)
go func() {
- assert.NoError(t, w.Wait(ctx))
+ assert.NoError(t, w.Wait())
}()
err = w.Stop(ctx)
@@ -192,7 +192,7 @@ func Test_Tcp_Broken(t *testing.T) {
wg.Add(1)
go func() {
defer wg.Done()
- err := w.Wait(context.Background())
+ err := w.Wait()
assert.Error(t, err)
assert.Contains(t, err.Error(), "undefined_function()")
}()
@@ -235,7 +235,7 @@ func Test_Tcp_Echo(t *testing.T) {
w, _ := NewSocketServer(ls, time.Minute).SpawnWorkerWithContext(ctx, cmd)
go func() {
- assert.NoError(t, w.Wait(context.Background()))
+ assert.NoError(t, w.Wait())
}()
defer func() {
err = w.Stop(ctx)
@@ -280,7 +280,7 @@ func Test_Unix_Start(t *testing.T) {
assert.NotNil(t, w)
go func() {
- assert.NoError(t, w.Wait(context.Background()))
+ assert.NoError(t, w.Wait())
}()
err = w.Stop(ctx)
@@ -378,7 +378,7 @@ func Test_Unix_Broken(t *testing.T) {
wg.Add(1)
go func() {
defer wg.Done()
- err := w.Wait(ctx)
+ err := w.Wait()
assert.Error(t, err)
assert.Contains(t, err.Error(), "undefined_function()")
}()
@@ -423,7 +423,7 @@ func Test_Unix_Echo(t *testing.T) {
t.Fatal(err)
}
go func() {
- assert.NoError(t, w.Wait(context.Background()))
+ assert.NoError(t, w.Wait())
}()
defer func() {
err = w.Stop(ctx)
@@ -470,7 +470,7 @@ func Benchmark_Tcp_SpawnWorker_Stop(b *testing.B) {
b.Fatal(err)
}
go func() {
- assert.NoError(b, w.Wait(context.Background()))
+ assert.NoError(b, w.Wait())
}()
err = w.Stop(ctx)
diff --git a/worker_test.go b/worker_test.go
index b8bd4c8b..e82d383e 100755
--- a/worker_test.go
+++ b/worker_test.go
@@ -15,7 +15,7 @@ func Test_GetState(t *testing.T) {
w, err := NewPipeFactory().SpawnWorkerWithContext(ctx, cmd)
go func() {
- assert.NoError(t, w.Wait(ctx))
+ assert.NoError(t, w.Wait())
assert.Equal(t, StateStopped, w.State().Value())
}()
@@ -38,7 +38,7 @@ func Test_Kill(t *testing.T) {
wg.Add(1)
go func() {
defer wg.Done()
- assert.Error(t, w.Wait(ctx))
+ assert.Error(t, w.Wait())
// TODO changed from stopped, discuss
assert.Equal(t, StateErrored, w.State().Value())
}()