Skip to content

Commit fc48aab

Browse files
committed
Add more info in case of failure of flaky test
1 parent 0b9aef3 commit fc48aab

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/test/java/com/rabbitmq/stream/impl/StreamEnvironmentTest.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ void environmentCreationShouldFailWithIncorrectVirtualHostInUri() {
123123

124124
@Test
125125
void environmentCreationShouldFailWithUrlUsingWrongPort() throws Exception {
126-
int initialThreadCound = threads().size();
126+
Collection<Thread> initialThreads = threads();
127127
assertThatThrownBy(
128128
() ->
129129
environmentBuilder
@@ -138,7 +138,13 @@ void environmentCreationShouldFailWithUrlUsingWrongPort() throws Exception {
138138
.hasCauseInstanceOf(ConnectException.class)
139139
.hasRootCauseMessage("Connection refused");
140140
// no thread leak
141-
waitAtMost(() -> threads().size() == initialThreadCound);
141+
waitAtMost(
142+
Duration.ofSeconds(20),
143+
() -> threads().size() == initialThreads.size(),
144+
() ->
145+
String.format(
146+
"There should be no new threads, initial %s, current %s",
147+
initialThreads, threads()));
142148
}
143149

144150
@Test

0 commit comments

Comments
 (0)