-
Notifications
You must be signed in to change notification settings - Fork 40.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@SpringBootTest(randomPort = true) does not generate random port for actuator #4424
Comments
The
We can't really use it to set a random management port since many tests will expect that the actuator is running on the same port as the main server. You can probably achieve what you need by setting |
@philwebb The problem that I am currently facing is that I cannot have my application running and executing integration tests concurrently because the actuator port collisions when using Nevertheless, I can see an updated solution to the random port behavior where some logic checks |
@matsev I'd have to take a look at the code but I have a feeling that the |
@philwebb Ok, just a suggestion, not a big deal. If you need to create a second attribute I guess that it is of less value since the developer needs to key about as many characters anyway (although tab-completion will help you). |
I can try help in this issue if not solved, ok @philwebb? |
@FelipeAdorno no need to ask, the issue has |
The updated |
Previous to this commit, in order to provide a random port for management key property should be explicitly provided. Now, SpringBootTest annotation can do this if WebEnvironment.RANDOM_SERVER_AND_MANAGEMENT_PORT is set. ``` @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_SERVER_AND_MANAGEMENT_PORT) public classSpringBootApplicationTests { } ``` See spring-projectsgh-4424
Closing in favor of PR #8023 |
Reopening due to comment #8023 (comment) |
@philwebb is there any way to do this now? |
@guenhter The issue is still open |
Is there any news with this fix? |
So, are there only these 2 workarounds:
Correct? |
Step by step
management.port=8081
@WebIntegrationTest(randomPort = true)
Expected result
The actuator endpoints should be assigned to a random port.
Actual result
The actuator endpoints are assigned to the same port as in the configuration file (i.e.
8081
in the example above)Version
Spring Boot 1.3.0.RC1
The text was updated successfully, but these errors were encountered: