Skip to content

Commit 05940dd

Browse files
committed
fix broken test and remove redundant attributes
1 parent db1c86e commit 05940dd

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

ecs-deploy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ function createNewTaskDefJson() {
392392

393393
# Some options in task definition should only be included in new definition if present in
394394
# current definition. If found in current definition, append to JQ filter.
395-
CONDITIONAL_OPTIONS=(networkMode taskRoleArn placementConstraints executionRoleArn runtimePlatform ephemeralStorage proxyConfiguration memory cpu)
395+
CONDITIONAL_OPTIONS=(networkMode taskRoleArn placementConstraints executionRoleArn runtimePlatform ephemeralStorage proxyConfiguration cpu memory)
396396
for i in "${CONDITIONAL_OPTIONS[@]}"; do
397397
if echo "$DEF" | jq --exit-status --arg key "$i" 'has($key)' >/dev/null; then
398398
NEW_DEF_JQ_FILTER="${NEW_DEF_JQ_FILTER}, ${i}: .${i}"
@@ -402,7 +402,7 @@ function createNewTaskDefJson() {
402402
# Updated jq filters for AWS Fargate
403403
REQUIRES_COMPATIBILITIES=$(echo "${DEF}" | jq -r '. | select(.requiresCompatibilities != null) | .requiresCompatibilities[]')
404404
if `echo ${REQUIRES_COMPATIBILITIES[@]} | grep -q "FARGATE"`; then
405-
FARGATE_JQ_FILTER='requiresCompatibilities: .requiresCompatibilities, cpu: .cpu, memory: .memory'
405+
FARGATE_JQ_FILTER='requiresCompatibilities: .requiresCompatibilities'
406406

407407
if [[ ! "$NEW_DEF_JQ_FILTER" =~ ".*executionRoleArn.*" ]]; then
408408
FARGATE_JQ_FILTER="${FARGATE_JQ_FILTER}, executionRoleArn: .executionRoleArn"

test.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ EOF
407407
}
408408
EOF
409409
)
410-
expected='{ "family": "app-task-def", "volumes": [], "containerDefinitions": [ { "environment": [ { "name": "KEY", "value": "value" } ], "name": "API", "links": [], "mountPoints": [], "image": "121212345678.dkr.ecr.us-east-1.amazonaws.com/acct/repo:1111111111", "essential": true, "portMappings": [ { "protocol": "tcp", "containerPort": 80, "hostPort": 10080 } ], "entryPoint": [], "memory": 128, "command": [ "/data/run.sh" ], "cpu": 200, "volumesFrom": [] } ], "placementConstraints": null, "networkMode": "awsvpc", "executionRoleArn": "arn:aws:iam::121212345678:role/ecsTaskExecutionRole", "requiresCompatibilities": [ "FARGATE" ], "cpu": "256", "memory": "512" }'
410+
expected='{ "family": "app-task-def", "volumes": [], "containerDefinitions": [ { "environment": [ { "name": "KEY", "value": "value" } ], "name": "API", "links": [], "mountPoints": [], "image": "121212345678.dkr.ecr.us-east-1.amazonaws.com/acct/repo:1111111111", "essential": true, "portMappings": [ { "protocol": "tcp", "containerPort": 80, "hostPort": 10080 } ], "entryPoint": [], "memory": 128, "command": [ "/data/run.sh" ], "cpu": 200, "volumesFrom": [] } ], "placementConstraints": null, "networkMode": "awsvpc", "executionRoleArn": "arn:aws:iam::121212345678:role/ecsTaskExecutionRole", "cpu": "256", "memory": "512", "requiresCompatibilities": [ "FARGATE" ] }'
411411
run createNewTaskDefJson
412412
[ ! -z $status ]
413413
[ "$(echo "$output" | jq .)" == "$(echo "$expected" | jq .)" ]

0 commit comments

Comments
 (0)