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
This commit is contained in:
Artem Bilan
2021-09-20 11:36:23 -04:00
parent 3f6d205615
commit 726b216f07

View File

@@ -63,9 +63,9 @@ import javax.net.SocketFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;
import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -245,6 +245,8 @@ public class TcpNioConnectionTests {
}
@Test
@DisabledIfEnvironmentVariable(named = "bamboo_buildKey", matches = ".*?",
disabledReason = "Timing is too short for CI")
public void testCleanup() throws Exception {
TcpNioClientConnectionFactory factory = new TcpNioClientConnectionFactory("localhost", 0);
factory.setApplicationEventPublisher(nullPublisher);
@@ -816,7 +818,8 @@ public class TcpNioConnectionTests {
}
@Test
@Disabled("Timing is too short for CI")
@DisabledIfEnvironmentVariable(named = "bamboo_buildKey", matches = ".*?",
disabledReason = "Timing is too short for CI")
public void testNoDelayOnClose() throws Exception {
TcpNioServerConnectionFactory cf = new TcpNioServerConnectionFactory(0);
final CountDownLatch reading = new CountDownLatch(1);
@@ -831,9 +834,7 @@ public class TcpNioConnectionTests {
});
cf.registerListener(m -> false);
final CountDownLatch listening = new CountDownLatch(1);
cf.setApplicationEventPublisher(e -> {
listening.countDown();
});
cf.setApplicationEventPublisher(e -> listening.countDown());
cf.afterPropertiesSet();
cf.start();
assertThat(listening.await(10, TimeUnit.SECONDS)).isTrue();