-
Notifications
You must be signed in to change notification settings - Fork 41.7k
Closed
Labels
status: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently apply
Description
There's currently means to assign a dynamic port to the Spring Boot Server under test. When doing micro-integration (side-effect) tests, we a dynamic endpoint for a dependent services. For example, I want to start a fake google service and have Spring Boot use the endpoint to that. Currently, it is not straightforward to wire in a dynamic property like "cloud.endpoint". Neither is it possible for SpringBootTest to pick extra ports: if SpringBootTest could pick other ports, then it could render these as properties, which the fake servers could use in the test.
like here's one idea..
@SpringBootTest(bootstrapProperties = AssignGooglePort.class, ...)
--snip--
static class AssignGooglePort implements Something {
@Override public void someCallback(ConfigurableApplicationContext context){
int port = somePortPicker.pick();
EnvironmentTestUtils.addEnvironment(context,
"google.endpoint:http://host1:"+port
);
}
}
// then the test could read the bootstrapped property by injecting itRegardless of the solution pattern, it would be great to have SpringBootTest collaborate with other services (which themselves may or may not be Spring Boot).
Metadata
Metadata
Assignees
Labels
status: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently apply