6dfd64ff3c
The mocked response for ECS RegisterTaskDefinition has drifted from what actually returns when run against a real ECS endpoint. I created a minimal task definition for both EC2: ``` >>> ecs.register_task_definition( family="moto", containerDefinitions=[ { "name": "hello_world", "image": "hello-world:latest", "memory": 400 } ] )["taskDefinition"] {'taskDefinitionArn': 'arn:aws:ecs:us-east-1:************:task-definition/moto:1', 'containerDefinitions': [{'name': 'hello_world', 'image': 'hello-world:latest', 'cpu': 0, 'memory': 400, 'portMappings': [], 'essential': True, 'environment': [], 'mountPoints': [], 'volumesFrom': []}], 'family': 'moto', 'revision': 1, 'volumes': [], 'status': 'ACTIVE', 'placementConstraints': [], 'compatibilities': ['EC2']} ``` and FARGATE: ``` >>> ecs.register_task_definition( family="moto", containerDefinitions=[ { "name": "hello_world", "image": "hello-world:latest", "memory": 400 } ], requiresCompatibilities=["FARGATE"], networkMode="awsvpc", cpu="256", memory="512" )["taskDefinition"] {'taskDefinitionArn': 'arn:aws:ecs:us-east-1:************:task-definition/moto:2', 'containerDefinitions': [{'name': 'hello_world', 'image': 'hello-world:latest', 'cpu': 0, 'memory': 400, 'portMappings': [], 'essential': True, 'environment': [], 'mountPoints': [], 'volumesFrom': []}], 'family': 'moto', 'networkMode': 'awsvpc', 'revision': 2, 'volumes': [], 'status': 'ACTIVE', 'requiresAttributes': [{'name': 'com.amazonaws.ecs.capability.docker-remote-api.1.18'}, {'name': 'ecs.capability.task-eni'}], 'placementConstraints': [], 'compatibilities': ['EC2', 'FARGATE'], 'requiresCompatibilities': ['FARGATE'], 'cpu': '256', 'memory': '512'} ``` This change adds several default keys to the task based on those two real responses and the AWS documentation: https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_RegisterTaskDefinition.html The mock still doesn't match the real response exactly but it's much closer than it was before. |
||
---|---|---|
.. | ||
__init__.py | ||
test_ecs_boto3.py | ||
test_ecs_cloudformation.py |