use of cn.taketoday.core.env.Environment in project today-infrastructure by TAKETODAY.
the class CloudPlatformTests method getActiveWhenHasKubernetesServicePortAndNoKubernetesServiceHostShouldNotReturnKubernetes.
@Test
void getActiveWhenHasKubernetesServicePortAndNoKubernetesServiceHostShouldNotReturnKubernetes() {
Environment environment = getEnvironmentWithEnvVariables(Collections.singletonMap("KUBERNETES_SERVICE_PORT", "8080"));
CloudPlatform platform = CloudPlatform.getActive(environment);
assertThat(platform).isNull();
}
use of cn.taketoday.core.env.Environment in project today-infrastructure by TAKETODAY.
the class CloudPlatformTests method getActiveWhenHasKubernetesServiceHostAndNoKubernetesServicePortShouldNotReturnKubernetes.
@Test
void getActiveWhenHasKubernetesServiceHostAndNoKubernetesServicePortShouldNotReturnKubernetes() {
Environment environment = getEnvironmentWithEnvVariables(Collections.singletonMap("KUBERNETES_SERVICE_HOST", "---"));
CloudPlatform platform = CloudPlatform.getActive(environment);
assertThat(platform).isNull();
}
use of cn.taketoday.core.env.Environment in project today-infrastructure by TAKETODAY.
the class CloudPlatformTests method getActiveWhenHasAllAzureEnvVariablesShouldReturnAzureAppService.
@Test
void getActiveWhenHasAllAzureEnvVariablesShouldReturnAzureAppService() {
Map<String, Object> envVars = new HashMap<>();
envVars.put("WEBSITE_SITE_NAME", "---");
envVars.put("WEBSITE_INSTANCE_ID", "1234");
envVars.put("WEBSITE_RESOURCE_GROUP", "test");
envVars.put("WEBSITE_SKU", "1234");
Environment environment = getEnvironmentWithEnvVariables(envVars);
CloudPlatform platform = CloudPlatform.getActive(environment);
assertThat(platform).isEqualTo(CloudPlatform.AZURE_APP_SERVICE);
assertThat(platform.isActive(environment)).isTrue();
}
use of cn.taketoday.core.env.Environment in project today-infrastructure by TAKETODAY.
the class CloudPlatformTests method getActiveWhenHasKubernetesServiceHostAndPortShouldReturnKubernetes.
@Test
void getActiveWhenHasKubernetesServiceHostAndPortShouldReturnKubernetes() {
Map<String, Object> envVars = new HashMap<>();
envVars.put("KUBERNETES_SERVICE_HOST", "---");
envVars.put("KUBERNETES_SERVICE_PORT", "8080");
Environment environment = getEnvironmentWithEnvVariables(envVars);
CloudPlatform platform = CloudPlatform.getActive(environment);
assertThat(platform).isEqualTo(CloudPlatform.KUBERNETES);
assertThat(platform.isActive(environment)).isTrue();
}
use of cn.taketoday.core.env.Environment in project today-infrastructure by TAKETODAY.
the class CloudPlatformTests method getActiveWhenHasDynoShouldReturnHeroku.
@Test
void getActiveWhenHasDynoShouldReturnHeroku() {
Environment environment = new MockEnvironment().withProperty("DYNO", "---");
CloudPlatform platform = CloudPlatform.getActive(environment);
assertThat(platform).isEqualTo(CloudPlatform.HEROKU);
assertThat(platform.isActive(environment)).isTrue();
}
Aggregations