Skip to content

Commit

Permalink
tests: split up ec2_instance
Browse files Browse the repository at this point in the history
Use on target per sub-test to have a better control on the global execution
time and simplify the troubleshooting.
  • Loading branch information
goneri committed Aug 25, 2022
1 parent 9e7ae6c commit 2cb7bd4
Show file tree
Hide file tree
Showing 81 changed files with 573 additions and 132 deletions.
20 changes: 0 additions & 20 deletions tests/integration/targets/ec2_instance/inventory

This file was deleted.

40 changes: 0 additions & 40 deletions tests/integration/targets/ec2_instance/main.yml

This file was deleted.

This file was deleted.

12 changes: 0 additions & 12 deletions tests/integration/targets/ec2_instance/runme.sh

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# duration: 25
slow

cloud/aws
ec2_instance_info
ec2_instance

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

cloud/aws
ec2_instance_info
ec2_instance

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
# defaults file for ec2_instance
ec2_instance_owner: 'integration-run-{{ resource_prefix }}'
ec2_instance_type: 't3.micro'
ec2_instance_tag_TestId: '{{ resource_prefix }}-{{ inventory_hostname }}'

vpc_name: '{{ resource_prefix }}-vpc'
vpc_seed: '{{ resource_prefix }}'
vpc_cidr: '10.{{ 256 | random(seed=vpc_seed) }}.0.0/16'

subnet_a_az: '{{ ec2_availability_zone_names[0] }}'
subnet_a_cidr: '10.{{ 256 | random(seed=vpc_seed) }}.32.0/24'
subnet_a_startswith: '10.{{ 256 | random(seed=vpc_seed) }}.32.'
subnet_b_az: '{{ ec2_availability_zone_names[1] }}'
subnet_b_cidr: '10.{{ 256 | random(seed=vpc_seed) }}.33.0/24'
subnet_b_startswith: '10.{{ 256 | random(seed=vpc_seed) }}.33.'

first_iam_role: "ansible-test-sts-{{ resource_prefix | hash('md5') }}-test-policy"
second_iam_role: "ansible-test-sts-{{ resource_prefix | hash('md5') }}-test-policy-2"
# Zuul resource prefixes are very long, and IAM roles can only be 64 characters
unique_id: "{{ resource_prefix | hash('md5') }}"
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# this just makes sure they're in the right place
dependencies:
- role: setup_ec2_facts
- role: setup_botocore_pip
vars:
boto3_version: "1.20.30"
collections:
- amazon.aws
5 changes: 5 additions & 0 deletions tests/integration/targets/ec2_instance_cpu_options/aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

cloud/aws
ec2_instance_info
ec2_instance

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
# defaults file for ec2_instance
ec2_instance_owner: 'integration-run-{{ resource_prefix }}'
ec2_instance_type: 't3.micro'
ec2_instance_tag_TestId: '{{ resource_prefix }}-{{ inventory_hostname }}'

vpc_name: '{{ resource_prefix }}-vpc'
vpc_seed: '{{ resource_prefix }}'
vpc_cidr: '10.{{ 256 | random(seed=vpc_seed) }}.0.0/16'

subnet_a_az: '{{ ec2_availability_zone_names[0] }}'
subnet_a_cidr: '10.{{ 256 | random(seed=vpc_seed) }}.32.0/24'
subnet_a_startswith: '10.{{ 256 | random(seed=vpc_seed) }}.32.'
subnet_b_az: '{{ ec2_availability_zone_names[1] }}'
subnet_b_cidr: '10.{{ 256 | random(seed=vpc_seed) }}.33.0/24'
subnet_b_startswith: '10.{{ 256 | random(seed=vpc_seed) }}.33.'

first_iam_role: "ansible-test-sts-{{ resource_prefix | hash('md5') }}-test-policy"
second_iam_role: "ansible-test-sts-{{ resource_prefix | hash('md5') }}-test-policy-2"
# Zuul resource prefixes are very long, and IAM roles can only be 64 characters
unique_id: "{{ resource_prefix | hash('md5') }}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# this just makes sure they're in the right place
dependencies:
- role: setup_ec2_facts
- role: setup_botocore_pip
vars:
boto3_version: "1.20.30"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

