|
|
@ -133,10 +133,12 @@ class CloudPlatformTests {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
void getActiveWhenHasWebsiteSiteNameAndWebsitesEnableAppServiceStorageShouldReturnAzureAppService() {
|
|
|
|
void getActiveWhenHasAllAzureEnvVariablesShouldReturnAzureAppService() {
|
|
|
|
Map<String, Object> envVars = new HashMap<>();
|
|
|
|
Map<String, Object> envVars = new HashMap<>();
|
|
|
|
envVars.put("WEBSITE_SITE_NAME", "---");
|
|
|
|
envVars.put("WEBSITE_SITE_NAME", "---");
|
|
|
|
envVars.put("WEBSITES_ENABLE_APP_SERVICE_STORAGE", "false");
|
|
|
|
envVars.put("WEBSITE_INSTANCE_ID", "1234");
|
|
|
|
|
|
|
|
envVars.put("WEBSITE_RESOURCE_GROUP", "test");
|
|
|
|
|
|
|
|
envVars.put("WEBSITE_SKU", "1234");
|
|
|
|
Environment environment = getEnvironmentWithEnvVariables(envVars);
|
|
|
|
Environment environment = getEnvironmentWithEnvVariables(envVars);
|
|
|
|
CloudPlatform platform = CloudPlatform.getActive(environment);
|
|
|
|
CloudPlatform platform = CloudPlatform.getActive(environment);
|
|
|
|
assertThat(platform).isEqualTo(CloudPlatform.AZURE_APP_SERVICE);
|
|
|
|
assertThat(platform).isEqualTo(CloudPlatform.AZURE_APP_SERVICE);
|
|
|
@ -144,16 +146,45 @@ class CloudPlatformTests {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
void getActiveWhenHasWebsiteSiteNameAndNoWebsitesEnableAppServiceStorageShouldNotReturnAzureAppService() {
|
|
|
|
void getActiveWhenHasMissingWebsiteSiteNameShouldNotReturnAzureAppService() {
|
|
|
|
Environment environment = getEnvironmentWithEnvVariables(Collections.singletonMap("WEBSITE_SITE_NAME", "---"));
|
|
|
|
Map<String, Object> envVars = new HashMap<>();
|
|
|
|
|
|
|
|
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);
|
|
|
|
CloudPlatform platform = CloudPlatform.getActive(environment);
|
|
|
|
assertThat(platform).isNull();
|
|
|
|
assertThat(platform).isNull();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
void getActiveWhenHasWebsitesEnableAppServiceStorageAndNoWebsiteSiteNameShouldNotReturnAzureAppService() {
|
|
|
|
void getActiveWhenHasMissingWebsiteInstanceIdShouldNotReturnAzureAppService() {
|
|
|
|
Environment environment = getEnvironmentWithEnvVariables(
|
|
|
|
Map<String, Object> envVars = new HashMap<>();
|
|
|
|
Collections.singletonMap("WEBSITES_ENABLE_APP_SERVICE_STORAGE", "false"));
|
|
|
|
envVars.put("WEBSITE_SITE_NAME", "---");
|
|
|
|
|
|
|
|
envVars.put("WEBSITE_RESOURCE_GROUP", "test");
|
|
|
|
|
|
|
|
envVars.put("WEBSITE_SKU", "1234");
|
|
|
|
|
|
|
|
Environment environment = getEnvironmentWithEnvVariables(envVars);
|
|
|
|
|
|
|
|
CloudPlatform platform = CloudPlatform.getActive(environment);
|
|
|
|
|
|
|
|
assertThat(platform).isNull();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
void getActiveWhenHasMissingWebsiteResourceGroupShouldNotReturnAzureAppService() {
|
|
|
|
|
|
|
|
Map<String, Object> envVars = new HashMap<>();
|
|
|
|
|
|
|
|
envVars.put("WEBSITE_SITE_NAME", "---");
|
|
|
|
|
|
|
|
envVars.put("WEBSITE_INSTANCE_ID", "1234");
|
|
|
|
|
|
|
|
envVars.put("WEBSITE_SKU", "1234");
|
|
|
|
|
|
|
|
Environment environment = getEnvironmentWithEnvVariables(envVars);
|
|
|
|
|
|
|
|
CloudPlatform platform = CloudPlatform.getActive(environment);
|
|
|
|
|
|
|
|
assertThat(platform).isNull();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
void getActiveWhenHasMissingWebsiteSkuShouldNotReturnAzureAppService() {
|
|
|
|
|
|
|
|
Map<String, Object> envVars = new HashMap<>();
|
|
|
|
|
|
|
|
envVars.put("WEBSITE_SITE_NAME", "---");
|
|
|
|
|
|
|
|
envVars.put("WEBSITE_INSTANCE_ID", "1234");
|
|
|
|
|
|
|
|
envVars.put("WEBSITE_RESOURCE_GROUP", "test");
|
|
|
|
|
|
|
|
Environment environment = getEnvironmentWithEnvVariables(envVars);
|
|
|
|
CloudPlatform platform = CloudPlatform.getActive(environment);
|
|
|
|
CloudPlatform platform = CloudPlatform.getActive(environment);
|
|
|
|
assertThat(platform).isNull();
|
|
|
|
assertThat(platform).isNull();
|
|
|
|
}
|
|
|
|
}
|
|
|
|