From e33e7d7681dc73560071bca4e9e62208cb9a1f27 Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Fri, 25 Sep 2020 13:42:11 +0200 Subject: [PATCH] Remove TestGroup.PERFORMANCE Now that there's a new JMH infrastructure for benchmarks and that performance tests have been rewritten to use it, we should remove the `PERFORMANCE` `TestGroup` to avoid introducing such tests in the future. Closes gh-24830 --- .../testfixture/TestGroupParsingTests.java | 18 +++++++++--------- .../core/testfixture/TestGroupTests.java | 9 +-------- .../core/testfixture/TestGroup.java | 10 +--------- 3 files changed, 11 insertions(+), 26 deletions(-) diff --git a/spring-core/src/test/java/org/springframework/core/testfixture/TestGroupParsingTests.java b/spring-core/src/test/java/org/springframework/core/testfixture/TestGroupParsingTests.java index 76f427d38c6..a7b356229c4 100644 --- a/spring-core/src/test/java/org/springframework/core/testfixture/TestGroupParsingTests.java +++ b/spring-core/src/test/java/org/springframework/core/testfixture/TestGroupParsingTests.java @@ -50,21 +50,21 @@ class TestGroupParsingTests { @Test void parseWithSpaces() { - assertThat(TestGroup.parse(" PERFORMANCE, PERFORMANCE ")).containsOnly(TestGroup.PERFORMANCE); + assertThat(TestGroup.parse(" LONG_RUNNING, LONG_RUNNING ")).containsOnly(TestGroup.LONG_RUNNING); } @Test void parseInMixedCase() { - assertThat(TestGroup.parse("performance, PERFormaNCE")).containsOnly(TestGroup.PERFORMANCE); + assertThat(TestGroup.parse("long_running, LonG_RunnING")).containsOnly(TestGroup.LONG_RUNNING); } @Test void parseMissing() { assertThatIllegalArgumentException() - .isThrownBy(() -> TestGroup.parse("performance, missing")) + .isThrownBy(() -> TestGroup.parse("long_running, missing")) .withMessageContaining("Unable to find test group 'missing' when parsing " + - "testGroups value: 'performance, missing'. Available groups include: " + - "[LONG_RUNNING,PERFORMANCE]"); + "testGroups value: 'long_running, missing'. Available groups include: " + + "[LONG_RUNNING]"); } @Test @@ -73,10 +73,10 @@ class TestGroupParsingTests { } @Test - void parseAllExceptPerformance() { + void parseAllExceptLongRunning() { Set expected = EnumSet.allOf(TestGroup.class); - expected.remove(TestGroup.PERFORMANCE); - assertThat(TestGroup.parse("all-performance")).isEqualTo(expected); + expected.remove(TestGroup.LONG_RUNNING); + assertThat(TestGroup.parse("all-long_running")).isEqualTo(expected); } @Test @@ -85,7 +85,7 @@ class TestGroupParsingTests { .isThrownBy(() -> TestGroup.parse("all-missing")) .withMessageContaining("Unable to find test group 'missing' when parsing " + "testGroups value: 'all-missing'. Available groups include: " + - "[LONG_RUNNING,PERFORMANCE]"); + "[LONG_RUNNING]"); } } diff --git a/spring-core/src/test/java/org/springframework/core/testfixture/TestGroupTests.java b/spring-core/src/test/java/org/springframework/core/testfixture/TestGroupTests.java index d9efa4fc430..0a04ce34c32 100644 --- a/spring-core/src/test/java/org/springframework/core/testfixture/TestGroupTests.java +++ b/spring-core/src/test/java/org/springframework/core/testfixture/TestGroupTests.java @@ -30,7 +30,6 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.assertj.core.api.Assertions.assertThatIllegalStateException; import static org.junit.jupiter.api.Assumptions.assumeTrue; import static org.springframework.core.testfixture.TestGroup.LONG_RUNNING; -import static org.springframework.core.testfixture.TestGroup.PERFORMANCE; /** * Tests for {@link TestGroup}. @@ -68,12 +67,6 @@ class TestGroupTests { assertThatExceptionOfType(TestAbortedException.class).isThrownBy(() -> assumeGroup(LONG_RUNNING)); } - @Test - void assumeGroupWithNoMatchingActiveTestGroup() { - setTestGroups(PERFORMANCE); - assertThatExceptionOfType(TestAbortedException.class).isThrownBy(() -> assumeGroup(LONG_RUNNING)); - } - @Test void assumeGroupWithMatchingActiveTestGroup() { setTestGroups(LONG_RUNNING); @@ -107,7 +100,7 @@ class TestGroupTests { .isInstanceOf(IllegalArgumentException.class) .withMessage( "Unable to find test group 'bogus' when parsing testGroups value: '" + testGroups + - "'. Available groups include: [LONG_RUNNING,PERFORMANCE]"); + "'. Available groups include: [LONG_RUNNING]"); } private void setTestGroups(TestGroup... testGroups) { diff --git a/spring-core/src/testFixtures/java/org/springframework/core/testfixture/TestGroup.java b/spring-core/src/testFixtures/java/org/springframework/core/testfixture/TestGroup.java index ddad7199207..a5fca972e33 100644 --- a/spring-core/src/testFixtures/java/org/springframework/core/testfixture/TestGroup.java +++ b/spring-core/src/testFixtures/java/org/springframework/core/testfixture/TestGroup.java @@ -40,15 +40,7 @@ public enum TestGroup { * 500ms should be considered a candidate in order to avoid making the overall test * suite too slow to run during the normal development cycle. */ - LONG_RUNNING, - - /** - * Performance-related tests that may fail unpredictably based on CPU profile and load. - * Any test using {@link Thread#sleep}, {@link Object#wait}, Spring's - * {@code StopWatch}, etc. should be considered a candidate as their successful - * execution is likely to be based on events occurring within a given time window. - */ - PERFORMANCE; + LONG_RUNNING; /**