NO-JIRA Trying to fix StompV11Test intermittent failure

This commit is contained in:
Clebert Suconic 2022-09-13 23:05:09 -04:00
parent a9a85f98db
commit 59585ffc94
1 changed files with 6 additions and 12 deletions

View File

@ -2188,6 +2188,7 @@ public class StompV11Test extends StompTestBase {
public void testHeartBeat3() throws Exception { public void testHeartBeat3() throws Exception {
connection.close(); connection.close();
Assert.assertEquals(0, server.getRemotingService().getConnections().size());
ClientStompFrame frame = conn.createFrame("CONNECT"); ClientStompFrame frame = conn.createFrame("CONNECT");
frame.addHeader("host", "127.0.0.1"); frame.addHeader("host", "127.0.0.1");
frame.addHeader("login", this.defUser); frame.addHeader("login", this.defUser);
@ -2217,12 +2218,10 @@ public class StompV11Test extends StompTestBase {
int size = conn.getServerPingNumber(); int size = conn.getServerPingNumber();
conn.stopPinger(); conn.stopPinger();
//((AbstractStompClientConnection)conn).killReaderThread();
Wait.waitFor(() -> {
return server.getRemotingService().getConnections().size() == 0;
});
Wait.assertFalse(stompFrameHandler.getHeartBeater()::isStarted); Wait.assertEquals(0, () -> server.getRemotingService().getConnections().size());
Wait.assertFalse("HeartBeater is still running!!", () -> stompFrameHandler.getHeartBeater().isStarted());
} }
@Test @Test
@ -2274,14 +2273,9 @@ public class StompV11Test extends StompTestBase {
conn.stopPinger(); conn.stopPinger();
// give it some time to detect and close connections Wait.assertEquals(0, () -> server.getRemotingService().getConnections().size());
Thread.sleep(2000);
Wait.waitFor(() -> { Wait.assertFalse("HeartBeater is still running!!", () -> stompFrameHandler.getHeartBeater().isStarted());
return server.getRemotingService().getConnections().size() == 0;
});
Wait.assertFalse("HeartBeater is still running!!", stompFrameHandler.getHeartBeater()::isStarted);
} }