diff options
author | Deepakkothandan <deepak.kdy@gmail.com> | 2018-06-19 14:46:40 +0200 |
---|---|---|
committer | Sloane Hertel <shertel@redhat.com> | 2018-06-19 08:46:40 -0400 |
commit | 5a72eef0a30344ad5fcafbd3e95754edf6bbcde5 (patch) | |
tree | b8539b6f48323aef2c6faa3da25b959c77dc117f /test/integration/targets | |
parent | 14598ab3e2031c6e3ff5269ef50455dce5ab8bcc (diff) | |
download | ansible-5a72eef0a30344ad5fcafbd3e95754edf6bbcde5.tar.gz |
[ecs_service] fix assign_public ip for network configuration (#41685)
* fix assign_public ip for ecs_service
* used module.botocore_at_least instead of distutils
Diffstat (limited to 'test/integration/targets')
-rw-r--r-- | test/integration/targets/ecs_cluster/playbooks/network_assign_public_ip_fail.yml | 129 | ||||
-rwxr-xr-x | test/integration/targets/ecs_cluster/runme.sh | 7 |
2 files changed, 136 insertions, 0 deletions
diff --git a/test/integration/targets/ecs_cluster/playbooks/network_assign_public_ip_fail.yml b/test/integration/targets/ecs_cluster/playbooks/network_assign_public_ip_fail.yml new file mode 100644 index 0000000000..92352bba85 --- /dev/null +++ b/test/integration/targets/ecs_cluster/playbooks/network_assign_public_ip_fail.yml @@ -0,0 +1,129 @@ +- hosts: localhost + connection: local + vars: + resource_prefix: 'ansible-testing' + + tasks: + - block: + - name: set up aws connection info + set_fact: + aws_connection_info: &aws_connection_info + aws_access_key: "{{ aws_access_key }}" + aws_secret_key: "{{ aws_secret_key }}" + security_token: "{{ security_token }}" + region: "{{ aws_region }}" + no_log: True + + - name: create ecs cluster + ecs_cluster: + name: "{{ resource_prefix }}" + state: present + <<: *aws_connection_info + + - name: create ecs_taskdefinition with bridged network + ecs_taskdefinition: + containers: + - name: my_container + image: ubuntu + memory: 128 + family: "{{ resource_prefix }}" + state: present + network_mode: bridge + <<: *aws_connection_info + register: ecs_taskdefinition_creation + + - name: create ecs_taskdefinition with awsvpc network + ecs_taskdefinition: + containers: + - name: my_container + image: ubuntu + memory: 128 + family: "{{ resource_prefix }}-vpc" + state: present + network_mode: awsvpc + <<: *aws_connection_info + register: ecs_taskdefinition_creation_vpc + + - name: ecs_taskdefinition works fine even when older botocore is used + assert: + that: + - ecs_taskdefinition_creation_vpc.changed + + - name: create ecs_service using awsvpc network_configuration + ecs_service: + name: "{{ resource_prefix }}-vpc" + cluster: "{{ resource_prefix }}" + task_definition: "{{ resource_prefix }}-vpc" + desired_count: 1 + network_configuration: + subnets: + - subnet-abcd1234 + groups: + - sg-abcd1234 + assign_public_ip: true + state: present + <<: *aws_connection_info + register: ecs_service_creation_vpc + ignore_errors: yes + + - name: check that graceful failure message is returned from ecs_service + assert: + that: + - ecs_service_creation_vpc.failed + - 'ecs_service_creation_vpc.msg == "botocore needs to be version 1.8.4 or higher to use assign_public_ip in network_configuration"' + + always: + - name: scale down ecs service + ecs_service: + name: "{{ resource_prefix }}" + cluster: "{{ resource_prefix }}" + task_definition: "{{ resource_prefix }}" + desired_count: 0 + state: present + <<: *aws_connection_info + ignore_errors: yes + + - name: pause to wait for scale down + pause: + seconds: 30 + + - name: remove ecs service + ecs_service: + name: "{{ resource_prefix }}" + cluster: "{{ resource_prefix }}" + task_definition: "{{ resource_prefix }}" + desired_count: 1 + state: absent + <<: *aws_connection_info + ignore_errors: yes + + - name: remove ecs task definition + ecs_taskdefinition: + containers: + - name: my_container + image: ubuntu + memory: 128 + family: "{{ resource_prefix }}" + revision: "{{ ecs_taskdefinition_creation.taskdefinition.revision }}" + state: absent + <<: *aws_connection_info + ignore_errors: yes + + - name: remove ecs task definition vpc + ecs_taskdefinition: + containers: + - name: my_container + image: ubuntu + memory: 128 + family: "{{ resource_prefix }}-vpc" + revision: "{{ ecs_taskdefinition_creation_vpc.taskdefinition.revision }}" + state: absent + <<: *aws_connection_info + ignore_errors: yes + + - name: remove ecs cluster + ecs_cluster: + name: "{{ resource_prefix }}" + state: absent + <<: *aws_connection_info + ignore_errors: yes diff --git a/test/integration/targets/ecs_cluster/runme.sh b/test/integration/targets/ecs_cluster/runme.sh index 000334cc71..aebbb5e412 100755 --- a/test/integration/targets/ecs_cluster/runme.sh +++ b/test/integration/targets/ecs_cluster/runme.sh @@ -18,6 +18,13 @@ source "${MYTMPDIR}/botocore-1.7.40/bin/activate" $PYTHON -m pip install 'botocore<=1.7.40' boto3 ansible-playbook -i ../../inventory -e @../../integration_config.yml -e @../../cloud-config-aws.yml -v playbooks/network_fail.yml "$@" +# Test graceful failure for assign public ip +# applies for botocore >= 1.7.44 and < 1.8.4 +virtualenv --system-site-packages --python "${PYTHON}" "${MYTMPDIR}/botocore-1.7.44" +source "${MYTMPDIR}/botocore-1.7.44/bin/activate" +$PYTHON -m pip install 'botocore>=1.7.44,<1.8.4' boto3 +ansible-playbook -i ../../inventory -e @../../integration_config.yml -e @../../cloud-config-aws.yml -v playbooks/network_assign_public_ip_fail.yml "$@" + # Run full test suite virtualenv --system-site-packages --python "${PYTHON}" "${MYTMPDIR}/botocore-recent" source "${MYTMPDIR}/botocore-recent/bin/activate" |