Skip to content

Commit 4b05168

Browse files
committed
Stop endpoints in the end of tests
https://build.spring.io/browse/INT-MASTERSPRING40-954/ The `ReactiveStreamsConsumerTests` fails with some race condition from time to time. Possible reason that no one endpoint is stopped in the end of test. Even if we step out from the test method, background threads are still active
1 parent 715e9a2 commit 4b05168

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

spring-integration-core/src/test/java/org/springframework/integration/channel/reactive/ReactiveStreamsConsumerTests.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ public void testReactiveStreamsConsumerFluxMessageChannel() throws InterruptedEx
9999

100100
assertThat(stopLatch.await(10, TimeUnit.SECONDS)).isTrue();
101101
assertThat(result).containsExactly(testMessage, testMessage2);
102+
103+
reactiveConsumer.stop();
102104
}
103105

104106

@@ -222,6 +224,8 @@ public void testReactiveStreamsConsumerPollableChannel() throws InterruptedExcep
222224
verify(testSubscriber, never()).onComplete();
223225

224226
assertThat(messages.isEmpty()).isTrue();
227+
228+
reactiveConsumer.stop();
225229
}
226230

227231
@Test
@@ -264,6 +268,8 @@ public void testReactiveStreamsConsumerViaConsumerEndpointFactoryBean() throws E
264268
assertThat(stopLatch.await(10, TimeUnit.SECONDS)).isTrue();
265269
assertThat(result.size()).isEqualTo(3);
266270
assertThat(result).containsExactly(testMessage, testMessage2, testMessage2);
271+
272+
endpointFactoryBean.stop();
267273
}
268274

269275
@Test
@@ -302,7 +308,8 @@ public void testReactiveStreamsConsumerFluxMessageChannelReactiveMessageHandler(
302308
.expectNext(testMessage, testMessage2)
303309
.thenCancel()
304310
.verify();
305-
}
306311

312+
reactiveConsumer.stop();
313+
}
307314

308315
}

0 commit comments

Comments
 (0)