Add property to migrate deprecated endoint IDs
Allow legacy actuator endpoint IDs that contain dots to be transparently migrated to the new format. This update will allow Spring Cloud users to proactively migrate from endpoints such as `hystrix.stream` to `hystrixstream`. Closes gh-18148
This commit is contained in:
@@ -21,6 +21,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.boot.test.system.CapturedOutput;
|
||||
import org.springframework.boot.test.system.OutputCaptureExtension;
|
||||
import org.springframework.mock.env.MockEnvironment;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
|
||||
@@ -92,6 +93,16 @@ class EndpointIdTests {
|
||||
.contains("Endpoint ID 'foo-bar' contains invalid characters, please migrate to a valid format");
|
||||
}
|
||||
|
||||
@Test
|
||||
void ofWhenMigratingLegacyNameRemovesDots(CapturedOutput output) {
|
||||
EndpointId.resetLoggedWarnings();
|
||||
MockEnvironment environment = new MockEnvironment();
|
||||
environment.setProperty("management.endpoints.migrate-legacy-ids", "true");
|
||||
EndpointId endpointId = EndpointId.of(environment, "foo.bar");
|
||||
assertThat(endpointId.toString()).isEqualTo("foobar");
|
||||
assertThat(output).doesNotContain("contains invalid characters");
|
||||
}
|
||||
|
||||
@Test
|
||||
void equalsAndHashCode() {
|
||||
EndpointId one = EndpointId.of("foobar1");
|
||||
|
||||
Reference in New Issue
Block a user