cloud/aws
ec2_instance_info
ec2_instance

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
# defaults file for ec2_instance
ec2_instance_owner: 'integration-run-{{ resource_prefix }}'
ec2_instance_type: 't3.micro'
ec2_instance_tag_TestId: '{{ resource_prefix }}-{{ inventory_hostname }}'

vpc_name: '{{ resource_prefix }}-vpc'
vpc_seed: '{{ resource_prefix }}'
vpc_cidr: '10.{{ 256 | random(seed=vpc_seed) }}.0.0/16'

subnet_a_az: '{{ ec2_availability_zone_names[0] }}'
subnet_a_cidr: '10.{{ 256 | random(seed=vpc_seed) }}.32.0/24'
subnet_a_startswith: '10.{{ 256 | random(seed=vpc_seed) }}.32.'
subnet_b_az: '{{ ec2_availability_zone_names[1] }}'
subnet_b_cidr: '10.{{ 256 | random(seed=vpc_seed) }}.33.0/24'
subnet_b_startswith: '10.{{ 256 | random(seed=vpc_seed) }}.33.'

first_iam_role: "ansible-test-sts-{{ resource_prefix | hash('md5') }}-test-policy"
second_iam_role: "ansible-test-sts-{{ resource_prefix | hash('md5') }}-test-policy-2"
# Zuul resource prefixes are very long, and IAM roles can only be 64 characters
unique_id: "{{ resource_prefix | hash('md5') }}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# this just makes sure they're in the right place
dependencies:
- role: setup_ec2_facts
- role: setup_botocore_pip
vars:
boto3_version: "1.20.30"
5 changes: 5 additions & 0 deletions tests/integration/targets/ec2_instance_ebs_optimized/aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

cloud/aws
ec2_instance_info
ec2_instance

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
# defaults file for ec2_instance
ec2_instance_owner: 'integration-run-{{ resource_prefix }}'
ec2_instance_type: 't3.micro'
ec2_instance_tag_TestId: '{{ resource_prefix }}-{{ inventory_hostname }}'

vpc_name: '{{ resource_prefix }}-vpc'
vpc_seed: '{{ resource_prefix }}'
vpc_cidr: '10.{{ 256 | random(seed=vpc_seed) }}.0.0/16'

subnet_a_az: '{{ ec2_availability_zone_names[0] }}'
subnet_a_cidr: '10.{{ 256 | random(seed=vpc_seed) }}.32.0/24'
subnet_a_startswith: '10.{{ 256 | random(seed=vpc_seed) }}.32.'
subnet_b_az: '{{ ec2_availability_zone_names[1] }}'
subnet_b_cidr: '10.{{ 256 | random(seed=vpc_seed) }}.33.0/24'
subnet_b_startswith: '10.{{ 256 | random(seed=vpc_seed) }}.33.'

first_iam_role: "ansible-test-sts-{{ resource_prefix | hash('md5') }}-test-policy"
second_iam_role: "ansible-test-sts-{{ resource_prefix | hash('md5') }}-test-policy-2"
# Zuul resource prefixes are very long, and IAM roles can only be 64 characters
unique_id: "{{ resource_prefix | hash('md5') }}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# this just makes sure they're in the right place
dependencies:
- role: setup_ec2_facts
- role: setup_botocore_pip
vars:
boto3_version: "1.20.30"
5 changes: 5 additions & 0 deletions tests/integration/targets/ec2_instance_env_cleanup/aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

cloud/aws
ec2_instance_info
ec2_instance

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
# defaults file for ec2_instance
ec2_instance_owner: 'integration-run-{{ resource_prefix }}'
ec2_instance_type: 't3.micro'
ec2_instance_tag_TestId: '{{ resource_prefix }}-{{ inventory_hostname }}'

vpc_name: '{{ resource_prefix }}-vpc'
vpc_seed: '{{ resource_prefix }}'
vpc_cidr: '10.{{ 256 | random(seed=vpc_seed) }}.0.0/16'

subnet_a_az: '{{ ec2_availability_zone_names[0] }}'
subnet_a_cidr: '10.{{ 256 | random(seed=vpc_seed) }}.32.0/24'
subnet_a_startswith: '10.{{ 256 | random(seed=vpc_seed) }}.32.'
subnet_b_az: '{{ ec2_availability_zone_names[1] }}'
subnet_b_cidr: '10.{{ 256 | random(seed=vpc_seed) }}.33.0/24'
subnet_b_startswith: '10.{{ 256 | random(seed=vpc_seed) }}.33.'

