rpcsrv: enforce WS connection close on test cleanup

Do not wait until wsReader routine gracefully finishes its work before
WS connection close. Instead, firstly close the connection, and after
that wait for proper wsReader exit.

It's a harsh way, but I don't have any other options to try, because
wsReader routine hangs on `ws.ReadMessage()` operation for more than
ReadDeadline (more than 5 seconds) during test cleanup which results in
the test timeout.

Close #3378.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit is contained in:
Anna Shaleva 2024-04-04 11:55:42 +03:00
parent 22af33a14e
commit e5c919f701

View file

@ -100,8 +100,8 @@ func initCleanServerAndWSClient(t *testing.T, startNetworkServer ...bool) (*core
}
}
close(readerStopCh)
<-readerToExitCh
ws.Close()
<-readerToExitCh
if len(startNetworkServer) != 0 && startNetworkServer[0] {
rpcSrv.coreServer.Shutdown()
}