Skip to content

Commit 039df1d

Browse files
committed
Test spring.profiles.include in profile file
Add a test to ensure that `spring.profiles.include` is not silently ignored when used in a profile-specific file. See gh-24733
1 parent 26a68ca commit 039df1d

4 files changed

+9
-1
lines changed

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigDataEnvironmentPostProcessorIntegrationTests.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,8 +630,14 @@ void runWhenHasIncludedProfilesWithPlaceholderActivatesProfiles() {
630630

631631
@Test
632632
void runWhenHasIncludedProfilesWithProfileSpecificDocumentThrowsException() {
633+
assertThatExceptionOfType(InactiveConfigDataAccessException.class).isThrownBy(() -> this.application.run(
634+
"--spring.config.location=classpath:application-include-profiles-in-profile-specific-document.properties"));
635+
}
636+
637+
@Test
638+
void runWhenHasIncludedProfilesWithProfileSpecificFileThrowsException() {
633639
assertThatExceptionOfType(InactiveConfigDataAccessException.class).isThrownBy(() -> this.application
634-
.run("--spring.config.location=classpath:application-include-profiles-in-profile-specific.properties"));
640+
.run("--spring.config.name=application-include-profiles-in-profile-specific-document"));
635641
}
636642

637643
@Test
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
spring.profiles.include=p2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
spring.profiles.active=test

0 commit comments

Comments
 (0)