From 59f2159dcb7dd71a367f9017a7ae9156e74ec7a8 Mon Sep 17 00:00:00 2001 From: Sir Darkrengarius Date: Sun, 16 Jun 2019 14:48:31 +0300 Subject: [PATCH] Finish test for failed accept --- pkg/dmsg/server_test.go | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/pkg/dmsg/server_test.go b/pkg/dmsg/server_test.go index 960b64f31d..65603d530b 100644 --- a/pkg/dmsg/server_test.go +++ b/pkg/dmsg/server_test.go @@ -603,12 +603,32 @@ func TestServer_Serve(t *testing.T) { } }() - ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second) + ctx, cancel := context.WithTimeout(context.Background(), 100*time.Second) defer cancel() _, err = a.Dial(ctx, bPK) + require.Error(t, err) + + time.Sleep(2 * time.Second) + + close(aTpDone) + close(bTpDone) + tpReadWriteWG.Wait() - //require.Error(t, err) + require.NoError(t, aErr) + require.NoError(t, bErr) + + err = aTransport.Close() + require.NoError(t, err) + + err = bTransport.Close() + require.NoError(t, err) + + err = a.Close() + require.NoError(t, err) + + err = b.Close() + require.NoError(t, err) }) }