From e5c919f701de230cb8ca649861daa6d03e121e86 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Thu, 4 Apr 2024 11:55:42 +0300 Subject: [PATCH] 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 --- pkg/services/rpcsrv/subscription_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/services/rpcsrv/subscription_test.go b/pkg/services/rpcsrv/subscription_test.go index b45c990b0..cae8ba5d1 100644 --- a/pkg/services/rpcsrv/subscription_test.go +++ b/pkg/services/rpcsrv/subscription_test.go @@ -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() }