From 850671698b2bf4e7a88e97b25e35f0ba05da1e4a Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Tue, 19 Jul 2022 12:32:08 -0400 Subject: [PATCH] Disable some time-sensitive tests on CI **Cherry-pick to `5.5.x`** --- .../aggregator/FluxAggregatorMessageHandlerTests.java | 7 ++++--- .../endpoint/ReactiveMessageSourceProducerTests.java | 5 ++++- .../integration/handler/DelayHandlerTests.java | 7 ++++--- .../jdbc/mysql/MySqlJdbcMessageStoreTests.java | 10 ++++++---- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/FluxAggregatorMessageHandlerTests.java b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/FluxAggregatorMessageHandlerTests.java index 421e9ce3e4..5757ad1a73 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/aggregator/FluxAggregatorMessageHandlerTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/aggregator/FluxAggregatorMessageHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 the original author or authors. + * Copyright 2019-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,8 +25,8 @@ import java.util.concurrent.Executors; import java.util.stream.Collectors; import java.util.stream.IntStream; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable; import org.springframework.integration.IntegrationMessageHeaderAccessor; import org.springframework.integration.channel.QueueChannel; @@ -158,7 +158,8 @@ class FluxAggregatorMessageHandlerTests { } @Test - @Disabled("Time-sensitive") + @DisabledIfEnvironmentVariable(named = "bamboo_buildKey", matches = ".*?", + disabledReason = "Timing is too short for CI") void testWindowTimespan() { QueueChannel resultChannel = new QueueChannel(); FluxAggregatorMessageHandler fluxAggregatorMessageHandler = new FluxAggregatorMessageHandler(); diff --git a/spring-integration-core/src/test/java/org/springframework/integration/endpoint/ReactiveMessageSourceProducerTests.java b/spring-integration-core/src/test/java/org/springframework/integration/endpoint/ReactiveMessageSourceProducerTests.java index f5831a250c..3c956fdf5b 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/endpoint/ReactiveMessageSourceProducerTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/endpoint/ReactiveMessageSourceProducerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ import java.util.stream.Collectors; import java.util.stream.IntStream; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable; import org.springframework.beans.factory.BeanFactory; import org.springframework.integration.IntegrationMessageHeaderAccessor; @@ -46,6 +47,8 @@ import reactor.test.StepVerifier; public class ReactiveMessageSourceProducerTests { @Test + @DisabledIfEnvironmentVariable(named = "bamboo_buildKey", matches = ".*?", + disabledReason = "Timing is too short for CI") void testReactiveMessageSourceProducing() { LinkedBlockingQueue queue = IntStream.range(0, 10) diff --git a/spring-integration-core/src/test/java/org/springframework/integration/handler/DelayHandlerTests.java b/spring-integration-core/src/test/java/org/springframework/integration/handler/DelayHandlerTests.java index 2b8c4bc0ca..bf2755737d 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/handler/DelayHandlerTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/handler/DelayHandlerTests.java @@ -33,8 +33,8 @@ import java.util.concurrent.atomic.AtomicInteger; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable; import org.mockito.Mockito; import org.springframework.beans.DirectFieldAccessor; @@ -415,8 +415,9 @@ public class DelayHandlerTests { assertThat(resultHandler.lastThread).isNotSameAs(Thread.currentThread()); } - @Test //INT-1132 - @Disabled("Time-sensitive: no guarantee that message won't be released in between 'sleep' and 'destroy'") + @Test + @DisabledIfEnvironmentVariable(named = "bamboo_buildKey", matches = ".*?", + disabledReason = "Timing is too short for CI") public void testReschedulePersistedMessagesOnStartup() throws Exception { MessageGroupStore messageGroupStore = new SimpleMessageStore(); this.delayHandler.setDefaultDelay(2000); diff --git a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/mysql/MySqlJdbcMessageStoreTests.java b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/mysql/MySqlJdbcMessageStoreTests.java index 499cf0a584..ec74862bda 100644 --- a/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/mysql/MySqlJdbcMessageStoreTests.java +++ b/spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/mysql/MySqlJdbcMessageStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,8 +30,8 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -325,7 +325,8 @@ public class MySqlJdbcMessageStoreTests implements MySqlContainerTest { @Test @Transactional - @Disabled("Time sensitive") + @DisabledIfEnvironmentVariable(named = "bamboo_buildKey", matches = ".*?", + disabledReason = "Timing is too short for CI") public void testExpireMessageGroupOnCreateOnly() throws Exception { String groupId = "X"; Message message = MessageBuilder.withPayload("foo").setCorrelationId(groupId).build(); @@ -345,7 +346,8 @@ public class MySqlJdbcMessageStoreTests implements MySqlContainerTest { @Test @Transactional - @Disabled("Time sensitive") + @DisabledIfEnvironmentVariable(named = "bamboo_buildKey", matches = ".*?", + disabledReason = "Timing is too short for CI") public void testExpireMessageGroupOnIdleOnly() throws Exception { String groupId = "X"; Message message = MessageBuilder.withPayload("foo").setCorrelationId(groupId).build();