From 9aa91dce2909fc91b1468dc8ca7f7740b2196bb4 Mon Sep 17 00:00:00 2001 From: aler9 <46489434+aler9@users.noreply.github.com> Date: Mon, 10 May 2021 19:46:57 +0200 Subject: [PATCH] server: fix tests --- server_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server_test.go b/server_test.go index 16e95cd6..75adf052 100644 --- a/server_test.go +++ b/server_test.go @@ -1018,10 +1018,13 @@ func TestServerErrorInvalidPath(t *testing.T) { // base.SetParameter, } { t.Run(string(method), func(t *testing.T) { + connClosed := make(chan struct{}) + s := &Server{ Handler: &testServerHandler{ onConnClose: func(ctx *ServerHandlerOnConnCloseCtx) { require.Equal(t, "invalid path", ctx.Error.Error()) + close(connClosed) }, onAnnounce: func(ctx *ServerHandlerOnAnnounceCtx) (*base.Response, error) { return &base.Response{ @@ -1131,6 +1134,8 @@ func TestServerErrorInvalidPath(t *testing.T) { }) require.NoError(t, err) require.Equal(t, base.StatusBadRequest, res.StatusCode) + + <-connClosed }) } }