|
|
@ -50,8 +50,8 @@ class ConfigDataActivationContextTests {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
void getCloudPlatformWhenClouldPropertyInEnvironmentDeducesCloudPlatform() {
|
|
|
|
void getCloudPlatformWhenCloudPropertyInEnvironmentDeducesCloudPlatform() {
|
|
|
|
MockEnvironment environment = createKuberntesEnvironment();
|
|
|
|
MockEnvironment environment = createKubernetesEnvironment();
|
|
|
|
Binder binder = Binder.get(environment);
|
|
|
|
Binder binder = Binder.get(environment);
|
|
|
|
ConfigDataActivationContext context = new ConfigDataActivationContext(environment, binder);
|
|
|
|
ConfigDataActivationContext context = new ConfigDataActivationContext(environment, binder);
|
|
|
|
assertThat(context.getCloudPlatform()).isEqualTo(CloudPlatform.KUBERNETES);
|
|
|
|
assertThat(context.getCloudPlatform()).isEqualTo(CloudPlatform.KUBERNETES);
|
|
|
@ -59,7 +59,7 @@ class ConfigDataActivationContextTests {
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
void getCloudPlatformWhenCloudPropertyHasBeenContributedDuringInitialLoadDeducesCloudPlatform() {
|
|
|
|
void getCloudPlatformWhenCloudPropertyHasBeenContributedDuringInitialLoadDeducesCloudPlatform() {
|
|
|
|
Environment environment = createKuberntesEnvironment();
|
|
|
|
Environment environment = createKubernetesEnvironment();
|
|
|
|
Binder binder = new Binder(
|
|
|
|
Binder binder = new Binder(
|
|
|
|
new MapConfigurationPropertySource(Collections.singletonMap("spring.main.cloud-platform", "HEROKU")));
|
|
|
|
new MapConfigurationPropertySource(Collections.singletonMap("spring.main.cloud-platform", "HEROKU")));
|
|
|
|
ConfigDataActivationContext context = new ConfigDataActivationContext(environment, binder);
|
|
|
|
ConfigDataActivationContext context = new ConfigDataActivationContext(environment, binder);
|
|
|
@ -85,7 +85,7 @@ class ConfigDataActivationContextTests {
|
|
|
|
assertThat(context.getProfiles()).isEqualTo(profiles);
|
|
|
|
assertThat(context.getProfiles()).isEqualTo(profiles);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private MockEnvironment createKuberntesEnvironment() {
|
|
|
|
private MockEnvironment createKubernetesEnvironment() {
|
|
|
|
MockEnvironment environment = new MockEnvironment();
|
|
|
|
MockEnvironment environment = new MockEnvironment();
|
|
|
|
Map<String, Object> map = new LinkedHashMap<>();
|
|
|
|
Map<String, Object> map = new LinkedHashMap<>();
|
|
|
|
map.put("KUBERNETES_SERVICE_HOST", "host");
|
|
|
|
map.put("KUBERNETES_SERVICE_HOST", "host");
|
|
|
|