Fix missing properties when ecs:TaskDefinition created via CloudFormation (#3378)
There's a larger problem here that needs a more generalized solution, but this solves the immediate issue with a minimum amount of code. Closes #3171
This commit is contained in:
parent
fe361f861d
commit
ea19466c38
3 changed files with 58 additions and 4 deletions
|
|
@ -2,6 +2,8 @@ import boto3
|
|||
import json
|
||||
from copy import deepcopy
|
||||
from moto import mock_cloudformation, mock_ecs
|
||||
from moto.core.utils import pascal_to_camelcase, remap_nested_keys
|
||||
import sure # noqa
|
||||
|
||||
|
||||
@mock_ecs
|
||||
|
|
@ -231,9 +233,16 @@ def test_create_task_definition_through_cloudformation():
|
|||
"Cpu": "200",
|
||||
"Memory": "500",
|
||||
"Essential": "true",
|
||||
"PortMappings": [
|
||||
{
|
||||
"ContainerPort": 123,
|
||||
"HostPort": 123,
|
||||
"Protocol": "tcp",
|
||||
},
|
||||
],
|
||||
}
|
||||
],
|
||||
"Volumes": [],
|
||||
"Volumes": [{"Name": "ecs-vol"}],
|
||||
},
|
||||
}
|
||||
},
|
||||
|
|
@ -252,3 +261,14 @@ def test_create_task_definition_through_cloudformation():
|
|||
StackName=stack_name, LogicalResourceId="testTaskDefinition"
|
||||
)["StackResourceDetail"]
|
||||
task_definition_details["PhysicalResourceId"].should.equal(task_definition_arn)
|
||||
|
||||
task_definition = ecs_conn.describe_task_definition(
|
||||
taskDefinition=task_definition_arn
|
||||
).get("taskDefinition")
|
||||
expected_properties = remap_nested_keys(
|
||||
template["Resources"]["testTaskDefinition"]["Properties"], pascal_to_camelcase
|
||||
)
|
||||
task_definition["volumes"].should.equal(expected_properties["volumes"])
|
||||
task_definition["containerDefinitions"].should.equal(
|
||||
expected_properties["containerDefinitions"]
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue