Skip to content

Commit

Permalink
Merge pull request #74 from buildkite-plugins/toote_update_plugin_tester
Browse files Browse the repository at this point in the history
Update plugin tester
  • Loading branch information
pzeballos authored Sep 16, 2022
2 parents 1ddab88 + f7453a4 commit a494eec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: '2'
services:
tests:
image: buildkite/plugin-tester:latest@sha256:1127b5348c5c13e13a7558d64df16b5901e89579f98921458a3bba2bd7b06508
image: buildkite/plugin-tester:v3.0.0
volumes:
- ".:/plugin:ro"
18 changes: 9 additions & 9 deletions tests/command.bats
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ expected_container_definition='[\n {\n "essential": true,\n "image": "hel
export BUILDKITE_PLUGIN_ECS_DEPLOY_TASK_DEFINITION=examples/hello-world.json

stub aws \
"ecs register-task-definition --family hello-world --container-definitions '\'$expected_container_definition\'' : echo '{\"taskDefinition\":{\"revision\":1}}'" \
"ecs register-task-definition --family hello-world --container-definitions $'${expected_container_definition}' : echo '{\"taskDefinition\":{\"revision\":1}}'" \
"ecs describe-services --cluster my-cluster --service my-service --query 'services[?status==\`ACTIVE\`].status' --output text : echo '1'" \
"ecs describe-services --cluster my-cluster --services my-service --query 'services[?status==\`ACTIVE\`]' : echo 'null'" \
"ecs update-service --cluster my-cluster --service my-service --task-definition hello-world:1 : echo ok" \
Expand Down Expand Up @@ -54,10 +54,10 @@ expected_container_definition='[\n {\n "essential": true,\n "image": "hel
export BUILDKITE_PLUGIN_ECS_DEPLOY_IMAGE_1=hello-world:alpacas
export BUILDKITE_PLUGIN_ECS_DEPLOY_TASK_DEFINITION=examples/multiple-images.json

expected_container_definition='[\n {\n "essential": true,\n "image": "hello-world:llamas",\n "memory": 100,\n "name": "sample",\n "portMappings": [\n {\n "containerPort": 80,\n "hostPort": 80\n }\n ]\n },\n {\n "essential": true,\n "image": "hello-world:alpacas",\n "memory": 100,\n "name": "sample",\n "portMappings": [\n {\n "containerPort": 80,\n "hostPort": 80\n }\n ]\n }\n]'
expected_multiple_container_definition='[\n {\n "essential": true,\n "image": "hello-world:llamas",\n "memory": 100,\n "name": "sample",\n "portMappings": [\n {\n "containerPort": 80,\n "hostPort": 80\n }\n ]\n },\n {\n "essential": true,\n "image": "hello-world:alpacas",\n "memory": 100,\n "name": "sample",\n "portMappings": [\n {\n "containerPort": 80,\n "hostPort": 80\n }\n ]\n }\n]'

stub aws \
"ecs register-task-definition --family hello-world --container-definitions '\'$expected_container_definition\'' : echo '{\"taskDefinition\":{\"revision\":1}}'" \
"ecs register-task-definition --family hello-world --container-definitions $'$expected_multiple_container_definition' : echo '{\"taskDefinition\":{\"revision\":1}}'" \
"ecs describe-services --cluster my-cluster --service my-service --query 'services[?status==\`ACTIVE\`].status' --output text : echo '1'" \
"ecs describe-services --cluster my-cluster --services my-service --query 'services[?status==\`ACTIVE\`]' : echo 'null'" \
"ecs update-service --cluster my-cluster --service my-service --task-definition hello-world:1 : echo ok" \
Expand Down Expand Up @@ -86,7 +86,7 @@ expected_container_definition='[\n {\n "essential": true,\n "image": "hel
export BUILDKITE_PLUGIN_ECS_DEPLOY_TASK_DEFINITION=examples/hello-world.json

stub aws \
"ecs register-task-definition --family hello-world --container-definitions '\'$expected_container_definition\'' : echo '{\"taskDefinition\":{\"revision\":1}}'" \
"ecs register-task-definition --family hello-world --container-definitions $'$expected_container_definition' : echo '{\"taskDefinition\":{\"revision\":1}}'" \
"ecs describe-services --cluster my-cluster --service my-service --query 'services[?status==\`ACTIVE\`].status' --output text : echo -n ''" \
"ecs create-service --cluster my-cluster --service-name my-service --task-definition hello-world:1 --desired-count 1 --deployment-configuration maximumPercent=200,minimumHealthyPercent=100 : echo -n ''" \
"ecs describe-services --cluster my-cluster --services my-service --query 'services[?status==\`ACTIVE\`]' : echo 'null'" \
Expand Down Expand Up @@ -117,7 +117,7 @@ expected_container_definition='[\n {\n "essential": true,\n "image": "hel
export BUILDKITE_PLUGIN_ECS_DEPLOY_TASK_ROLE_ARN=arn:aws:iam::012345678910:role/world

