-
Notifications
You must be signed in to change notification settings - Fork 40.7k
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
Random management.server.port gets set to the same value as local.server.port #16102
Labels
Comments
spring-projects-issues
added
the
status: waiting-for-triage
An issue we've not yet triaged
label
Mar 5, 2019
This sounds like it may be a bug in |
mbhave
added
type: bug
A general bug
and removed
status: waiting-for-triage
An issue we've not yet triaged
labels
Mar 6, 2019
nosan
added a commit
to nosan/spring-boot
that referenced
this issue
Mar 6, 2019
the same value and `management.server.port` has been defined in the different PropertySource spring-projectsgh-16102
nosan
added a commit
to nosan/spring-boot
that referenced
this issue
Mar 6, 2019
the same value and `management.server.port` has been defined in the different PropertySource spring-projectsgh-16102
Closing in favor of PR #16108. |
nosan
added a commit
to nosan/spring-boot
that referenced
this issue
Mar 8, 2019
the same value and `management.server.port` has been defined in the different PropertySource spring-projectsgh-16102
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A minimum project to reproduce this issue is available here: https://github.com/gkonupek/SpringBootActuatorIssue
The project is a basic Spring Boot web application with Actuator. A problem occurs in tests when using Spring Boot version 2.1.x. In this case, I'm using version 2.1.3.RELEASE.
In the mentioned project, on branch "master" there is the following situation:
DemoApplicationTests
I'm using@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
annotation to run the application on a random, free port.application.properties
file, I've specifiedmanagement.server.port=0
to make Actuator endpoint run on a random, free port as well.DemoApplicationTests
:serverPort
(annotated with@LocalServerPort
) andmanagementPort
(annotated with@LocalManagementPort
).@ActiveProfiles("test")
- it will be important later.In this configuration I expect the test to pass. Indeed, the generated ports are different.
Spring Boot 2.1.x
Now, in the repository there is a second branch named "spring-boot-2.1.x". The only difference between master is that the Spring Boot version has been upgraded to 2.1.3.RELEASE.
Unfortunately, in this configuration the test is failing. Both
serverPort
andmanagementPort
have the same value.Role of
@ActiveProfiles
annotation?Another interesting case is present on the branch named "without-active-profile". In this case, the Spring Boot version is still 2.1.3.RELEASE. However, I've removed the
@ActiveProfiles("test")
annotation fromDemoApplicationTests
. In this case, the test is passing again - the port numbers are different.The last scenario is actually the workaround, which I've applied to make my application work. Instead of using the annotation I could just import my
application-test.properties
file manually, by using@TestPropertySource
annotation. However, I'd really love to see this issue explained and eventually fixed.Cheers,
Grzegorz
The text was updated successfully, but these errors were encountered: