Apply @DisabledInAotMode to appropriate test classes
This commit applies @DisabledInAotMode to test classes in the spring-test module that will never be able to be processed for AOT optimizations. Test classes that fail for reasons that can potentially be addressed in a future version of the framework have not been annotated with @DisabledInAotMode. See gh-29122
This commit is contained in:
parent
991afe0939
commit
66e3a7a25c
|
@ -17,6 +17,7 @@
|
|||
package org.springframework.test.context.env;
|
||||
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.aot.DisabledInAotMode;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link TestPropertySource @TestPropertySource}
|
||||
|
@ -26,5 +27,7 @@ import org.springframework.test.context.TestPropertySource;
|
|||
* @since 4.1
|
||||
*/
|
||||
@TestPropertySource("explicit.properties")
|
||||
// Since ExplicitPropertiesFileTestPropertySourceTests is disabled in AOT mode, this class must be also.
|
||||
@DisabledInAotMode
|
||||
public class ExplicitPropertiesFileInClasspathTestPropertySourceTests extends AbstractExplicitPropertiesFileTests {
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.junit.jupiter.api.DisplayName;
|
|||
import org.junit.jupiter.api.Nested;
|
||||
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.aot.DisabledInAotMode;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
|
@ -34,6 +35,9 @@ import org.springframework.util.ClassUtils;
|
|||
* @since 5.2
|
||||
*/
|
||||
@DisplayName("Explicit properties file in @TestPropertySource")
|
||||
// Since Spring test's AOT processing support does not invoke test lifecycle methods such
|
||||
// as @BeforeAll/@AfterAll, this test class simply is not supported for AOT processing.
|
||||
@DisabledInAotMode
|
||||
class ExplicitPropertiesFileTestPropertySourceTests {
|
||||
|
||||
static final String CURRENT_TEST_PACKAGE = "current.test.package";
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.springframework.test.context.env;
|
||||
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.aot.DisabledInAotMode;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link TestPropertySource @TestPropertySource}
|
||||
|
@ -26,6 +27,8 @@ import org.springframework.test.context.TestPropertySource;
|
|||
* @author Sam Brannen
|
||||
* @since 4.1
|
||||
*/
|
||||
// Since ExplicitPropertiesFileTestPropertySourceTests is disabled in AOT mode, this class must be also.
|
||||
@DisabledInAotMode
|
||||
class InheritedRelativePathPropertiesFileTestPropertySourceTests extends
|
||||
ExplicitPropertiesFileInClasspathTestPropertySourceTests {
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.springframework.test.context.env;
|
|||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.aot.DisabledInAotMode;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
@ -31,6 +32,8 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
* @since 4.1
|
||||
*/
|
||||
@TestPropertySource(properties = { "explicit = inlined", "extended = inlined1", "extended = inlined2" })
|
||||
// Since ExplicitPropertiesFileTestPropertySourceTests is disabled in AOT mode, this class must be also.
|
||||
@DisabledInAotMode
|
||||
class MergedPropertiesFilesOverriddenByInlinedPropertiesTestPropertySourceTests extends
|
||||
MergedPropertiesFilesTestPropertySourceTests {
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.springframework.test.context.env;
|
|||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.aot.DisabledInAotMode;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
@ -30,6 +31,8 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
* @since 4.1
|
||||
*/
|
||||
@TestPropertySource("extended.properties")
|
||||
// Since ExplicitPropertiesFileTestPropertySourceTests is disabled in AOT mode, this class must be also.
|
||||
@DisabledInAotMode
|
||||
class MergedPropertiesFilesTestPropertySourceTests extends
|
||||
ExplicitPropertiesFileInClasspathTestPropertySourceTests {
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.springframework.test.context.env.subpackage;
|
||||
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.aot.DisabledInAotMode;
|
||||
import org.springframework.test.context.env.ExplicitPropertiesFileInClasspathTestPropertySourceTests;
|
||||
|
||||
/**
|
||||
|
@ -27,6 +28,8 @@ import org.springframework.test.context.env.ExplicitPropertiesFileInClasspathTes
|
|||
* @author Sam Brannen
|
||||
* @since 4.1
|
||||
*/
|
||||
// Since ExplicitPropertiesFileTestPropertySourceTests is disabled in AOT mode, this class must be also.
|
||||
@DisabledInAotMode
|
||||
class SubpackageInheritedRelativePathPropertiesFileTestPropertySourceTests extends
|
||||
ExplicitPropertiesFileInClasspathTestPropertySourceTests {
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.springframework.test.annotation.IfProfileValue;
|
|||
import org.springframework.test.context.TestContext;
|
||||
import org.springframework.test.context.TestExecutionListener;
|
||||
import org.springframework.test.context.TestExecutionListeners;
|
||||
import org.springframework.test.context.aot.DisabledInAotMode;
|
||||
|
||||
import static org.assertj.core.api.Assertions.fail;
|
||||
|
||||
|
@ -33,6 +34,9 @@ import static org.assertj.core.api.Assertions.fail;
|
|||
@RunWith(SpringRunner.class)
|
||||
@TestExecutionListeners(ClassLevelDisabledSpringRunnerTests.CustomTestExecutionListener.class)
|
||||
@IfProfileValue(name = "ClassLevelDisabledSpringRunnerTests.profile_value.name", value = "enigmaX")
|
||||
// Since Spring test's AOT processing support does not evaluate @IfProfileValue,
|
||||
// this test class simply is not supported for AOT processing.
|
||||
@DisabledInAotMode
|
||||
public class ClassLevelDisabledSpringRunnerTests {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.springframework.test.annotation.IfProfileValue;
|
|||
import org.springframework.test.annotation.ProfileValueSource;
|
||||
import org.springframework.test.annotation.ProfileValueSourceConfiguration;
|
||||
import org.springframework.test.context.TestExecutionListeners;
|
||||
import org.springframework.test.context.aot.DisabledInAotMode;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.fail;
|
||||
|
@ -47,6 +48,9 @@ import static org.assertj.core.api.Assertions.fail;
|
|||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@TestExecutionListeners({})
|
||||
// Since this test class does not load an ApplicationContext,
|
||||
// this test class simply is not supported for AOT processing.
|
||||
@DisabledInAotMode
|
||||
public class EnabledAndIgnoredSpringRunnerTests {
|
||||
|
||||
protected static final String NAME = "EnabledAndIgnoredSpringRunnerTests.profile_value.name";
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.junit.BeforeClass;
|
|||
|
||||
import org.springframework.test.annotation.ProfileValueSource;
|
||||
import org.springframework.test.annotation.ProfileValueSourceConfiguration;
|
||||
import org.springframework.test.context.aot.DisabledInAotMode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -36,6 +37,8 @@ import org.springframework.test.annotation.ProfileValueSourceConfiguration;
|
|||
* @see EnabledAndIgnoredSpringRunnerTests
|
||||
*/
|
||||
@ProfileValueSourceConfiguration(HardCodedProfileValueSourceSpringRunnerTests.HardCodedProfileValueSource.class)
|
||||
// Since EnabledAndIgnoredSpringRunnerTests is disabled in AOT mode, this test class must be also.
|
||||
@DisabledInAotMode
|
||||
public class HardCodedProfileValueSourceSpringRunnerTests extends EnabledAndIgnoredSpringRunnerTests {
|
||||
|
||||
@BeforeClass
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.junit.rules.TestName;
|
|||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.test.context.TestExecutionListeners;
|
||||
import org.springframework.test.context.aot.DisabledInAotMode;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
@ -36,6 +37,9 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@TestExecutionListeners({})
|
||||
// Since this test class does not load an ApplicationContext,
|
||||
// this test class simply is not supported for AOT processing.
|
||||
@DisabledInAotMode
|
||||
public class SpringJUnit47ClassRunnerRuleTests {
|
||||
|
||||
@Rule
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.springframework.test.context.junit4;
|
|||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.test.context.TestExecutionListeners;
|
||||
import org.springframework.test.context.aot.DisabledInAotMode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -37,6 +38,9 @@ import org.springframework.test.context.TestExecutionListeners;
|
|||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@TestExecutionListeners({})
|
||||
// Since this test class does not load an ApplicationContext,
|
||||
// this test class simply is not supported for AOT processing.
|
||||
@DisabledInAotMode
|
||||
public class StandardJUnit4FeaturesSpringRunnerTests extends StandardJUnit4FeaturesTests {
|
||||
|
||||
/* All tests are in the parent class... */
|
||||
|
|
Loading…
Reference in New Issue