|
22 | 22 | import java.util.stream.Stream; |
23 | 23 |
|
24 | 24 | import org.junit.jupiter.api.Test; |
| 25 | +import org.junit.jupiter.params.ParameterizedTest; |
| 26 | +import org.junit.jupiter.params.provider.ValueSource; |
25 | 27 |
|
26 | 28 | import org.springframework.boot.context.properties.bind.Binder; |
27 | 29 | import org.springframework.boot.context.properties.source.MockConfigurationPropertySource; |
@@ -205,6 +207,24 @@ void getActiveWhenHasMissingWebsiteSkuShouldNotReturnAzureAppService() { |
205 | 207 | assertThat(platform).isNull(); |
206 | 208 | } |
207 | 209 |
|
| 210 | + @ParameterizedTest |
| 211 | + @ValueSource(strings = { "AWS_ECS_FARGATE", "AWS_ECS_EC2" }) |
| 212 | + void getActiveWhenHasAwsExecutionEnvEcsShouldReturnAwsEcs(String awsExecutionEnv) { |
| 213 | + Map<String, Object> envVars = Map.of("AWS_EXECUTION_ENV", awsExecutionEnv); |
| 214 | + Environment environment = getEnvironmentWithEnvVariables(envVars); |
| 215 | + CloudPlatform platform = CloudPlatform.getActive(environment); |
| 216 | + assertThat(platform).isNotNull().isEqualTo(CloudPlatform.AWS_ECS); |
| 217 | + assertThat(platform.isActive(environment)).isTrue(); |
| 218 | + } |
| 219 | + |
| 220 | + @Test |
| 221 | + void getActiveWhenHasAwsExecutionEnvLambdaShouldNotReturnAwsEcs() { |
| 222 | + Map<String, Object> envVars = Map.of("AWS_EXECUTION_ENV", "AWS_Lambda_java8"); |
| 223 | + Environment environment = getEnvironmentWithEnvVariables(envVars); |
| 224 | + CloudPlatform platform = CloudPlatform.getActive(environment); |
| 225 | + assertThat(platform).isNull(); |
| 226 | + } |
| 227 | + |
208 | 228 | @Test |
209 | 229 | void getActiveWhenHasEnforcedCloudPlatform() { |
210 | 230 | Environment environment = getEnvironmentWithEnvVariables( |
|
0 commit comments