From 4bcb7e2f77e5dbfcfa059181b02034f1ce4a1b3f Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 7 Mar 2022 14:55:00 +0000 Subject: [PATCH] Prevent ActiveProfilesTests from binding to 8080 Due to gh-29695, smoketest.profile.ActiveProfilesTests starts a web server bound to the default port (8080) despite the test setting `webEnvironment` to `NONE`. This commit works around the problem by running the tests with server.port set to zero. Closes gh-30086 --- .../src/test/java/smoketest/profile/ActiveProfilesTests.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-profile/src/test/java/smoketest/profile/ActiveProfilesTests.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-profile/src/test/java/smoketest/profile/ActiveProfilesTests.java index bc4b1cde61..51a66ee2bd 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-profile/src/test/java/smoketest/profile/ActiveProfilesTests.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-profile/src/test/java/smoketest/profile/ActiveProfilesTests.java @@ -33,7 +33,8 @@ import static org.assertj.core.api.Assertions.assertThat; * * @author Madhura Bhave */ -@SpringBootTest(webEnvironment = WebEnvironment.NONE, properties = "enableEnvironmentPostProcessor=true") // gh-28530 +@SpringBootTest(webEnvironment = WebEnvironment.NONE, + properties = { "enableEnvironmentPostProcessor=true", "server.port=0" }) // gh-28530 @ActiveProfiles("hello") class ActiveProfilesTests {