mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
feat(cloudformation): forward ECS task volumes and mounts (#8601)
* feat(cloudformation): forward ECS task volumes and mounts * fix(cloudformation): share ECS volume parsing and validate mounts * fix(ecs): share volume validation across API and CloudFormation
This commit is contained in:
1 parent
7331a6b1ce
commit
a35fcfd9da
9 files changed
+596
-7
No files matched your search
@@ -762,6 +762,12 @@ resource schema declares (measured). Floci reads them the same way, before anyth
|
||||
records a warning event for a value that it does not convert itself and the handler does
|
||||
(`" 128"`, `"0128"`, `" true"`); Floci does not.
|
||||
|
||||
`Volumes` and container `MountPoints` reach the registered ECS task definition and appear in
|
||||
`DescribeTaskDefinition`. EFS, host and ephemeral volumes use the existing ECS volume models;
|
||||
host source paths use the same allowlist check as `RegisterTaskDefinition`. Docker, FSx Windows
|
||||
File Server and S3 Files volume settings survive the describe round trip but have no local mount
|
||||
backend. EFS uses a local named volume rather than a real NFS data plane.
|
||||
|
||||
## Account-Aware Provisioning
|
||||
|
||||
Resources provisioned by `CreateStack` / `UpdateStack` land in the **caller's account** namespace
|
||||
|
||||
@@ -1044,6 +1044,11 @@ ephemeral storage shared by the containers in that task. Each container's `mount
|
||||
the volume, mount path and read-only mode. Floci creates a Docker volume for each mounted task
|
||||
volume; different tasks get separate storage even when they use the same task definition.
|
||||
|
||||
Both `RegisterTaskDefinition` and CloudFormation task definitions reject a mount source that
|
||||
does not name a declared volume, a volume with multiple configuration kinds, and an EFS access
|
||||
point or IAM authorization without transit encryption enabled. EFS, S3 Files and
|
||||
configured-at-launch volumes require a name; generic volumes and mount members remain optional.
|
||||
|
||||
Task teardown removes this storage after the containers have been removed. Cleanup also runs
|
||||
when a task exits naturally or fails to launch. The task reconciler retries failed removals,
|
||||
including cleanup left pending by a failed launch or a state reset.
|
||||
|
||||
+53
-2
@@ -4,10 +4,12 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import io.floci.aws.core.common.AwsArnUtils;
|
||||
import io.floci.aws.core.common.AwsException;
|
||||
import io.floci.aws.services.cloudformation.model.StackResource;
|
||||
import io.floci.aws.services.ecs.EcsJsonHandler;
|
||||
import io.floci.aws.services.ecs.EcsService;
|
||||
import io.floci.aws.services.ecs.model.AwsVpcConfiguration;
|
||||
import io.floci.aws.services.ecs.model.CapacityProviderStrategyItem;
|
||||
@@ -59,10 +61,12 @@ public class EcsCfnProvisioner implements CfnResourceProvisioner {
|
||||
private static final TypeReference<List<ClusterSetting>> SETTINGS = new TypeReference<>() { };
|
||||
|
||||
private final EcsService ecsService;
|
||||
private final EcsJsonHandler ecsJsonHandler;
|
||||
|
||||
@Inject
|
||||
public EcsCfnProvisioner(EcsService ecsService) {
|
||||
public EcsCfnProvisioner(EcsService ecsService, EcsJsonHandler ecsJsonHandler) {
|
||||
this.ecsService = ecsService;
|
||||
this.ecsJsonHandler = ecsJsonHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -262,6 +266,9 @@ public class EcsCfnProvisioner implements CfnResourceProvisioner {
|
||||
RegisterTaskDefinitionRequest request = new RegisterTaskDefinitionRequest();
|
||||
request.setFamily(family);
|
||||
request.setContainerDefinitions(parseContainerDefinitions(props.get("ContainerDefinitions"), ctx));
|
||||
JsonNode volumes = props.path("Volumes");
|
||||
request.setVolumes(ecsJsonHandler.parseVolumes(normalizeCfnEcsArray(volumes)));
|
||||
EcsJsonHandler.validateMountSources(request.getContainerDefinitions(), request.getVolumes());
|
||||
request.setNetworkMode(parseEnum(NetworkMode.class, ctx.resolveOptional(props, "NetworkMode")));
|
||||
request.setCpu(ctx.resolveOptional(props, "Cpu"));
|
||||
request.setMemory(ctx.resolveOptional(props, "Memory"));
|
||||
@@ -516,7 +523,7 @@ public class EcsCfnProvisioner implements CfnResourceProvisioner {
|
||||
() -> ecsService.deleteService(cluster, name, true, region), "ServiceNotFoundException");
|
||||
}
|
||||
|
||||
private static List<ContainerDefinition> parseContainerDefinitions(JsonNode node, ProvisionContext ctx) {
|
||||
private List<ContainerDefinition> parseContainerDefinitions(JsonNode node, ProvisionContext ctx) {
|
||||
List<ContainerDefinition> result = new ArrayList<>();
|
||||
if (node == null || node.isNull()) {
|
||||
return result;
|
||||
@@ -540,6 +547,7 @@ public class EcsCfnProvisioner implements CfnResourceProvisioner {
|
||||
def.setMemoryReservation(item.path("MemoryReservation").asInt());
|
||||
}
|
||||
def.setPortMappings(parsePortMappings(item.path("PortMappings")));
|
||||
def.setMountPoints(ecsJsonHandler.parseMountPoints(normalizeCfnEcsArray(item.path("MountPoints"))));
|
||||
def.setEnvironment(parseEnvironment(item.path("Environment")));
|
||||
def.setSecrets(parseSecrets(item.path("Secrets")));
|
||||
def.setLogConfiguration(parseLogConfiguration(item.path("LogConfiguration")));
|
||||
@@ -573,6 +581,49 @@ public class EcsCfnProvisioner implements CfnResourceProvisioner {
|
||||
optionalInt(node, "Timeout"), optionalInt(node, "Retries"), optionalInt(node, "StartPeriod"));
|
||||
}
|
||||
|
||||
private static ArrayNode normalizeCfnEcsArray(JsonNode node) {
|
||||
ArrayNode result = MAPPER.createArrayNode();
|
||||
if (node != null && node.isArray()) {
|
||||
node.forEach(item -> {
|
||||
if (item.isObject()) {
|
||||
result.add(normalizeCfnEcsNode(item));
|
||||
}
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static JsonNode normalizeCfnEcsNode(JsonNode node) {
|
||||
if (node.isObject()) {
|
||||
ObjectNode result = MAPPER.createObjectNode();
|
||||
node.fields().forEachRemaining(field -> {
|
||||
String key = field.getKey();
|
||||
JsonNode value = field.getValue();
|
||||
String apiKey = switch (key) {
|
||||
case "EFSVolumeConfiguration" -> "efsVolumeConfiguration";
|
||||
case "FSxWindowsFileServerVolumeConfiguration" -> "fsxWindowsFileServerVolumeConfiguration";
|
||||
case "S3FilesVolumeConfiguration" -> "s3filesVolumeConfiguration";
|
||||
case "FilesystemId" -> "fileSystemId";
|
||||
case "IAM" -> "iam";
|
||||
default -> key.isEmpty() ? key : Character.toLowerCase(key.charAt(0)) + key.substring(1);
|
||||
};
|
||||
if ("TransitEncryptionPort".equals(key) && value.isTextual()) {
|
||||
result.put(apiKey, value.asInt());
|
||||
} else {
|
||||
result.set(apiKey, "DriverOpts".equals(key) || "Labels".equals(key)
|
||||
? value.deepCopy() : normalizeCfnEcsNode(value));
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
if (node.isArray()) {
|
||||
ArrayNode result = MAPPER.createArrayNode();
|
||||
node.forEach(item -> result.add(normalizeCfnEcsNode(item)));
|
||||
return result;
|
||||
}
|
||||
return node.deepCopy();
|
||||
}
|
||||
|
||||
private static Integer optionalInt(JsonNode node, String member) {
|
||||
return node.hasNonNull(member) ? node.path(member).asInt() : null;
|
||||
}
|
||||
|
||||
@@ -302,6 +302,7 @@ public class EcsJsonHandler {
|
||||
? req.path("executionRoleArn").asText() : null);
|
||||
request.setRequiresCompatibilities(parseCompatibilities(req.path("requiresCompatibilities")));
|
||||
request.setVolumes(parseVolumes(req.path("volumes")));
|
||||
validateMountSources(request.getContainerDefinitions(), request.getVolumes());
|
||||
request.setRuntimePlatform(parseRuntimePlatform(req.path("runtimePlatform")));
|
||||
request.setEphemeralStorage(parseEphemeralStorage(req.path("ephemeralStorage")));
|
||||
request.setPidMode(parseChoice(req, "pidMode", PID_MODES));
|
||||
@@ -1493,12 +1494,13 @@ public class EcsJsonHandler {
|
||||
return new HealthCheck(command, interval, timeout, retries, startPeriod);
|
||||
}
|
||||
|
||||
private List<Volume> parseVolumes(JsonNode node) {
|
||||
public List<Volume> parseVolumes(JsonNode node) {
|
||||
List<Volume> result = new ArrayList<>();
|
||||
if (!node.isArray()) {
|
||||
return result;
|
||||
}
|
||||
for (JsonNode item : node) {
|
||||
validateVolume(item);
|
||||
String hostSourcePath = item.path("host").path("sourcePath").asText(null);
|
||||
if (hostSourcePath != null && !hostSourcePath.isBlank()) {
|
||||
hostVolumePolicy.validate(hostSourcePath);
|
||||
@@ -1513,6 +1515,61 @@ public class EcsJsonHandler {
|
||||
return result;
|
||||
}
|
||||
|
||||
private static void validateVolume(JsonNode item) {
|
||||
if (!item.isObject()) {
|
||||
return;
|
||||
}
|
||||
JsonNode efs = item.path("efsVolumeConfiguration");
|
||||
String name = item.path("name").asText(null);
|
||||
if ((efs.isObject() || item.path("s3filesVolumeConfiguration").isObject()
|
||||
|| item.path("configuredAtLaunch").asBoolean(false))
|
||||
&& (name == null || name.isBlank())) {
|
||||
throw new AwsException("InvalidParameterException",
|
||||
"EFS, S3 Files, and configured-at-launch volumes require a name.", 400);
|
||||
}
|
||||
if (efs.isObject()) {
|
||||
JsonNode authorization = efs.path("authorizationConfig");
|
||||
String accessPointId = authorization.path("accessPointId").asText(null);
|
||||
String transitEncryption = efs.path("transitEncryption").asText(null);
|
||||
String iam = authorization.path("iam").asText(null);
|
||||
if (((accessPointId != null && !accessPointId.isBlank()) || "ENABLED".equals(iam))
|
||||
&& !"ENABLED".equals(transitEncryption)) {
|
||||
throw new AwsException("InvalidParameterException",
|
||||
"Transit encryption must be ENABLED when EFS access point or IAM authorization is used.", 400);
|
||||
}
|
||||
}
|
||||
int configurationCount = efs.isObject() ? 1 : 0;
|
||||
for (String member : List.of("host", "dockerVolumeConfiguration",
|
||||
"fsxWindowsFileServerVolumeConfiguration", "s3filesVolumeConfiguration", "configuredAtLaunch")) {
|
||||
if (item.hasNonNull(member) && (!"configuredAtLaunch".equals(member) || item.path(member).asBoolean())) {
|
||||
configurationCount++;
|
||||
}
|
||||
}
|
||||
if (configurationCount > 1) {
|
||||
throw new AwsException("InvalidParameterException",
|
||||
"A task definition volume can specify only one volume configuration.", 400);
|
||||
}
|
||||
}
|
||||
|
||||
public static void validateMountSources(List<ContainerDefinition> containers, List<Volume> volumes) {
|
||||
if (containers == null) {
|
||||
return;
|
||||
}
|
||||
for (ContainerDefinition container : containers) {
|
||||
if (container.getMountPoints() == null) {
|
||||
continue;
|
||||
}
|
||||
for (MountPoint mount : container.getMountPoints()) {
|
||||
String source = mount.sourceVolume();
|
||||
if (source != null && !source.isBlank()
|
||||
&& (volumes == null || volumes.stream().noneMatch(volume -> source.equals(volume.name())))) {
|
||||
throw new AwsException("InvalidParameterException",
|
||||
"Mount point sourceVolume must reference a task definition volume: " + source, 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Volume members the parser consumes; the rest round-trips verbatim. */
|
||||
private static final Set<String> VOLUME_CONSUMED = Set.of("name", "efsVolumeConfiguration");
|
||||
|
||||
@@ -1548,7 +1605,7 @@ public class EcsJsonHandler {
|
||||
auth.path("iam").asText(null));
|
||||
}
|
||||
|
||||
private List<MountPoint> parseMountPoints(JsonNode node) {
|
||||
public List<MountPoint> parseMountPoints(JsonNode node) {
|
||||
List<MountPoint> result = new ArrayList<>();
|
||||
if (!node.isArray()) {
|
||||
return result;
|
||||
|
||||
@@ -139,7 +139,9 @@ import io.floci.aws.services.dynamodb.backend.NativeDynamoDbBackend;
|
||||
import io.floci.aws.services.ec2.Ec2Service;
|
||||
import io.floci.aws.services.ec2.FlowLogService;
|
||||
import io.floci.aws.services.ecr.EcrService;
|
||||
import io.floci.aws.services.ecs.EcsJsonHandler;
|
||||
import io.floci.aws.services.ecs.EcsService;
|
||||
import io.floci.aws.services.ecs.container.HostVolumePolicy;
|
||||
import io.floci.aws.services.efs.EfsService;
|
||||
import io.floci.aws.services.eks.EksService;
|
||||
import io.floci.aws.services.elasticache.ElastiCacheMemcachedService;
|
||||
@@ -181,6 +183,7 @@ import io.floci.aws.services.ssm.SsmService;
|
||||
import io.floci.aws.services.stepfunctions.StepFunctionsService;
|
||||
import io.floci.aws.services.transfer.TransferService;
|
||||
import io.floci.aws.services.wafv2.WafV2Service;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -425,7 +428,8 @@ final class CfnProvisionerFixture {
|
||||
}
|
||||
if (ecsService != null) {
|
||||
discovered.add(new EcsCapacityCfnProvisioner(ecsService));
|
||||
discovered.add(new EcsCfnProvisioner(ecsService));
|
||||
discovered.add(new EcsCfnProvisioner(ecsService, new EcsJsonHandler(ecsService,
|
||||
objectMapper, Mockito.mock(HostVolumePolicy.class))));
|
||||
}
|
||||
if (efsService != null) {
|
||||
discovered.add(new EfsCfnProvisioner(efsService));
|
||||
|
||||
+81
@@ -1,9 +1,12 @@
|
||||
package io.floci.aws.services.cloudformation;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import io.floci.aws.testing.CfnRequests;
|
||||
import io.floci.aws.testing.CfnStackWaits;
|
||||
import io.floci.aws.testing.RestAssuredJsonUtils;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import io.restassured.path.xml.XmlPath;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.List;
|
||||
@@ -31,6 +34,11 @@ class CloudFormationEfsIntegrationTest {
|
||||
private static final String CFN_AUTH =
|
||||
"AWS4-HMAC-SHA256 Credential=test/20260205/us-east-1/cloudformation/aws4_request";
|
||||
|
||||
@BeforeAll
|
||||
static void configureRestAssured() {
|
||||
RestAssuredJsonUtils.configureAwsContentTypes();
|
||||
}
|
||||
|
||||
private static String template(String fileSystemProperties, String mountTargetSecurityGroup) {
|
||||
return """
|
||||
{
|
||||
@@ -96,6 +104,79 @@ class CloudFormationEfsIntegrationTest {
|
||||
return Long.toString(System.nanoTime(), 36);
|
||||
}
|
||||
|
||||
@Test
|
||||
void ecsTaskDefinitionResolvesEfsVolumeAndPreservesMountPoints() throws Exception {
|
||||
String stackName = "cfn-efs-ecs-" + suffix();
|
||||
String family = stackName + "-td";
|
||||
createStack(stackName, """
|
||||
{
|
||||
"Resources": {
|
||||
"Files": {"Type": "AWS::EFS::FileSystem", "Properties": {}},
|
||||
"TaskDef": {
|
||||
"Type": "AWS::ECS::TaskDefinition",
|
||||
"Properties": {
|
||||
"Family": "%s",
|
||||
"ContainerDefinitions": [{
|
||||
"Name": "app", "Image": "busybox",
|
||||
"MountPoints": [
|
||||
{"SourceVolume": "shared", "ContainerPath": "/mnt/efs", "ReadOnly": true},
|
||||
{"SourceVolume": "scratch", "ContainerPath": "/tmp/work"}
|
||||
]
|
||||
}],
|
||||
"Volumes": [
|
||||
{"Name": "shared", "EFSVolumeConfiguration": {
|
||||
"FilesystemId": {"Ref": "Files"},
|
||||
"RootDirectory": "/",
|
||||
"TransitEncryption": "ENABLED"
|
||||
}},
|
||||
{"Name": "scratch"},
|
||||
{"Name": "docker", "DockerVolumeConfiguration": {
|
||||
"Driver": "local",
|
||||
"DriverOpts": {"MiXeDKey": "value"},
|
||||
"Labels": {"TeamName": "platform"}
|
||||
}}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"Outputs": {"FsId": {"Value": {"Ref": "Files"}}}
|
||||
}
|
||||
""".formatted(family));
|
||||
try {
|
||||
String fileSystemId = output(describe(stackName, CFN_AUTH), "FsId");
|
||||
JsonNode task = RestAssuredJsonUtils.awsActionJson("AmazonEC2ContainerServiceV20141113",
|
||||
"DescribeTaskDefinition", "{\"taskDefinition\":\"" + family + "\"}")
|
||||
.path("taskDefinition");
|
||||
|
||||
JsonNode volumes = task.path("volumes");
|
||||
assertEquals(3, volumes.size());
|
||||
assertEquals("shared", volumes.get(0).path("name").asText());
|
||||
assertEquals(fileSystemId, volumes.get(0).path("efsVolumeConfiguration")
|
||||
.path("fileSystemId").asText());
|
||||
assertEquals("/", volumes.get(0).path("efsVolumeConfiguration")
|
||||
.path("rootDirectory").asText());
|
||||
assertEquals("ENABLED", volumes.get(0).path("efsVolumeConfiguration")
|
||||
.path("transitEncryption").asText());
|
||||
assertEquals("scratch", volumes.get(1).path("name").asText());
|
||||
assertTrue(volumes.get(1).path("efsVolumeConfiguration").isMissingNode());
|
||||
JsonNode docker = volumes.get(2).path("dockerVolumeConfiguration");
|
||||
assertEquals("local", docker.path("driver").asText());
|
||||
assertEquals("value", docker.path("driverOpts").path("MiXeDKey").asText());
|
||||
assertEquals("platform", docker.path("labels").path("TeamName").asText());
|
||||
|
||||
JsonNode mountPoints = task.path("containerDefinitions").get(0).path("mountPoints");
|
||||
assertEquals(2, mountPoints.size());
|
||||
assertEquals("shared", mountPoints.get(0).path("sourceVolume").asText());
|
||||
assertEquals("/mnt/efs", mountPoints.get(0).path("containerPath").asText());
|
||||
assertTrue(mountPoints.get(0).path("readOnly").asBoolean());
|
||||
assertEquals("scratch", mountPoints.get(1).path("sourceVolume").asText());
|
||||
assertEquals("/tmp/work", mountPoints.get(1).path("containerPath").asText());
|
||||
assertTrue(mountPoints.get(1).path("readOnly").isMissingNode());
|
||||
} finally {
|
||||
CfnStackWaits.deleteStack(stackName, CFN_AUTH);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void createStackProvisionsTheThreeEfsTypesAndResolvesRefAndGetAtt() {
|
||||
String stackName = "cfn-efs-create-" + suffix();
|
||||
|
||||
+300
-1
@@ -7,7 +7,9 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import io.floci.aws.core.common.AwsException;
|
||||
import io.floci.aws.services.cloudformation.CloudFormationTemplateEngine;
|
||||
import io.floci.aws.services.cloudformation.model.StackResource;
|
||||
import io.floci.aws.services.ecs.EcsJsonHandler;
|
||||
import io.floci.aws.services.ecs.EcsService;
|
||||
import io.floci.aws.services.ecs.container.HostVolumePolicy;
|
||||
import io.floci.aws.services.ecs.model.CapacityProviderStrategyItem;
|
||||
import io.floci.aws.services.ecs.model.ClusterSetting;
|
||||
import io.floci.aws.services.ecs.model.ContainerDefinition;
|
||||
@@ -15,16 +17,20 @@ import io.floci.aws.services.ecs.model.CreateServiceRequest;
|
||||
import io.floci.aws.services.ecs.model.EcsCluster;
|
||||
import io.floci.aws.services.ecs.model.EcsLoadBalancer;
|
||||
import io.floci.aws.services.ecs.model.EcsServiceModel;
|
||||
import io.floci.aws.services.ecs.model.EfsVolumeConfiguration;
|
||||
import io.floci.aws.services.ecs.model.HealthCheck;
|
||||
import io.floci.aws.services.ecs.model.LaunchType;
|
||||
import io.floci.aws.services.ecs.model.MountPoint;
|
||||
import io.floci.aws.services.ecs.model.NetworkConfiguration;
|
||||
import io.floci.aws.services.ecs.model.NetworkMode;
|
||||
import io.floci.aws.services.ecs.model.RegisterTaskDefinitionRequest;
|
||||
import io.floci.aws.services.ecs.model.RuntimePlatform;
|
||||
import io.floci.aws.services.ecs.model.TaskDefinition;
|
||||
import io.floci.aws.services.ecs.model.UpdateServiceRequest;
|
||||
import io.floci.aws.services.ecs.model.Volume;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.CsvSource;
|
||||
import org.junit.jupiter.params.provider.NullSource;
|
||||
import org.junit.jupiter.params.provider.ValueSource;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
@@ -86,8 +92,10 @@ class EcsCfnProvisionerTest {
|
||||
List.of(new CapacityProviderStrategyItem("FARGATE", 2, 0));
|
||||
|
||||
private final EcsService ecs = mock(EcsService.class);
|
||||
private final EcsCfnProvisioner provisioner = new EcsCfnProvisioner(ecs);
|
||||
private final HostVolumePolicy hostVolumePolicy = mock(HostVolumePolicy.class);
|
||||
private final ObjectMapper mapper = new ObjectMapper();
|
||||
private final EcsCfnProvisioner provisioner = new EcsCfnProvisioner(ecs,
|
||||
new EcsJsonHandler(ecs, mapper, hostVolumePolicy));
|
||||
|
||||
private ProvisionContext ctx() {
|
||||
return ctx(null);
|
||||
@@ -222,6 +230,297 @@ class EcsCfnProvisionerTest {
|
||||
assertEquals("fluentbit", def.getFirelensConfiguration().type());
|
||||
}
|
||||
|
||||
@Test
|
||||
void taskDefinitionForwardsEfsHostAndEphemeralVolumes() {
|
||||
TaskDefinition td = new TaskDefinition();
|
||||
td.setTaskDefinitionArn(TASK_DEF_ARN);
|
||||
when(ecs.registerTaskDefinition(any(RegisterTaskDefinitionRequest.class), eq(REGION))).thenReturn(td);
|
||||
|
||||
ObjectNode props = mapper.createObjectNode().put("Family", "web");
|
||||
ArrayNode volumes = props.putArray("Volumes");
|
||||
ObjectNode efs = volumes.addObject().put("Name", "shared").putObject("EFSVolumeConfiguration");
|
||||
efs.put("FilesystemId", "fs-1234").put("RootDirectory", "/")
|
||||
.put("TransitEncryption", "ENABLED").put("TransitEncryptionPort", "2049");
|
||||
efs.putObject("AuthorizationConfig").put("AccessPointId", "fsap-1234").put("IAM", "ENABLED");
|
||||
volumes.addObject().put("Name", "host-data").putObject("Host").put("SourcePath", "/host/data");
|
||||
volumes.addObject().put("Name", "scratch");
|
||||
|
||||
provisioner.provision(resource("AWS::ECS::TaskDefinition", "TaskDef"), props, ctx());
|
||||
|
||||
assertEquals(List.of(
|
||||
new Volume("shared", null,
|
||||
new EfsVolumeConfiguration("fs-1234", "/", "ENABLED", 2049, "fsap-1234", "ENABLED")),
|
||||
new Volume("host-data", "/host/data", null,
|
||||
Map.of("host", Map.of("sourcePath", "/host/data"))),
|
||||
new Volume("scratch", null)), registered().getVolumes());
|
||||
verify(hostVolumePolicy).validate("/host/data");
|
||||
}
|
||||
|
||||
@Test
|
||||
void taskDefinitionRejectsDisallowedHostVolumeBeforeRegistering() {
|
||||
doThrow(new AwsException("InvalidParameterException", "host path denied", 400))
|
||||
.when(hostVolumePolicy).validate("/host/data");
|
||||
ObjectNode props = mapper.createObjectNode().put("Family", "web");
|
||||
props.putArray("Volumes").addObject().put("Name", "host-data")
|
||||
.putObject("Host").put("SourcePath", "/host/data");
|
||||
|
||||
AwsException failure = assertThrows(AwsException.class,
|
||||
() -> provisioner.provision(resource("AWS::ECS::TaskDefinition", "TaskDef"), props, ctx()));
|
||||
|
||||
assertEquals("host path denied", failure.getMessage());
|
||||
verifyNoInteractions(ecs);
|
||||
}
|
||||
|
||||
@Test
|
||||
void taskDefinitionRejectsEfsAccessPointWithNonDefaultRootBeforeRegistering() {
|
||||
ObjectNode props = mapper.createObjectNode().put("Family", "web");
|
||||
ObjectNode efs = props.putArray("Volumes").addObject().put("Name", "shared")
|
||||
.putObject("EFSVolumeConfiguration");
|
||||
efs.put("FilesystemId", "fs-1234").put("RootDirectory", "/data")
|
||||
.put("TransitEncryption", "ENABLED");
|
||||
efs.putObject("AuthorizationConfig").put("AccessPointId", "fsap-1234");
|
||||
|
||||
AwsException failure = assertThrows(AwsException.class,
|
||||
() -> provisioner.provision(resource("AWS::ECS::TaskDefinition", "TaskDef"), props, ctx()));
|
||||
|
||||
assertEquals("InvalidParameterException", failure.getErrorCode());
|
||||
assertEquals("Root directory must either be omitted or set to '/' when an EFS access point "
|
||||
+ "is specified in authorizationConfig.accessPointId.", failure.getMessage());
|
||||
verifyNoInteractions(ecs);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@CsvSource({"ACCESS_POINT,", "ACCESS_POINT,DISABLED", "IAM,", "IAM,DISABLED"})
|
||||
void taskDefinitionRejectsUnencryptedEfsAuthorization(String authorizationKind, String transitEncryption) {
|
||||
ObjectNode props = mapper.createObjectNode().put("Family", "web");
|
||||
ObjectNode efs = props.putArray("Volumes").addObject().put("Name", "shared")
|
||||
.putObject("EFSVolumeConfiguration");
|
||||
efs.put("FilesystemId", "fs-1234");
|
||||
if (transitEncryption != null) {
|
||||
efs.put("TransitEncryption", transitEncryption);
|
||||
}
|
||||
ObjectNode authorization = efs.putObject("AuthorizationConfig");
|
||||
if ("ACCESS_POINT".equals(authorizationKind)) {
|
||||
authorization.put("AccessPointId", "fsap-1234");
|
||||
} else {
|
||||
authorization.put("IAM", "ENABLED");
|
||||
}
|
||||
|
||||
AwsException failure = assertThrows(AwsException.class,
|
||||
() -> provisioner.provision(resource("AWS::ECS::TaskDefinition", "TaskDef"), props, ctx()));
|
||||
|
||||
assertEquals("InvalidParameterException", failure.getErrorCode());
|
||||
verifyNoInteractions(ecs);
|
||||
}
|
||||
|
||||
@Test
|
||||
void taskDefinitionRequiresNameForEfsVolume() {
|
||||
ObjectNode props = mapper.createObjectNode().put("Family", "web");
|
||||
props.putArray("Volumes").addObject().putObject("EFSVolumeConfiguration")
|
||||
.put("FilesystemId", "fs-1234");
|
||||
|
||||
AwsException failure = assertThrows(AwsException.class,
|
||||
() -> provisioner.provision(resource("AWS::ECS::TaskDefinition", "TaskDef"), props, ctx()));
|
||||
|
||||
assertEquals("InvalidParameterException", failure.getErrorCode());
|
||||
verifyNoInteractions(ecs);
|
||||
}
|
||||
|
||||
@Test
|
||||
void taskDefinitionRequiresNameForS3FilesVolume() {
|
||||
ObjectNode props = mapper.createObjectNode().put("Family", "web");
|
||||
props.putArray("Volumes").addObject().putObject("S3FilesVolumeConfiguration")
|
||||
.put("FileSystemArn", "arn:aws:s3:::files");
|
||||
|
||||
AwsException failure = assertThrows(AwsException.class,
|
||||
() -> provisioner.provision(resource("AWS::ECS::TaskDefinition", "TaskDef"), props, ctx()));
|
||||
|
||||
assertEquals("InvalidParameterException", failure.getErrorCode());
|
||||
verifyNoInteractions(ecs);
|
||||
}
|
||||
|
||||
@Test
|
||||
void taskDefinitionRequiresNameForConfiguredAtLaunchVolume() {
|
||||
ObjectNode props = mapper.createObjectNode().put("Family", "web");
|
||||
props.putArray("Volumes").addObject().put("ConfiguredAtLaunch", true);
|
||||
|
||||
AwsException failure = assertThrows(AwsException.class,
|
||||
() -> provisioner.provision(resource("AWS::ECS::TaskDefinition", "TaskDef"), props, ctx()));
|
||||
|
||||
assertEquals("InvalidParameterException", failure.getErrorCode());
|
||||
verifyNoInteractions(ecs);
|
||||
}
|
||||
|
||||
@Test
|
||||
void taskDefinitionRejectsConflictingVolumeConfigurations() {
|
||||
ObjectNode props = mapper.createObjectNode().put("Family", "web");
|
||||
ObjectNode volume = props.putArray("Volumes").addObject().put("Name", "shared");
|
||||
volume.putObject("Host").put("SourcePath", "/host/data");
|
||||
volume.putObject("EFSVolumeConfiguration").put("FilesystemId", "fs-1234");
|
||||
|
||||
AwsException failure = assertThrows(AwsException.class,
|
||||
() -> provisioner.provision(resource("AWS::ECS::TaskDefinition", "TaskDef"), props, ctx()));
|
||||
|
||||
assertEquals("InvalidParameterException", failure.getErrorCode());
|
||||
verifyNoInteractions(ecs);
|
||||
}
|
||||
|
||||
@Test
|
||||
void taskDefinitionRejectsLaunchConfiguredVolumeWithDockerConfiguration() {
|
||||
ObjectNode props = mapper.createObjectNode().put("Family", "web");
|
||||
props.putArray("Volumes").addObject().put("Name", "shared").put("ConfiguredAtLaunch", true)
|
||||
.putObject("DockerVolumeConfiguration").put("Driver", "local");
|
||||
|
||||
AwsException failure = assertThrows(AwsException.class,
|
||||
() -> provisioner.provision(resource("AWS::ECS::TaskDefinition", "TaskDef"), props, ctx()));
|
||||
|
||||
assertEquals("InvalidParameterException", failure.getErrorCode());
|
||||
verifyNoInteractions(ecs);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(strings = {"", " "})
|
||||
void taskDefinitionRequiresNonblankEfsFilesystemId(String fileSystemId) {
|
||||
ObjectNode props = mapper.createObjectNode().put("Family", "web");
|
||||
ObjectNode efs = props.putArray("Volumes").addObject().put("Name", "shared")
|
||||
.putObject("EFSVolumeConfiguration");
|
||||
efs.put("FilesystemId", fileSystemId);
|
||||
|
||||
AwsException failure = assertThrows(AwsException.class,
|
||||
() -> provisioner.provision(resource("AWS::ECS::TaskDefinition", "TaskDef"), props, ctx()));
|
||||
|
||||
assertEquals("InvalidParameterException", failure.getErrorCode());
|
||||
assertEquals("EFS volume configuration requires a fileSystemId.", failure.getMessage());
|
||||
verifyNoInteractions(ecs);
|
||||
}
|
||||
|
||||
@Test
|
||||
void taskDefinitionWithoutEfsFilesystemIdFailsShapeValidationBeforeRegistering() {
|
||||
ObjectNode props = mapper.createObjectNode().put("Family", "web");
|
||||
props.putArray("Volumes").addObject().put("Name", "shared")
|
||||
.putObject("EFSVolumeConfiguration");
|
||||
|
||||
AwsException failure = assertThrows(AwsException.class,
|
||||
() -> provisioner.provision(resource("AWS::ECS::TaskDefinition", "TaskDef"), props, ctx()));
|
||||
|
||||
assertEquals("InvalidRequest", failure.getErrorCode());
|
||||
assertTrue(failure.getMessage().contains("FilesystemId"));
|
||||
verifyNoInteractions(ecs);
|
||||
}
|
||||
|
||||
@Test
|
||||
void taskDefinitionForwardsReadOnlyMountPoint() {
|
||||
TaskDefinition td = new TaskDefinition();
|
||||
td.setTaskDefinitionArn(TASK_DEF_ARN);
|
||||
when(ecs.registerTaskDefinition(any(RegisterTaskDefinitionRequest.class), eq(REGION))).thenReturn(td);
|
||||
|
||||
ObjectNode props = mapper.createObjectNode().put("Family", "web");
|
||||
ArrayNode volumes = props.putArray("Volumes");
|
||||
volumes.addObject().put("Name", "shared");
|
||||
volumes.addObject().put("Name", "host-data");
|
||||
volumes.addObject().put("Name", "scratch");
|
||||
ArrayNode mountPoints = props.putArray("ContainerDefinitions").addObject()
|
||||
.put("Name", "app").put("Image", "nginx:1").putArray("MountPoints");
|
||||
mountPoints.addObject().put("SourceVolume", "shared")
|
||||
.put("ContainerPath", "/mnt/shared").put("ReadOnly", true);
|
||||
mountPoints.addObject().put("SourceVolume", "host-data")
|
||||
.put("ContainerPath", "/mnt/host").put("ReadOnly", "False");
|
||||
mountPoints.addObject().put("SourceVolume", "scratch").put("ContainerPath", "/scratch");
|
||||
|
||||
provisioner.provision(resource("AWS::ECS::TaskDefinition", "TaskDef"), props, ctx());
|
||||
|
||||
assertEquals(List.of(new MountPoint("shared", "/mnt/shared", true),
|
||||
new MountPoint("host-data", "/mnt/host", false),
|
||||
new MountPoint("scratch", "/scratch", null)),
|
||||
registeredContainer().getMountPoints());
|
||||
}
|
||||
|
||||
@Test
|
||||
void taskDefinitionRejectsMountFromUnknownVolume() {
|
||||
ObjectNode props = mapper.createObjectNode().put("Family", "web");
|
||||
props.putArray("Volumes").addObject().put("Name", "shared");
|
||||
props.putArray("ContainerDefinitions").addObject().put("Name", "app").put("Image", "nginx:1")
|
||||
.putArray("MountPoints").addObject().put("SourceVolume", "missing")
|
||||
.put("ContainerPath", "/mnt/data");
|
||||
|
||||
AwsException failure = assertThrows(AwsException.class,
|
||||
() -> provisioner.provision(resource("AWS::ECS::TaskDefinition", "TaskDef"), props, ctx()));
|
||||
|
||||
assertEquals("InvalidParameterException", failure.getErrorCode());
|
||||
verifyNoInteractions(ecs);
|
||||
}
|
||||
|
||||
@Test
|
||||
void taskDefinitionKeepsUnsupportedVolumeKindsForDescribeRoundTrip() {
|
||||
TaskDefinition td = new TaskDefinition();
|
||||
td.setTaskDefinitionArn(TASK_DEF_ARN);
|
||||
when(ecs.registerTaskDefinition(any(RegisterTaskDefinitionRequest.class), eq(REGION))).thenReturn(td);
|
||||
|
||||
ObjectNode props = mapper.createObjectNode().put("Family", "web");
|
||||
ArrayNode volumes = props.putArray("Volumes");
|
||||
ObjectNode docker = volumes.addObject().put("Name", "docker").put("ConfiguredAtLaunch", false)
|
||||
.putObject("DockerVolumeConfiguration");
|
||||
docker.put("Driver", "local").put("Autoprovision", true);
|
||||
docker.putObject("DriverOpts").put("type", "tmpfs");
|
||||
ObjectNode fsx = volumes.addObject().put("Name", "fsx")
|
||||
.putObject("FSxWindowsFileServerVolumeConfiguration");
|
||||
fsx.put("FileSystemId", "fs-5678").put("RootDirectory", "\\data");
|
||||
fsx.putObject("AuthorizationConfig").put("CredentialsParameter", "secret").put("Domain", "example.com");
|
||||
volumes.addObject().put("Name", "s3")
|
||||
.putObject("S3FilesVolumeConfiguration").put("FileSystemArn", "arn:aws:s3:::files");
|
||||
volumes.addObject().put("Name", "managed").put("ConfiguredAtLaunch", true);
|
||||
volumes.addObject().put("Name", "empty-host").putObject("Host");
|
||||
|
||||
provisioner.provision(resource("AWS::ECS::TaskDefinition", "TaskDef"), props, ctx());
|
||||
|
||||
List<Volume> parsed = registered().getVolumes();
|
||||
assertEquals(Map.of("configuredAtLaunch", false,
|
||||
"dockerVolumeConfiguration", Map.of("driver", "local", "autoprovision", true,
|
||||
"driverOpts", Map.of("type", "tmpfs"))), parsed.get(0).unparsed());
|
||||
assertEquals(Map.of("fsxWindowsFileServerVolumeConfiguration", Map.of("fileSystemId", "fs-5678",
|
||||
"rootDirectory", "\\data", "authorizationConfig", Map.of("credentialsParameter", "secret",
|
||||
"domain", "example.com"))), parsed.get(1).unparsed());
|
||||
assertEquals(Map.of("s3filesVolumeConfiguration", Map.of("fileSystemArn", "arn:aws:s3:::files")),
|
||||
parsed.get(2).unparsed());
|
||||
assertEquals(Map.of("configuredAtLaunch", true), parsed.get(3).unparsed());
|
||||
assertEquals(Map.of("host", Map.of()), parsed.get(4).unparsed());
|
||||
}
|
||||
|
||||
@Test
|
||||
void taskDefinitionPassesThroughUnknownVolumeMembers() {
|
||||
TaskDefinition td = new TaskDefinition();
|
||||
td.setTaskDefinitionArn(TASK_DEF_ARN);
|
||||
when(ecs.registerTaskDefinition(any(RegisterTaskDefinitionRequest.class), eq(REGION))).thenReturn(td);
|
||||
|
||||
ObjectNode props = mapper.createObjectNode().put("Family", "web");
|
||||
ObjectNode volume = props.putArray("Volumes").addObject().put("Name", "shared");
|
||||
volume.putObject("FutureVolumeOption").put("Mode", "durable");
|
||||
|
||||
provisioner.provision(resource("AWS::ECS::TaskDefinition", "TaskDef"), props, ctx());
|
||||
|
||||
assertEquals(Map.of("futureVolumeOption", Map.of("mode", "durable")),
|
||||
registered().getVolumes().get(0).unparsed());
|
||||
}
|
||||
|
||||
@Test
|
||||
void taskDefinitionPreservesCaseSensitiveDockerVolumeMapKeys() {
|
||||
TaskDefinition td = new TaskDefinition();
|
||||
td.setTaskDefinitionArn(TASK_DEF_ARN);
|
||||
when(ecs.registerTaskDefinition(any(RegisterTaskDefinitionRequest.class), eq(REGION))).thenReturn(td);
|
||||
|
||||
ObjectNode props = mapper.createObjectNode().put("Family", "web");
|
||||
ObjectNode docker = props.putArray("Volumes").addObject().put("Name", "docker")
|
||||
.putObject("DockerVolumeConfiguration");
|
||||
docker.putObject("DriverOpts").put("MiXeDKey", "value");
|
||||
docker.putObject("Labels").put("TeamName", "platform");
|
||||
|
||||
provisioner.provision(resource("AWS::ECS::TaskDefinition", "TaskDef"), props, ctx());
|
||||
|
||||
assertEquals(Map.of("dockerVolumeConfiguration", Map.of(
|
||||
"driverOpts", Map.of("MiXeDKey", "value"),
|
||||
"labels", Map.of("TeamName", "platform"))), registered().getVolumes().get(0).unparsed());
|
||||
}
|
||||
|
||||
/**
|
||||
* Measured (eu-west-1, 2026-10-19): the ECS handler converts text to the integers and booleans
|
||||
* its model declares, and a value it cannot convert fails the resource with its model
|
||||
|
||||
@@ -2,6 +2,7 @@ package io.floci.aws.services.ecs;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import io.floci.aws.config.EmulatorConfig;
|
||||
import io.floci.aws.core.common.AwsException;
|
||||
import io.floci.aws.core.common.Digests;
|
||||
@@ -14,6 +15,7 @@ import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.CsvSource;
|
||||
import org.junit.jupiter.params.provider.ValueSource;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -33,6 +35,7 @@ import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verifyNoInteractions;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
@@ -111,6 +114,88 @@ class EcsJsonHandlerVolumesTest {
|
||||
""".formatted(sourcePath.replace("\\", "\\\\"));
|
||||
}
|
||||
|
||||
private JsonNode registerRequestWithVolume(String volume) throws Exception {
|
||||
return objectMapper.readTree("""
|
||||
{"family":"invalid-volume","containerDefinitions":[{"name":"app","image":"busybox"}],
|
||||
"volumes":[%s]}
|
||||
""".formatted(volume));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(strings = {
|
||||
"{\"efsVolumeConfiguration\":{\"fileSystemId\":\"fs-1234\"}}",
|
||||
"{\"s3filesVolumeConfiguration\":{\"fileSystemArn\":\"arn:aws:s3:::files\"}}",
|
||||
"{\"configuredAtLaunch\":true}"
|
||||
})
|
||||
void registerTaskDefinitionRequiresNamesForConfiguredVolumes(String volume) throws Exception {
|
||||
AwsException error = assertThrows(AwsException.class,
|
||||
() -> handler.handle("RegisterTaskDefinition", registerRequestWithVolume(volume), "us-east-1"));
|
||||
assertEquals("InvalidParameterException", error.getErrorCode());
|
||||
verifyNoInteractions(service);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(strings = {
|
||||
"{\"name\":\"shared\",\"host\":{},\"efsVolumeConfiguration\":{\"fileSystemId\":\"fs-1234\"}}",
|
||||
"{\"name\":\"shared\",\"configuredAtLaunch\":true,\"dockerVolumeConfiguration\":{\"driver\":\"local\"}}"
|
||||
})
|
||||
void registerTaskDefinitionRejectsConflictingVolumeConfigurations(String volume) throws Exception {
|
||||
AwsException error = assertThrows(AwsException.class,
|
||||
() -> handler.handle("RegisterTaskDefinition", registerRequestWithVolume(volume), "us-east-1"));
|
||||
assertEquals("InvalidParameterException", error.getErrorCode());
|
||||
verifyNoInteractions(service);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@CsvSource({"ACCESS_POINT,", "ACCESS_POINT,DISABLED", "IAM,", "IAM,DISABLED"})
|
||||
void registerTaskDefinitionRequiresTransitEncryptionForEfsAuthorization(
|
||||
String authorizationKind, String transitEncryption) throws Exception {
|
||||
ObjectNode volume = objectMapper.createObjectNode().put("name", "shared");
|
||||
ObjectNode efs = volume.putObject("efsVolumeConfiguration").put("fileSystemId", "fs-1234");
|
||||
if (transitEncryption != null) {
|
||||
efs.put("transitEncryption", transitEncryption);
|
||||
}
|
||||
ObjectNode authorization = efs.putObject("authorizationConfig");
|
||||
if ("ACCESS_POINT".equals(authorizationKind)) {
|
||||
authorization.put("accessPointId", "fsap-1234");
|
||||
} else {
|
||||
authorization.put("iam", "ENABLED");
|
||||
}
|
||||
AwsException error = assertThrows(AwsException.class,
|
||||
() -> handler.handle("RegisterTaskDefinition", registerRequestWithVolume(volume.toString()), "us-east-1"));
|
||||
assertEquals("InvalidParameterException", error.getErrorCode());
|
||||
verifyNoInteractions(service);
|
||||
}
|
||||
|
||||
@Test
|
||||
void registerTaskDefinitionRejectsMountFromUnknownVolume() throws Exception {
|
||||
JsonNode request = objectMapper.readTree("""
|
||||
{"family":"unknown-mount","containerDefinitions":[{"name":"app","image":"busybox",
|
||||
"mountPoints":[{"sourceVolume":"missing","containerPath":"/data"}]}],
|
||||
"volumes":[{"name":"shared"}]}
|
||||
""");
|
||||
AwsException error = assertThrows(AwsException.class,
|
||||
() -> handler.handle("RegisterTaskDefinition", request, "us-east-1"));
|
||||
assertEquals("InvalidParameterException", error.getErrorCode());
|
||||
verifyNoInteractions(service);
|
||||
}
|
||||
|
||||
@Test
|
||||
void registerTaskDefinitionKeepsOptionalGenericVolumeAndMountMembers() throws Exception {
|
||||
JsonNode request = objectMapper.readTree("""
|
||||
{"family":"optional-volume-members","containerDefinitions":[{"name":"app","image":"busybox",
|
||||
"mountPoints":[{"containerPath":"/data"}]}],
|
||||
"volumes":[{}, {"name":"docker","configuredAtLaunch":false,
|
||||
"dockerVolumeConfiguration":{"driver":"local"}}]}
|
||||
""");
|
||||
|
||||
Response response = handler.handle("RegisterTaskDefinition", request, "us-east-1");
|
||||
|
||||
JsonNode taskDefinition = objectMapper.valueToTree(response.getEntity()).path("taskDefinition");
|
||||
assertEquals(2, taskDefinition.path("volumes").size());
|
||||
assertEquals("docker", taskDefinition.path("volumes").get(1).path("name").asText());
|
||||
}
|
||||
|
||||
@Test
|
||||
void registerTaskDefinitionRoundTripsVolumesAndMountPoints() throws Exception {
|
||||
// This test is about JSON round-trip fidelity, not host-volume safety, so opt out of
|
||||
@@ -306,6 +391,7 @@ class EcsJsonHandlerVolumesTest {
|
||||
"efsVolumeConfiguration": {
|
||||
"fileSystemId": "fs-0123456789abcdef0",
|
||||
"rootDirectory": "/dps",
|
||||
"transitEncryption": "ENABLED",
|
||||
"authorizationConfig": {"accessPointId": "fsap-0abc"}
|
||||
}
|
||||
}
|
||||
@@ -338,6 +424,7 @@ class EcsJsonHandlerVolumesTest {
|
||||
"name": "customer-data",
|
||||
"efsVolumeConfiguration": {
|
||||
"fileSystemId": "fs-0123456789abcdef0",
|
||||
"transitEncryption": "ENABLED",
|
||||
"authorizationConfig": {"accessPointId": "fsap-0abc"}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,7 +287,6 @@ AWS::ECS::TaskDefinition PlacementConstraints accepted and ignored
|
||||
AWS::ECS::TaskDefinition ProxyConfiguration accepted and ignored
|
||||
AWS::ECS::TaskDefinition Tags accepted and ignored
|
||||
AWS::ECS::TaskDefinition TrustedExecutionConfiguration accepted and ignored
|
||||
AWS::ECS::TaskDefinition Volumes accepted and ignored
|
||||
AWS::EFS::FileSystem BypassPolicyLockoutSafetyCheck Floci's EFS service applies a file system policy without a lockout check, so there is nothing to bypass
|
||||
AWS::EFS::FileSystem ReplicationConfiguration not modeled: Floci has no EFS replication, so the destination file system is not created
|
||||
AWS::EKS::Cluster AccessConfig accepted and ignored
|
||||
|
||||
|
Reference in new issue
Block a user