stub aws \
"ecs register-task-definition --family hello-world --container-definitions '\'$expected_container_definition\'' --task-role-arn arn:aws:iam::012345678910:role/world : echo '{\"taskDefinition\":{\"revision\":1}}'" \
"ecs register-task-definition --family hello-world --container-definitions $'$expected_container_definition' --task-role-arn arn:aws:iam::012345678910:role/world : echo '{\"taskDefinition\":{\"revision\":1}}'" \
"ecs describe-services --cluster my-cluster --service my-service --query 'services[?status==\`ACTIVE\`].status' --output text : echo '1'" \
"ecs describe-services --cluster my-cluster --services my-service --query 'services[?status==\`ACTIVE\`]' : echo 'null'" \
"ecs update-service --cluster my-cluster --service my-service --task-definition hello-world:1 : echo ok" \
Expand Down Expand Up @@ -151,7 +151,7 @@ expected_container_definition='[\n {\n "essential": true,\n "image": "hel
alb_config='[{"loadBalancers":[{"containerName":"nginx","containerPort":80,"targetGroupArn":"arn:aws:elasticloadbalancing:us-east-1:012345678910:targetgroup/alb/e987e1234cd12abc"}]}]'

stub aws \
"ecs register-task-definition --family hello-world --container-definitions '\'$expected_container_definition\'' : echo '{\"taskDefinition\":{\"revision\":1}}'" \
"ecs register-task-definition --family hello-world --container-definitions $'$expected_container_definition' : echo '{\"taskDefinition\":{\"revision\":1}}'" \
"ecs describe-services --cluster my-cluster --service my-service --query 'services[?status==\`ACTIVE\`].status' --output text : echo -n ''" \
"ecs create-service --cluster my-cluster --service-name my-service --task-definition hello-world:1 --desired-count 1 --deployment-configuration maximumPercent=200,minimumHealthyPercent=100 --load-balancers targetGroupArn=arn:aws:elasticloadbalancing:us-east-1:012345678910:targetgroup/alb/e987e1234cd12abc,containerName=nginx,containerPort=80 : echo -n ''" \
"ecs describe-services --cluster my-cluster --services my-service --query 'services[?status==\`ACTIVE\`]' : echo '$alb_config'" \
Expand Down Expand Up @@ -185,7 +185,7 @@ expected_container_definition='[\n {\n "essential": true,\n "image": "hel
export BUILDKITE_PLUGIN_ECS_DEPLOY_TARGET_CONTAINER_PORT=80

stub aws \
"ecs register-task-definition --family hello-world --container-definitions '\'$expected_container_definition\'' : echo '{\"taskDefinition\":{\"revision\":1}}'" \
"ecs register-task-definition --family hello-world --container-definitions $'$expected_container_definition' : echo '{\"taskDefinition\":{\"revision\":1}}'" \
"ecs describe-services --cluster my-cluster --service my-service --query 'services[?status==\`ACTIVE\`].status' --output text : echo -n ''" \
"ecs create-service --cluster my-cluster --service-name my-service --task-definition hello-world:1 --desired-count 1 --deployment-configuration maximumPercent=200,minimumHealthyPercent=100 --load-balancers loadBalancerName=nginx-elb,containerName=nginx,containerPort=80 : echo -n ''" \
"ecs describe-services --cluster my-cluster --services my-service --query 'services[?status==\`ACTIVE\`]' : echo '[{\"loadBalancers\":[{\"loadBalancerName\": \"nginx-elb\",\"containerName\": \"nginx\",\"containerPort\": 80}]}]'" \
Expand Down Expand Up @@ -217,7 +217,7 @@ expected_container_definition='[\n {\n "essential": true,\n "image": "hel
export BUILDKITE_PLUGIN_ECS_DEPLOY_EXECUTION_ROLE=arn:aws:iam::012345678910:role/world

stub aws \
"ecs register-task-definition --family hello-world --container-definitions '\'$expected_container_definition\'' : echo '{\"taskDefinition\":{\"revision\":1}}'" \
"ecs register-task-definition --family hello-world --container-definitions $'$expected_container_definition' --execution-role-arn arn:aws:iam::012345678910:role/world : echo '{\"taskDefinition\":{\"revision\":1}}'" \
"ecs describe-services --cluster my-cluster --service my-service --query 'services[?status==\`ACTIVE\`].status' --output text : echo '1'" \
"ecs describe-services --cluster my-cluster --services my-service --query 'services[?status==\`ACTIVE\`]' : echo 'null'" \
"ecs update-service --cluster my-cluster --service my-service --task-definition hello-world:1 : echo ok" \
Expand Down Expand Up @@ -247,7 +247,7 @@ expected_container_definition='[\n {\n "essential": true,\n "image": "hel
export BUILDKITE_PLUGIN_ECS_DEPLOY_DEPLOYMENT_CONFIGURATION="0/100"

stub aws \
"ecs register-task-definition --family hello-world --container-definitions '\'$expected_container_definition\'' : echo '{\"taskDefinition\":{\"revision\":1}}'" \
"ecs register-task-definition --family hello-world --container-definitions $'$expected_container_definition' : echo '{\"taskDefinition\":{\"revision\":1}}'" \
"ecs describe-services --cluster my-cluster --service my-service --query 'services[?status==\`ACTIVE\`].status' --output text : echo -n ''" \
"ecs create-service --cluster my-cluster --service-name my-service --task-definition hello-world:1 --desired-count 1 --deployment-configuration maximumPercent=100,minimumHealthyPercent=0 : echo -n ''" \
"ecs describe-services --cluster my-cluster --services my-service --query 'services[?status==\`ACTIVE\`]' : echo 'null'" \
Expand Down

0 comments on commit a494eec

Please sign in to comment.