Skip to content

Commit 726b216

Browse files
committed
Disable TcpNioConnectionTests.testCleanup()
The timeout is too short for CI server and there is a high chance fo race condition with such a short `nioHarvestInterval` * Use `@DisabledIfEnvironmentVariable(named = "bamboo_buildKey")` to exclude the test from CI server, but still run it locally or in GH Actions
1 parent 3f6d205 commit 726b216

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

spring-integration-ip/src/test/java/org/springframework/integration/ip/tcp/connection/TcpNioConnectionTests.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@
6363

6464
import org.apache.commons.logging.Log;
6565
import org.apache.commons.logging.LogFactory;
66-
import org.junit.jupiter.api.Disabled;
6766
import org.junit.jupiter.api.Test;
6867
import org.junit.jupiter.api.TestInfo;
68+
import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable;
6969
import org.mockito.Mockito;
7070
import org.mockito.invocation.InvocationOnMock;
7171
import org.mockito.stubbing.Answer;
@@ -245,6 +245,8 @@ public void testMemoryLeak(TestInfo testInfo) throws Exception {
245245
}
246246

247247
@Test
248+
@DisabledIfEnvironmentVariable(named = "bamboo_buildKey", matches = ".*?",
249+
disabledReason = "Timing is too short for CI")
248250
public void testCleanup() throws Exception {
249251
TcpNioClientConnectionFactory factory = new TcpNioClientConnectionFactory("localhost", 0);
250252
factory.setApplicationEventPublisher(nullPublisher);
@@ -816,7 +818,8 @@ public Void answer(InvocationOnMock invocation) throws Throwable {
816818
}
817819

818820
@Test
819-
@Disabled("Timing is too short for CI")
821+
@DisabledIfEnvironmentVariable(named = "bamboo_buildKey", matches = ".*?",
822+
disabledReason = "Timing is too short for CI")
820823
public void testNoDelayOnClose() throws Exception {
821824
TcpNioServerConnectionFactory cf = new TcpNioServerConnectionFactory(0);
822825
final CountDownLatch reading = new CountDownLatch(1);
@@ -831,9 +834,7 @@ public void testNoDelayOnClose() throws Exception {
831834
});
832835
cf.registerListener(m -> false);
833836
final CountDownLatch listening = new CountDownLatch(1);
834-
cf.setApplicationEventPublisher(e -> {
835-
listening.countDown();
836-
});
837+
cf.setApplicationEventPublisher(e -> listening.countDown());
837838
cf.afterPropertiesSet();
838839
cf.start();
839840
assertThat(listening.await(10, TimeUnit.SECONDS)).isTrue();

0 commit comments

Comments
 (0)