diff options
author | Valery Piashchynski <[email protected]> | 2020-10-20 17:36:41 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-10-20 17:36:41 +0300 |
commit | de6a38c0f3e1f21349e6361b8fe2829a09cf02b8 (patch) | |
tree | fc99ba06106145c1b9d2279e0616795ed106588f /socket_factory_test.go | |
parent | 4a3a8a1b94ce7a1ff697aee6c4e8a34e3a736195 (diff) |
GolangCi warnings fix
Diffstat (limited to 'socket_factory_test.go')
-rw-r--r-- | socket_factory_test.go | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/socket_factory_test.go b/socket_factory_test.go index 0c953b33..cfb95ca1 100644 --- a/socket_factory_test.go +++ b/socket_factory_test.go @@ -187,12 +187,14 @@ func Test_Tcp_Broken(t *testing.T) { if err != nil { t.Fatal(err) } - //go func() { - // err := w.Wait() - // - // assert.Error(t, err) - // assert.Contains(t, err.Error(), "undefined_function()") - //}() + wg := sync.WaitGroup{} + wg.Add(1) + go func() { + defer wg.Done() + err := w.Wait(context.Background()) + assert.Error(t, err) + assert.Contains(t, err.Error(), "undefined_function()") + }() defer func() { time.Sleep(time.Second) @@ -210,6 +212,7 @@ func Test_Tcp_Broken(t *testing.T) { assert.Error(t, err) assert.Nil(t, res.Body) assert.Nil(t, res.Context) + wg.Wait() } func Test_Tcp_Echo(t *testing.T) { @@ -230,9 +233,9 @@ func Test_Tcp_Echo(t *testing.T) { cmd := exec.Command("php", "tests/client.php", "echo", "tcp") w, _ := NewSocketServer(ls, time.Minute).SpawnWorkerWithContext(ctx, cmd) - //go func() { - // assert.NoError(t, w.Wait()) - //}() + go func() { + assert.NoError(t, w.Wait(context.Background())) + }() defer func() { err = w.Stop(ctx) if err != nil { @@ -275,9 +278,9 @@ func Test_Unix_Start(t *testing.T) { assert.NoError(t, err) assert.NotNil(t, w) - //go func() { - // assert.NoError(t, w.Wait()) - //}() + go func() { + assert.NoError(t, w.Wait(context.Background())) + }() err = w.Stop(ctx) if err != nil { @@ -418,9 +421,9 @@ func Test_Unix_Echo(t *testing.T) { if err != nil { t.Fatal(err) } - //go func() { - // assert.NoError(t, w.Wait()) - //}() + go func() { + assert.NoError(t, w.Wait(context.Background())) + }() defer func() { err = w.Stop(ctx) if err != nil { @@ -465,11 +468,9 @@ func Benchmark_Tcp_SpawnWorker_Stop(b *testing.B) { if err != nil { b.Fatal(err) } - //go func() { - // if w.Wait() != nil { - // b.Fail() - // } - //}() + go func() { + assert.NoError(b, w.Wait(context.Background())) + }() err = w.Stop(ctx) if err != nil { |