Skip to content

Commit

Permalink
Add thread sleep hack to "fix" sporadic test
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Oct 13, 2020
1 parent 51a1872 commit 20ac5e8
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ void webSocketCloseHandlerShouldRemoveConnection()
}

@Test
void shouldHandleRemovedConnections() {
void shouldHandleRemovedConnections() throws Exception {
String expectedText = "hello world";
when(crw2.readLine()).thenReturn(expectedText);

Expand All @@ -191,6 +191,9 @@ void shouldHandleRemovedConnections() {
String newText = "another message";
when(crw1.readLine()).thenReturn(newText);

// FIXME this is a dirty hack. See https://github.com/rh-jmc-team/container-jfr/issues/132
Thread.sleep(500);

MatcherAssert.assertThat(server.getClientReader().readLine(), Matchers.equalTo(newText));
verify(crw1, Mockito.atLeastOnce()).readLine();
verifyNoMoreInteractions(crw2);
Expand Down

0 comments on commit 20ac5e8

Please sign in to comment.