Skip to content

Commit

Permalink
move test_multiple_actions_fail.yml inside full_test so we don't need…
Browse files Browse the repository at this point in the history
… to run the prep work twice
  • Loading branch information
tremble committed Mar 10, 2021
1 parent 991d264 commit e2d979e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 220 deletions.
66 changes: 10 additions & 56 deletions tests/integration/targets/elb_application_lb/tasks/full_test.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,21 @@
- name: elb_application_lb full_test
block:
# Setup
- name: create VPC
ec2_vpc_net:
aws_access_key: '{{ aws_access_key }}'
aws_secret_key: '{{ aws_secret_key }}'
security_token: '{{ security_token }}'
region: '{{ aws_region }}'
cidr_block: 10.228.228.0/22
name: '{{ resource_prefix }}_vpc'
state: present
register: vpc
- name: create internet gateway
ec2_vpc_igw:
aws_access_key: '{{ aws_access_key }}'
aws_secret_key: '{{ aws_secret_key }}'
security_token: '{{ security_token }}'
region: '{{ aws_region }}'
vpc_id: '{{ vpc.vpc.id }}'
state: present
tags:
Name: '{{ resource_prefix }}'
register: igw
- name: create public subnet
ec2_vpc_subnet:
aws_access_key: '{{ aws_access_key }}'
aws_secret_key: '{{ aws_secret_key }}'
security_token: '{{ security_token }}'
region: '{{ aws_region }}'
cidr: '{{ item.cidr }}'
az: '{{ aws_region}}{{ item.az }}'
vpc_id: '{{ vpc.vpc.id }}'
Expand All @@ -49,10 +38,6 @@
public: 'False'
register: subnets
- ec2_vpc_subnet_info:
aws_access_key: '{{ aws_access_key }}'
aws_secret_key: '{{ aws_secret_key }}'
security_token: '{{ security_token }}'
region: '{{ aws_region }}'
filters:
vpc-id: '{{ vpc.vpc.id }}'
register: vpc_subnets
Expand All @@ -62,10 +47,6 @@
private_subnets: '{{ vpc_subnets|community.general.json_query(''subnets[?tags.Public != `True`].id'') }}'
- name: create a route table
ec2_vpc_route_table:
aws_access_key: '{{ aws_access_key }}'
aws_secret_key: '{{ aws_secret_key }}'
security_token: '{{ security_token }}'
region: '{{ aws_region }}'
vpc_id: '{{ vpc.vpc.id }}'
tags:
Name: igw-route
Expand All @@ -76,10 +57,6 @@
gateway_id: '{{ igw.gateway_id }}'
register: route_table
- ec2_group:
aws_access_key: '{{ aws_access_key }}'
aws_secret_key: '{{ aws_secret_key }}'
security_token: '{{ security_token }}'
region: '{{ aws_region }}'
name: '{{ resource_prefix }}'
description: security group for Ansible ALB integration tests
state: present
Expand All @@ -92,41 +69,38 @@
register: sec_group
- name: create a target group for testing
elb_target_group:
aws_access_key: '{{ aws_access_key }}'
aws_secret_key: '{{ aws_secret_key }}'
security_token: '{{ security_token }}'
region: '{{ aws_region }}'
name: '{{ tg_name }}'
protocol: http
port: 80
vpc_id: '{{ vpc.vpc.id }}'
state: present
register: tg

# Run tests for graceful failure with an old version of botocore
- include_tasks: multiple_actions_fail.yml
vars:
ansible_python_interpreter: "{{ virtualenv_interpreter }}"

# Run main tests
- include_tasks: test_alb_bad_listener_options.yml
- include_tasks: test_alb_tags.yml
- include_tasks: test_creating_alb.yml
- include_tasks: test_alb_with_asg.yml
- include_tasks: test_modifying_alb_listeners.yml
- include_tasks: test_deleting_alb.yml
- include_tasks: test_multiple_actions.yml

always:
# Cleanup
- name: destroy ALB
elb_application_lb:
aws_access_key: '{{ aws_access_key }}'
aws_secret_key: '{{ aws_secret_key }}'
security_token: '{{ security_token }}'
region: '{{ aws_region }}'
name: '{{ alb_name }}'
state: absent
wait: true
wait_timeout: 600
ignore_errors: true
- name: destroy target group if it was created
elb_target_group:
aws_access_key: '{{ aws_access_key }}'
aws_secret_key: '{{ aws_secret_key }}'
security_token: '{{ security_token }}'
region: '{{ aws_region }}'
name: '{{ tg_name }}'
protocol: http
port: 80
Expand All @@ -142,10 +116,6 @@
ignore_errors: true
- name: destroy sec group
ec2_group:
aws_access_key: '{{ aws_access_key }}'
aws_secret_key: '{{ aws_secret_key }}'
security_token: '{{ security_token }}'
region: '{{ aws_region }}'
name: '{{ sec_group.group_name }}'
description: security group for Ansible ALB integration tests
state: absent
Expand All @@ -157,10 +127,6 @@
ignore_errors: true
- name: remove route table
ec2_vpc_route_table:
aws_access_key: '{{ aws_access_key }}'
aws_secret_key: '{{ aws_secret_key }}'
security_token: '{{ security_token }}'
region: '{{ aws_region }}'
vpc_id: '{{ vpc.vpc.id }}'
route_table_id: '{{ route_table.route_table.route_table_id }}'
lookup: id
Expand All @@ -172,10 +138,6 @@
ignore_errors: true
- name: destroy subnets
ec2_vpc_subnet:
aws_access_key: '{{ aws_access_key }}'
aws_secret_key: '{{ aws_secret_key }}'
security_token: '{{ security_token }}'
region: '{{ aws_region }}'
cidr: '{{ item.cidr }}'
vpc_id: '{{ vpc.vpc.id }}'
state: absent
Expand All @@ -191,10 +153,6 @@
ignore_errors: true
- name: destroy internet gateway
ec2_vpc_igw:
aws_access_key: '{{ aws_access_key }}'
aws_secret_key: '{{ aws_secret_key }}'
security_token: '{{ security_token }}'
region: '{{ aws_region }}'
vpc_id: '{{ vpc.vpc.id }}'
tags:
Name: '{{ resource_prefix }}'
Expand All @@ -206,10 +164,6 @@
ignore_errors: true
- name: destroy VPC
ec2_vpc_net:
aws_access_key: '{{ aws_access_key }}'
aws_secret_key: '{{ aws_secret_key }}'
security_token: '{{ security_token }}'
region: '{{ aws_region }}'
cidr_block: 10.228.228.0/22
name: '{{ resource_prefix }}_vpc'
state: absent
Expand Down
7 changes: 1 addition & 6 deletions tests/integration/targets/elb_application_lb/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
region: '{{ aws_region }}'
block:

# Prepare a virtual environment for multiple_actions_fail.yml
- set_fact:
virtualenv: "{{ remote_tmp_dir }}/virtualenv"
virtualenv_command: "{{ ansible_python_interpreter }} -m virtualenv"
Expand All @@ -30,12 +31,6 @@
virtualenv_command: "{{ virtualenv_command }}"
virtualenv_site_packages: no

# Run tests for graceful failure with an old version of botocore
- include_tasks: multiple_actions_fail.yml
vars:
ansible_python_interpreter: "{{ virtualenv_interpreter }}"

# Run main test suite using standard environment
- include_tasks: full_test.yml

always:
Expand Down

This file was deleted.

0 comments on commit e2d979e

Please sign in to comment.