Skip to content

Commit

Permalink
Cleanup integration tests after all of the module renames (ansible-co…
Browse files Browse the repository at this point in the history
…llections#1166)

Cleanup integration tests after all of the module renames

SUMMARY
A lot of modules were renamed prior to 5.0.0, update the integration tests to take this into account.
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
tests/integration
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis <None>
  • Loading branch information
tremble authored Oct 17, 2022
1 parent b9ee1f6 commit 0828cb5
Show file tree
Hide file tree
Showing 51 changed files with 355 additions and 353 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/rename-cleanup-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
trivial:
- integration tests - Cleanup integration tests after mass module renames.
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# tasks file for test_ec2_asg

# ============================================================

- name: Test create/update/delete AutoScalingGroups with ec2_asg
- name: Test create/update/delete AutoScalingGroups with autoscaling_group
block:

# ============================================================

- name: test without specifying required module options
ec2_asg:
autoscaling_group:
aws_access_key: '{{ aws_access_key }}'
aws_secret_key: '{{ aws_secret_key }}'
security_token: '{{ security_token | default(omit) }}'
Expand All @@ -21,7 +19,7 @@


- name: ensure launch configs exist
ec2_lc:
autoscaling_launch_config:
name: '{{ item }}'
assign_public_ip: true
image_id: '{{ ec2_ami_id }}'
Expand All @@ -42,7 +40,7 @@
# ============================================================

- name: launch asg and wait for instances to be deemed healthy (no ELB)
ec2_asg:
autoscaling_group:
name: '{{ resource_prefix }}-asg'
launch_config_name: '{{ resource_prefix }}-lc'
desired_capacity: 1
Expand All @@ -57,7 +55,7 @@
- output.viable_instances == 1

- name: Enable metrics collection - check_mode
ec2_asg:
autoscaling_group:
name: '{{ resource_prefix }}-asg'
metrics_collection: yes
register: output
Expand All @@ -69,7 +67,7 @@
- '"autoscaling:UpdateAutoScalingGroup" not in output.resource_actions'

- name: Enable metrics collection
ec2_asg:
autoscaling_group:
name: '{{ resource_prefix }}-asg'
metrics_collection: yes
register: output
Expand All @@ -78,7 +76,7 @@
- output is changed

- name: Enable metrics collection (idempotency)
ec2_asg:
autoscaling_group:
name: '{{ resource_prefix }}-asg'
metrics_collection: yes
register: output
Expand All @@ -87,7 +85,7 @@
- output is not changed

- name: Disable metrics collection - check_mode
ec2_asg:
autoscaling_group:
name: '{{ resource_prefix }}-asg'
metrics_collection: no
register: output
Expand All @@ -100,7 +98,7 @@


- name: Disable metrics collection
ec2_asg:
autoscaling_group:
name: '{{ resource_prefix }}-asg'
metrics_collection: no
register: output
Expand All @@ -109,7 +107,7 @@
- output is changed

- name: Disable metrics collection (idempotency)
ec2_asg:
autoscaling_group:
name: '{{ resource_prefix }}-asg'
metrics_collection: no
register: output
Expand All @@ -118,13 +116,13 @@
- output is not changed

- name: kill asg
ec2_asg:
autoscaling_group:
name: '{{ resource_prefix }}-asg'
state: absent
wait_timeout: 800
async: 400
- name: launch asg and do not wait for instances to be deemed healthy (no ELB)
ec2_asg:
autoscaling_group:
name: '{{ resource_prefix }}-asg'
launch_config_name: '{{ resource_prefix }}-lc'
desired_capacity: 1
Expand All @@ -139,7 +137,7 @@
- output.viable_instances == 0

- name: kill asg
ec2_asg:
autoscaling_group:
name: '{{ resource_prefix }}-asg'
state: absent
wait_timeout: 800
Expand All @@ -149,7 +147,7 @@
delay: 10
async: 400
- name: create asg with asg metrics enabled
ec2_asg:
autoscaling_group:
name: '{{ resource_prefix }}-asg'
metrics_collection: true
launch_config_name: '{{ resource_prefix }}-lc'
Expand All @@ -164,13 +162,13 @@
- "'Group' in output.metrics_collection.0.Metric"

- name: kill asg
ec2_asg:
autoscaling_group:
name: '{{ resource_prefix }}-asg'
state: absent
wait_timeout: 800
async: 400
- name: launch load balancer
ec2_elb_lb:
elb_classic_lb:
name: '{{ load_balancer_name }}'
state: present
security_group_ids:
Expand All @@ -191,7 +189,7 @@
healthy_threshold: 2
register: load_balancer
- name: launch asg and wait for instances to be deemed healthy (ELB)
ec2_asg:
autoscaling_group:
name: '{{ resource_prefix }}-asg'
launch_config_name: '{{ resource_prefix }}-lc'
health_check_type: ELB
Expand All @@ -213,7 +211,7 @@

# grow scaling group to 3
- name: add 2 more instances wait for instances to be deemed healthy (ELB)
ec2_asg:
autoscaling_group:
name: '{{ resource_prefix }}-asg'
launch_config_name: '{{ resource_prefix }}-lc'
health_check_type: ELB
Expand All @@ -235,7 +233,7 @@

# Test max_instance_lifetime option
- name: enable asg max_instance_lifetime
ec2_asg:
autoscaling_group:
name: '{{ resource_prefix }}-asg'
max_instance_lifetime: 604801
register: output
Expand All @@ -245,7 +243,7 @@
- output.max_instance_lifetime == 604801

- name: run without max_instance_lifetime
ec2_asg:
autoscaling_group:
name: '{{ resource_prefix }}-asg'
launch_config_name: '{{ resource_prefix }}-lc'
- name: ensure max_instance_lifetime not affected by defaults
Expand All @@ -254,7 +252,7 @@
- output.max_instance_lifetime == 604801

- name: disable asg max_instance_lifetime
ec2_asg:
autoscaling_group:
name: '{{ resource_prefix }}-asg'
launch_config_name: '{{ resource_prefix }}-lc'
max_instance_lifetime: 0
Expand All @@ -268,7 +266,7 @@

# perform rolling replace with different launch configuration
- name: perform rolling update to new AMI
ec2_asg:
autoscaling_group:
name: '{{ resource_prefix }}-asg'
launch_config_name: '{{ resource_prefix }}-lc-2'
health_check_type: ELB
Expand All @@ -295,7 +293,7 @@

# perform rolling replace with the original launch configuration
- name: perform rolling update to new AMI while removing the load balancer
ec2_asg:
autoscaling_group:
name: '{{ resource_prefix }}-asg'
launch_config_name: '{{ resource_prefix }}-lc'
health_check_type: EC2
Expand All @@ -322,7 +320,7 @@

# perform rolling replace with new launch configuration and lc_check:false
- name: 'perform rolling update to new AMI with lc_check: false'
ec2_asg:
autoscaling_group:
name: '{{ resource_prefix }}-asg'
launch_config_name: '{{ resource_prefix }}-lc-2'
health_check_type: EC2
Expand All @@ -338,8 +336,8 @@
lc_check: false
wait_timeout: 1800
state: present
- name: get ec2_asg info
ec2_asg_info:
- name: get autoscaling_group info
autoscaling_group_info:
name: '{{ resource_prefix }}-asg'
register: output
- assert:
Expand All @@ -349,13 +347,13 @@
# ============================================================

- name: kill asg
ec2_asg:
autoscaling_group:
name: '{{ resource_prefix }}-asg'
state: absent
wait_timeout: 800
async: 400
- name: 'new asg with lc_check: false'
ec2_asg:
autoscaling_group:
name: '{{ resource_prefix }}-asg'
launch_config_name: '{{ resource_prefix }}-lc'
health_check_type: EC2
Expand All @@ -371,8 +369,8 @@
lc_check: false
wait_timeout: 1800
state: present
- name: get ec2_asg information
ec2_asg_info:
- name: get autoscaling_group information
autoscaling_group_info:
name: '{{ resource_prefix }}-asg'
register: output
- assert:
Expand All @@ -397,7 +395,7 @@

- name: update autoscaling group with mixed-instances policy with mixed instances
types - check_mode
ec2_asg:
autoscaling_group:
name: '{{ resource_prefix }}-asg'
launch_template:
launch_template_name: '{{ resource_prefix }}-lt'
Expand All @@ -421,7 +419,7 @@

- name: update autoscaling group with mixed-instances policy with mixed instances
types
ec2_asg:
autoscaling_group:
name: '{{ resource_prefix }}-asg'
launch_template:
launch_template_name: '{{ resource_prefix }}-lt'
Expand All @@ -443,7 +441,7 @@
- output.mixed_instances_policy[1] == 't2.nano'

- name: update autoscaling group with mixed-instances policy with instances_distribution
ec2_asg:
autoscaling_group:
name: '{{ resource_prefix }}-asg'
launch_template:
launch_template_name: '{{ resource_prefix }}-lt'
Expand Down Expand Up @@ -503,7 +501,7 @@
state: present
register: out_tg2
- name: update autoscaling group with tg1
ec2_asg:
autoscaling_group:
name: '{{ resource_prefix }}-asg'
launch_template:
launch_template_name: '{{ resource_prefix }}-lt'
Expand All @@ -520,7 +518,7 @@
- output.target_group_arns[0] == out_tg1.target_group_arn

- name: update autoscaling group add tg2
ec2_asg:
autoscaling_group:
name: '{{ resource_prefix }}-asg'
launch_template:
launch_template_name: '{{ resource_prefix }}-lt'
Expand All @@ -538,7 +536,7 @@
- output.target_group_arns | length == 2

- name: update autoscaling group remove tg1
ec2_asg:
autoscaling_group:
name: '{{ resource_prefix }}-asg'
launch_template:
launch_template_name: '{{ resource_prefix }}-lt'
Expand All @@ -556,7 +554,7 @@
- output.target_group_arns[0] == out_tg2.target_group_arn

- name: update autoscaling group remove tg2 and add tg1
ec2_asg:
autoscaling_group:
name: '{{ resource_prefix }}-asg'
launch_template:
launch_template_name: '{{ resource_prefix }}-lt'
Expand All @@ -574,7 +572,7 @@
- output.target_group_arns[0] == out_tg1.target_group_arn

- name: target group no change
ec2_asg:
autoscaling_group:
name: '{{ resource_prefix }}-asg'
launch_template:
launch_template_name: '{{ resource_prefix }}-lt'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- name: kill asg
ec2_asg:
autoscaling_group:
name: '{{ resource_prefix }}-asg'
state: absent
register: removed
Expand All @@ -19,7 +19,7 @@
- '{{ tg2_name }}'

- name: remove the load balancer
ec2_elb_lb:
elb_classic_lb:
name: '{{ load_balancer_name }}'
state: absent
security_group_ids:
Expand All @@ -44,7 +44,7 @@
ignore_errors: true
retries: 10
- name: remove launch configs
ec2_lc:
autoscaling_launch_config:
name: '{{ item }}'
state: absent
register: removed
Expand All @@ -64,7 +64,7 @@
until: del_lt is not failed
ignore_errors: true
- name: remove the security group
ec2_group:
ec2_security_group:
name: '{{ resource_prefix }}-sg'
description: a security group for ansible tests
vpc_id: '{{ testing_vpc.vpc.id }}'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- name: Run ec2_asg integration tests.
- name: Run autoscaling_group integration tests.
run_once: '{{ ec2_asg_setup_run_once }}'
block:

Expand Down Expand Up @@ -35,7 +35,7 @@
- '{{ testing_subnet.subnet.id }}'

- name: create a security group with the vpc created in the ec2_setup
ec2_group:
ec2_security_group:
name: '{{ resource_prefix }}-sg'
description: a security group for ansible tests
vpc_id: '{{ testing_vpc.vpc.id }}'
Expand Down
Loading

0 comments on commit 0828cb5

Please sign in to comment.