Tighten rules around profile naming

Profiles are only allowed to use dashes, underscores, digits or letters.

See gh-43176
This commit is contained in:
sijun-yang
2024-11-15 22:51:11 +09:00
committed by Moritz Halbritter
parent 579be1cea8
commit 0be0bed88c
4 changed files with 110 additions and 18 deletions

View File

@@ -60,6 +60,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
* @author Stephane Nicoll
* @author Scott Frederick
* @author Madhura Bhave
* @author Sijun Yang
*/
class SpringBootContextLoaderTests {
@@ -127,11 +128,6 @@ class SpringBootContextLoaderTests {
assertThat(getActiveProfiles(MultipleActiveProfiles.class)).containsExactly("profile1", "profile2");
}
@Test
void activeProfileWithComma() {
assertThat(getActiveProfiles(ActiveProfileWithComma.class)).containsExactly("profile1,2");
}
@Test // gh-28776
void testPropertyValuesShouldTakePrecedenceWhenInlinedPropertiesPresent() {
TestContext context = new ExposedTestContextManager(SimpleConfig.class).getExposedTestContext();
@@ -314,14 +310,8 @@ class SpringBootContextLoaderTests {
}
@SpringBootTest(classes = Config.class)
@ActiveProfiles({ "profile1,2" })
static class ActiveProfileWithComma {
}
@SpringBootTest(properties = { "key=myValue" }, classes = Config.class)
@ActiveProfiles({ "profile1,2" })
@ActiveProfiles({ "profile1" })
static class ActiveProfileWithInlinedProperties {
}