first_iam_role: "ansible-test-sts-{{ resource_prefix | hash('md5') }}-test-policy"
second_iam_role: "ansible-test-sts-{{ resource_prefix | hash('md5') }}-test-policy-2"
# Zuul resource prefixes are very long, and IAM roles can only be 64 characters
unique_id: "{{ resource_prefix | hash('md5') }}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# this just makes sure they're in the right place
dependencies:
- role: setup_ec2_facts
- role: setup_botocore_pip
vars:
boto3_version: "1.20.30"
5 changes: 5 additions & 0 deletions tests/integration/targets/ec2_instance_env_setup/aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

cloud/aws
ec2_instance_info
ec2_instance

21 changes: 21 additions & 0 deletions tests/integration/targets/ec2_instance_env_setup/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
# defaults file for ec2_instance
ec2_instance_owner: 'integration-run-{{ resource_prefix }}'
ec2_instance_type: 't3.micro'
ec2_instance_tag_TestId: '{{ resource_prefix }}-{{ inventory_hostname }}'

vpc_name: '{{ resource_prefix }}-vpc'
vpc_seed: '{{ resource_prefix }}'
vpc_cidr: '10.{{ 256 | random(seed=vpc_seed) }}.0.0/16'

subnet_a_az: '{{ ec2_availability_zone_names[0] }}'
subnet_a_cidr: '10.{{ 256 | random(seed=vpc_seed) }}.32.0/24'
subnet_a_startswith: '10.{{ 256 | random(seed=vpc_seed) }}.32.'
subnet_b_az: '{{ ec2_availability_zone_names[1] }}'
subnet_b_cidr: '10.{{ 256 | random(seed=vpc_seed) }}.33.0/24'
subnet_b_startswith: '10.{{ 256 | random(seed=vpc_seed) }}.33.'

first_iam_role: "ansible-test-sts-{{ resource_prefix | hash('md5') }}-test-policy"
second_iam_role: "ansible-test-sts-{{ resource_prefix | hash('md5') }}-test-policy-2"
# Zuul resource prefixes are very long, and IAM roles can only be 64 characters
unique_id: "{{ resource_prefix | hash('md5') }}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# this just makes sure they're in the right place
dependencies:
- role: setup_ec2_facts
- role: setup_botocore_pip
vars:
boto3_version: "1.20.30"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

cloud/aws
ec2_instance_info
ec2_instance

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
# defaults file for ec2_instance
ec2_instance_owner: 'integration-run-{{ resource_prefix }}'
ec2_instance_type: 't3.micro'
ec2_instance_tag_TestId: '{{ resource_prefix }}-{{ inventory_hostname }}'

vpc_name: '{{ resource_prefix }}-vpc'
vpc_seed: '{{ resource_prefix }}'
vpc_cidr: '10.{{ 256 | random(seed=vpc_seed) }}.0.0/16'

subnet_a_az: '{{ ec2_availability_zone_names[0] }}'
subnet_a_cidr: '10.{{ 256 | random(seed=vpc_seed) }}.32.0/24'
subnet_a_startswith: '10.{{ 256 | random(seed=vpc_seed) }}.32.'
subnet_b_az: '{{ ec2_availability_zone_names[1] }}'
subnet_b_cidr: '10.{{ 256 | random(seed=vpc_seed) }}.33.0/24'
subnet_b_startswith: '10.{{ 256 | random(seed=vpc_seed) }}.33.'

first_iam_role: "ansible-test-sts-{{ resource_prefix | hash('md5') }}-test-policy"
second_iam_role: "ansible-test-sts-{{ resource_prefix | hash('md5') }}-test-policy-2"
# Zuul resource prefixes are very long, and IAM roles can only be 64 characters
unique_id: "{{ resource_prefix | hash('md5') }}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# this just makes sure they're in the right place
dependencies:
- role: setup_ec2_facts
- role: setup_botocore_pip
vars:
boto3_version: "1.20.30"
5 changes: 5 additions & 0 deletions tests/integration/targets/ec2_instance_find_ami/aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

cloud/aws
ec2_instance_info
ec2_instance

Loading

0 comments on commit 2cb7bd4

Please sign in to comment.