From 4b051684ef5f35f11ab9302b547db99ab9261c7d Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Fri, 17 Jan 2020 09:55:11 -0500 Subject: [PATCH] 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 --- .../channel/reactive/ReactiveStreamsConsumerTests.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/reactive/ReactiveStreamsConsumerTests.java b/spring-integration-core/src/test/java/org/springframework/integration/channel/reactive/ReactiveStreamsConsumerTests.java index ece017ee5a..549ab3fecc 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/channel/reactive/ReactiveStreamsConsumerTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/reactive/ReactiveStreamsConsumerTests.java @@ -99,6 +99,8 @@ public class ReactiveStreamsConsumerTests { assertThat(stopLatch.await(10, TimeUnit.SECONDS)).isTrue(); assertThat(result).containsExactly(testMessage, testMessage2); + + reactiveConsumer.stop(); } @@ -222,6 +224,8 @@ public class ReactiveStreamsConsumerTests { verify(testSubscriber, never()).onComplete(); assertThat(messages.isEmpty()).isTrue(); + + reactiveConsumer.stop(); } @Test @@ -264,6 +268,8 @@ public class ReactiveStreamsConsumerTests { assertThat(stopLatch.await(10, TimeUnit.SECONDS)).isTrue(); assertThat(result.size()).isEqualTo(3); assertThat(result).containsExactly(testMessage, testMessage2, testMessage2); + + endpointFactoryBean.stop(); } @Test @@ -302,7 +308,8 @@ public class ReactiveStreamsConsumerTests { .expectNext(testMessage, testMessage2) .thenCancel() .verify(); + + reactiveConsumer.stop(); } - }