Skip to content

Conversation

farhan7479
Copy link

Fixes #1961

Problem:

  • Integration tests fail when port 8080 is already in use
  • Tests cannot start embedded server due to port conflicts
  • This prevents reliable test execution in CI/CD environments

Solution:

  • Add application-test.properties with server.port=0 for random port assignment
  • Configure PetClinicIntegrationTests to use test profile with @activeprofiles('test')
  • Tests now automatically use available ports and never conflict

Changes:

  • Create src/test/resources/application-test.properties with test-specific configuration
  • Add @activeprofiles('test') annotation to PetClinicIntegrationTests.java
  • Configure separate database, caching, and logging settings for tests

Testing:

  • Integration tests now run successfully with random ports (e.g., 60479)
  • No more port conflicts during test execution
  • Tests are isolated from main application configuration

See: #1961

Signed-off-by: Farhan Shahid [email protected]

Fixes spring-projects#1961

Problem:
- Integration tests fail when port 8080 is already in use
- Tests cannot start embedded server due to port conflicts
- This prevents reliable test execution in CI/CD environments

Solution:
- Add application-test.properties with server.port=0 for random port assignment
- Configure PetClinicIntegrationTests to use test profile with @activeprofiles('test')
- Tests now automatically use available ports and never conflict

Changes:
- Create src/test/resources/application-test.properties with test-specific configuration
- Add @activeprofiles('test') annotation to PetClinicIntegrationTests.java
- Configure separate database, caching, and logging settings for tests

Testing:
- Integration tests now run successfully with random ports (e.g., 60479)
- No more port conflicts during test execution
- Tests are isolated from main application configuration

See: spring-projects#1961

Signed-off-by: Farhan Shahid <[email protected]>
Signed-off-by: Farhan Shahid <[email protected]>
@farhan7479 farhan7479 force-pushed the fix/test-port-conflict branch from 1a93f70 to 99a37ac Compare August 29, 2025 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix test failures due to feature flag configuration and port conflict
1 participant