Requalify tests as LONG_RUNNING

Prior to this commit, some tests would belong to the PERFORMANCE
`TestGroup`, while they were not testing for performance but rather
performing functional tests that involve long running operations or
timeouts.

This commit moves those tests to the LONG_RUNNING `TestGroup`.

See gh-24830
This commit is contained in:
Brian Clozel
2020-09-25 13:13:51 +02:00
parent f89bd47188
commit e02d3f32b4
12 changed files with 47 additions and 47 deletions

View File

@@ -30,7 +30,7 @@ import org.springframework.context.SmartLifecycle;
import org.springframework.core.testfixture.EnabledForTestGroups;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.core.testfixture.TestGroup.PERFORMANCE;
import static org.springframework.core.testfixture.TestGroup.LONG_RUNNING;
/**
* @author Mark Fisher
@@ -252,7 +252,7 @@ public class DefaultLifecycleProcessorTests {
}
@Test
@EnabledForTestGroups(PERFORMANCE)
@EnabledForTestGroups(LONG_RUNNING)
public void smartLifecycleGroupShutdown() throws Exception {
CopyOnWriteArrayList<Lifecycle> stoppedBeans = new CopyOnWriteArrayList<>();
TestSmartLifecycleBean bean1 = TestSmartLifecycleBean.forShutdownTests(1, 300, stoppedBeans);
@@ -282,7 +282,7 @@ public class DefaultLifecycleProcessorTests {
}
@Test
@EnabledForTestGroups(PERFORMANCE)
@EnabledForTestGroups(LONG_RUNNING)
public void singleSmartLifecycleShutdown() throws Exception {
CopyOnWriteArrayList<Lifecycle> stoppedBeans = new CopyOnWriteArrayList<>();
TestSmartLifecycleBean bean = TestSmartLifecycleBean.forShutdownTests(99, 300, stoppedBeans);
@@ -389,7 +389,7 @@ public class DefaultLifecycleProcessorTests {
}
@Test
@EnabledForTestGroups(PERFORMANCE)
@EnabledForTestGroups(LONG_RUNNING)
public void dependentShutdownFirstEvenIfItsPhaseIsLower() throws Exception {
CopyOnWriteArrayList<Lifecycle> stoppedBeans = new CopyOnWriteArrayList<>();
TestSmartLifecycleBean beanMin = TestSmartLifecycleBean.forShutdownTests(Integer.MIN_VALUE, 100, stoppedBeans);
@@ -462,7 +462,7 @@ public class DefaultLifecycleProcessorTests {
}
@Test
@EnabledForTestGroups(PERFORMANCE)
@EnabledForTestGroups(LONG_RUNNING)
public void dependentShutdownFirstAndIsSmartLifecycle() throws Exception {
CopyOnWriteArrayList<Lifecycle> stoppedBeans = new CopyOnWriteArrayList<>();
TestSmartLifecycleBean beanMin = TestSmartLifecycleBean.forShutdownTests(Integer.MIN_VALUE, 400, stoppedBeans);
@@ -526,7 +526,7 @@ public class DefaultLifecycleProcessorTests {
}
@Test
@EnabledForTestGroups(PERFORMANCE)
@EnabledForTestGroups(LONG_RUNNING)
public void dependentShutdownFirstButNotSmartLifecycle() throws Exception {
CopyOnWriteArrayList<Lifecycle> stoppedBeans = new CopyOnWriteArrayList<>();
TestSmartLifecycleBean bean1 = TestSmartLifecycleBean.forShutdownTests(1, 200, stoppedBeans);

View File

@@ -35,7 +35,7 @@ import org.springframework.scheduling.config.ScheduledTaskRegistrar;
import org.springframework.scheduling.config.TaskManagementConfigUtils;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.core.testfixture.TestGroup.PERFORMANCE;
import static org.springframework.core.testfixture.TestGroup.LONG_RUNNING;
/**
* Tests use of @EnableScheduling on @Configuration classes.
@@ -58,7 +58,7 @@ public class EnableSchedulingTests {
@Test
@EnabledForTestGroups(PERFORMANCE)
@EnabledForTestGroups(LONG_RUNNING)
public void withFixedRateTask() throws InterruptedException {
ctx = new AnnotationConfigApplicationContext(FixedRateTaskConfig.class);
assertThat(ctx.getBean(ScheduledTaskHolder.class).getScheduledTasks().size()).isEqualTo(2);
@@ -68,7 +68,7 @@ public class EnableSchedulingTests {
}
@Test
@EnabledForTestGroups(PERFORMANCE)
@EnabledForTestGroups(LONG_RUNNING)
public void withSubclass() throws InterruptedException {
ctx = new AnnotationConfigApplicationContext(FixedRateTaskConfigSubclass.class);
assertThat(ctx.getBean(ScheduledTaskHolder.class).getScheduledTasks().size()).isEqualTo(2);
@@ -78,7 +78,7 @@ public class EnableSchedulingTests {
}
@Test
@EnabledForTestGroups(PERFORMANCE)
@EnabledForTestGroups(LONG_RUNNING)
public void withExplicitScheduler() throws InterruptedException {
ctx = new AnnotationConfigApplicationContext(ExplicitSchedulerConfig.class);
assertThat(ctx.getBean(ScheduledTaskHolder.class).getScheduledTasks().size()).isEqualTo(1);
@@ -97,7 +97,7 @@ public class EnableSchedulingTests {
}
@Test
@EnabledForTestGroups(PERFORMANCE)
@EnabledForTestGroups(LONG_RUNNING)
public void withExplicitScheduledTaskRegistrar() throws InterruptedException {
ctx = new AnnotationConfigApplicationContext(ExplicitScheduledTaskRegistrarConfig.class);
assertThat(ctx.getBean(ScheduledTaskHolder.class).getScheduledTasks().size()).isEqualTo(1);
@@ -119,7 +119,7 @@ public class EnableSchedulingTests {
}
@Test
@EnabledForTestGroups(PERFORMANCE)
@EnabledForTestGroups(LONG_RUNNING)
public void withAmbiguousTaskSchedulers_andSingleTask_disambiguatedByScheduledTaskRegistrarBean() throws InterruptedException {
ctx = new AnnotationConfigApplicationContext(
SchedulingEnabled_withAmbiguousTaskSchedulers_andSingleTask_disambiguatedByScheduledTaskRegistrar.class);
@@ -129,7 +129,7 @@ public class EnableSchedulingTests {
}
@Test
@EnabledForTestGroups(PERFORMANCE)
@EnabledForTestGroups(LONG_RUNNING)
public void withAmbiguousTaskSchedulers_andSingleTask_disambiguatedBySchedulerNameAttribute() throws InterruptedException {
ctx = new AnnotationConfigApplicationContext(
SchedulingEnabled_withAmbiguousTaskSchedulers_andSingleTask_disambiguatedBySchedulerNameAttribute.class);
@@ -139,7 +139,7 @@ public class EnableSchedulingTests {
}
@Test
@EnabledForTestGroups(PERFORMANCE)
@EnabledForTestGroups(LONG_RUNNING)
public void withTaskAddedVia_configureTasks() throws InterruptedException {
ctx = new AnnotationConfigApplicationContext(SchedulingEnabled_withTaskAddedVia_configureTasks.class);
@@ -148,7 +148,7 @@ public class EnableSchedulingTests {
}
@Test
@EnabledForTestGroups(PERFORMANCE)
@EnabledForTestGroups(LONG_RUNNING)
public void withTriggerTask() throws InterruptedException {
ctx = new AnnotationConfigApplicationContext(TriggerTaskConfig.class);
@@ -157,7 +157,7 @@ public class EnableSchedulingTests {
}
@Test
@EnabledForTestGroups(PERFORMANCE)
@EnabledForTestGroups(LONG_RUNNING)
public void withInitiallyDelayedFixedRateTask() throws InterruptedException {
ctx = new AnnotationConfigApplicationContext(FixedRateTaskConfig_withInitialDelay.class);

View File

@@ -32,7 +32,7 @@ import static org.mockito.Mockito.atLeast;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.springframework.core.testfixture.TestGroup.PERFORMANCE;
import static org.springframework.core.testfixture.TestGroup.LONG_RUNNING;
/**
* @author Rick Evans
@@ -84,7 +84,7 @@ class ScheduledExecutorFactoryBeanTests {
}
@Test
@EnabledForTestGroups(PERFORMANCE)
@EnabledForTestGroups(LONG_RUNNING)
void oneTimeExecutionIsSetUpAndFiresCorrectly() throws Exception {
Runnable runnable = mock(Runnable.class);
@@ -98,7 +98,7 @@ class ScheduledExecutorFactoryBeanTests {
}
@Test
@EnabledForTestGroups(PERFORMANCE)
@EnabledForTestGroups(LONG_RUNNING)
void fixedRepeatedExecutionIsSetUpAndFiresCorrectly() throws Exception {
Runnable runnable = mock(Runnable.class);
@@ -116,7 +116,7 @@ class ScheduledExecutorFactoryBeanTests {
}
@Test
@EnabledForTestGroups(PERFORMANCE)
@EnabledForTestGroups(LONG_RUNNING)
void fixedRepeatedExecutionIsSetUpAndFiresCorrectlyAfterException() throws Exception {
Runnable runnable = mock(Runnable.class);
willThrow(new IllegalStateException()).given(runnable).run();
@@ -136,7 +136,7 @@ class ScheduledExecutorFactoryBeanTests {
}
@Test
@EnabledForTestGroups(PERFORMANCE)
@EnabledForTestGroups(LONG_RUNNING)
void withInitialDelayRepeatedExecutionIsSetUpAndFiresCorrectly() throws Exception {
Runnable runnable = mock(Runnable.class);
@@ -156,7 +156,7 @@ class ScheduledExecutorFactoryBeanTests {
}
@Test
@EnabledForTestGroups(PERFORMANCE)
@EnabledForTestGroups(LONG_RUNNING)
void withInitialDelayRepeatedExecutionIsSetUpAndFiresCorrectlyAfterException() throws Exception {
Runnable runnable = mock(Runnable.class);
willThrow(new IllegalStateException()).given(runnable).run();

View File

@@ -33,14 +33,14 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
import static org.mockito.Mockito.mock;
import static org.springframework.core.testfixture.TestGroup.PERFORMANCE;
import static org.springframework.core.testfixture.TestGroup.LONG_RUNNING;
/**
* @author Rick Evans
* @author Juergen Hoeller
* @author Chris Beams
*/
@EnabledForTestGroups(PERFORMANCE)
@EnabledForTestGroups(LONG_RUNNING)
public class ScriptFactoryPostProcessorTests {
private static final String MESSAGE_TEXT = "Bingo";