Skip to content

Commit

Permalink
Cleanup after renamed plugins (ansible-collections#1940)
Browse files Browse the repository at this point in the history
Cleanup after renamed plugins

SUMMARY
Prior to 5.0.0 we renamed various modules.  Cleanup the integration tests (and some docs).
ISSUE TYPE

Docs Pull Request

COMPONENT NAME
plugins/modules/acm_certificate.py
plugins/modules/acm_certificate_info.py
plugins/modules/autoscaling_policy.py
plugins/modules/codepipeline.py
plugins/modules/storagegateway_info.py
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@c2fead0
  • Loading branch information
tremble authored and abikouo committed Oct 15, 2024
1 parent 4decce1 commit 8d99f87
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
- "{{ testing_subnet.subnet.id }}"

- name: create a security group with the vpc created in the ec2_setup
ec2_group:
ec2_security_group:
name: "{{ sg_name }}"
description: a security group for ansible tests
vpc_id: "{{ testing_vpc.vpc.id }}"
Expand All @@ -63,7 +63,7 @@
register: sg

- name: ensure launch configs exist
ec2_lc:
autoscaling_launch_config:
name: "{{ item }}"
assign_public_ip: true
image_id: "{{ ec2_ami_id }}"
Expand All @@ -81,7 +81,7 @@
- "{{ lc_name_2 }}"

- name: launch asg and do not wait for instances to be deemed healthy (no ELB)
ec2_asg:
autoscaling_group:
name: "{{ asg_name }}"
launch_config_name: "{{ lc_name_1 }}"
desired_capacity: 1
Expand All @@ -99,7 +99,7 @@
# ============================================================

- name: test invalid cancelation - V1 - (pre-refresh)
ec2_asg_instance_refresh:
autoscaling_instance_refresh:
name: "{{ asg_name }}"
state: "cancelled"
ignore_errors: yes
Expand All @@ -110,7 +110,7 @@
- "'An error occurred (ActiveInstanceRefreshNotFound) when calling the CancelInstanceRefresh operation: No in progress or pending Instance Refresh found for Auto Scaling group {{ resource_prefix }}-asg' in result.msg"

- name: test starting a refresh with a valid ASG name - check_mode
ec2_asg_instance_refresh:
autoscaling_instance_refresh:
name: "{{ asg_name }}"
state: "started"
check_mode: true
Expand All @@ -123,7 +123,7 @@
- '"autoscaling:StartInstanceRefresh" not in output.resource_actions'

- name: test starting a refresh with a valid ASG name
ec2_asg_instance_refresh:
autoscaling_instance_refresh:
name: "{{ asg_name }}"
state: "started"
register: output
Expand All @@ -133,7 +133,7 @@
- "'instance_refresh_id' in output.instance_refreshes"

- name: test starting a refresh with a valid ASG name - Idempotent
ec2_asg_instance_refresh:
autoscaling_instance_refresh:
name: "{{ asg_name }}"
state: "started"
ignore_errors: true
Expand All @@ -145,7 +145,7 @@
- '"Failed to start InstanceRefresh: An error occurred (InstanceRefreshInProgress) when calling the StartInstanceRefresh operation: An Instance Refresh is already in progress and blocks the execution of this Instance Refresh." in output.msg'

- name: test starting a refresh with a valid ASG name - Idempotent (check_mode)
ec2_asg_instance_refresh:
autoscaling_instance_refresh:
name: "{{ asg_name }}"
state: "started"
ignore_errors: true
Expand All @@ -159,7 +159,7 @@
- '"In check_mode - Instance Refresh is already in progress, can not start new instance refresh." in output.msg'

- name: test starting a refresh with a nonexistent ASG name
ec2_asg_instance_refresh:
autoscaling_instance_refresh:
name: "nonexistentname-asg"
state: "started"
ignore_errors: yes
Expand All @@ -170,7 +170,7 @@
- "'Failed to start InstanceRefresh: An error occurred (ValidationError) when calling the StartInstanceRefresh operation: AutoScalingGroup name not found' in result.msg"

- name: test canceling a refresh with an ASG name - check_mode
ec2_asg_instance_refresh:
autoscaling_instance_refresh:
name: "{{ asg_name }}"
state: "cancelled"
check_mode: true
Expand All @@ -183,7 +183,7 @@
- '"autoscaling:CancelInstanceRefresh" not in output.resource_actions'

- name: test canceling a refresh with an ASG name
ec2_asg_instance_refresh:
autoscaling_instance_refresh:
name: "{{ asg_name }}"
state: "cancelled"
register: output
Expand All @@ -193,7 +193,7 @@
- "'instance_refresh_id' in output.instance_refreshes"

- name: test canceling a refresh with a ASG name - Idempotent
ec2_asg_instance_refresh:
autoscaling_instance_refresh:
name: "{{ asg_name }}"
state: "cancelled"
ignore_errors: yes
Expand All @@ -204,7 +204,7 @@
- output is not changed

- name: test cancelling a refresh with a valid ASG name - Idempotent (check_mode)
ec2_asg_instance_refresh:
autoscaling_instance_refresh:
name: "{{ asg_name }}"
state: "cancelled"
ignore_errors: true
Expand All @@ -217,7 +217,7 @@
- output is not failed

- name: test starting a refresh with an ASG name and preferences dict
ec2_asg_instance_refresh:
autoscaling_instance_refresh:
name: "{{ asg_name }}"
state: "started"
preferences:
Expand All @@ -232,7 +232,7 @@
- "'instance_refresh_id' in output.instance_refreshes"

- name: re-test canceling a refresh with an ASG name
ec2_asg_instance_refresh:
autoscaling_instance_refresh:
name: "{{ asg_name }}"
state: "cancelled"
register: output
Expand All @@ -242,7 +242,7 @@
- "'instance_refresh_id' in output.instance_refreshes"

- name: test valid start - V1 - (with preferences missing instance_warmup)
ec2_asg_instance_refresh:
autoscaling_instance_refresh:
name: "{{ asg_name }}"
state: "started"
preferences:
Expand All @@ -257,7 +257,7 @@
- "'instance_refresh_id' in output.instance_refreshes"

- name: re-test canceling a refresh with an ASG name
ec2_asg_instance_refresh:
autoscaling_instance_refresh:
name: "{{ asg_name }}"
state: "cancelled"
register: output
Expand All @@ -267,7 +267,7 @@
- "'instance_refresh_id' in output.instance_refreshes"

- name: test valid start - V2 - (with preferences missing min_healthy_percentage)
ec2_asg_instance_refresh:
autoscaling_instance_refresh:
name: "{{ asg_name }}"
state: "started"
preferences:
Expand All @@ -282,7 +282,7 @@
- "'instance_refresh_id' in output.instance_refreshes"

- name: test invalid cancelation - V2 - (with preferences)
ec2_asg_instance_refresh:
autoscaling_instance_refresh:
name: "{{ asg_name }}"
state: "cancelled"
preferences:
Expand All @@ -302,7 +302,7 @@
loop: "{{ query('sequence', 'start=1 end=3') }}"

- name: test getting info for an ASG name
ec2_asg_instance_refresh_info:
autoscaling_instance_refresh_info:
name: "{{ asg_name }}"
region: "{{ aws_region }}"
ignore_errors: yes
Expand All @@ -315,7 +315,7 @@
inst_refresh_id_json_query: instance_refreshes[].instance_refresh_id

- name: test using fake refresh ID
ec2_asg_instance_refresh_info:
autoscaling_instance_refresh_info:
name: "{{ asg_name }}"
ids: ['0e367f58-blabla-bla-bla-ca870dc5dbfe']
ignore_errors: yes
Expand All @@ -326,7 +326,7 @@
- "{{ output.instance_refreshes|length }} == 0"

- name: test using a real refresh ID
ec2_asg_instance_refresh_info:
autoscaling_instance_refresh_info:
name: "{{ asg_name }}"
ids: [ '{{ refreshout.instance_refreshes.instance_refresh_id }}' ]
ignore_errors: yes
Expand All @@ -337,7 +337,7 @@
- "{{ output.instance_refreshes |length }} == 1"

- name: test getting info for an ASG name which doesn't exist
ec2_asg_instance_refresh_info:
autoscaling_instance_refresh_info:
name: n0n3x1stentname27b
ignore_errors: yes
register: output
Expand All @@ -347,7 +347,7 @@
- "'Failed to describe InstanceRefreshes: An error occurred (ValidationError) when calling the DescribeInstanceRefreshes operation: AutoScalingGroup name not found - AutoScalingGroup n0n3x1stentname27b not found' == output.msg"

- name: assert that the correct number of records are returned
ec2_asg_instance_refresh_info:
autoscaling_instance_refresh_info:
name: "{{ asg_name }}"
ignore_errors: yes
register: output
Expand All @@ -357,7 +357,7 @@
- "{{ output.instance_refreshes|length }} == 7"

- name: assert that valid message with fake-token is returned
ec2_asg_instance_refresh_info:
autoscaling_instance_refresh_info:
name: "{{ asg_name }}"
next_token: "fake-token-123"
ignore_errors: yes
Expand All @@ -368,7 +368,7 @@
- '"Failed to describe InstanceRefreshes: An error occurred (InvalidNextToken) when calling the DescribeInstanceRefreshes operation: The token ''********'' is invalid." == output.msg'

- name: assert that max records=1 returns no more than one record
ec2_asg_instance_refresh_info:
autoscaling_instance_refresh_info:
name: "{{ asg_name }}"
max_records: 1
ignore_errors: yes
Expand All @@ -379,7 +379,7 @@
- "{{ output.instance_refreshes|length }} < 2"

- name: assert that valid message with real-token is returned
ec2_asg_instance_refresh_info:
autoscaling_instance_refresh_info:
name: "{{ asg_name }}"
next_token: "{{ output.next_token }}"
ignore_errors: yes
Expand All @@ -390,7 +390,7 @@
- "{{ output.instance_refreshes|length }} == 7"

- name: test using both real nextToken and max_records=1
ec2_asg_instance_refresh_info:
autoscaling_instance_refresh_info:
name: "{{ asg_name }}"
max_records: 1
next_token: "{{ output.next_token }}"
Expand All @@ -404,7 +404,7 @@
always:

- name: kill asg
ec2_asg:
autoscaling_group:
name: "{{ asg_name }}"
state: absent
register: removed
Expand All @@ -414,7 +414,7 @@
# Remove the testing dependencies

- name: remove the load balancer
ec2_elb_lb:
elb_classic_lb:
name: "{{ load_balancer_name }}"
state: absent
security_group_ids:
Expand All @@ -440,7 +440,7 @@
retries: 10

- name: remove launch configs
ec2_lc:
autoscaling_launch_config:
name: "{{ item }}"
state: absent
register: removed
Expand All @@ -461,7 +461,7 @@
ignore_errors: true

- name: remove the security group
ec2_group:
ec2_security_group:
name: "{{ sg_name }}"
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,13 +1,13 @@
---

- name: try to cancel pre-loop
ec2_asg_instance_refresh:
autoscaling_instance_refresh:
name: "{{ asg_name }}"
state: "cancelled"
ignore_errors: yes

- name: test starting a refresh with an ASG name
ec2_asg_instance_refresh:
autoscaling_instance_refresh:
name: "{{ asg_name }}"
state: "started"
access_key: "{{ aws_access_key }}"
Expand All @@ -20,7 +20,7 @@
until: refreshout is not failed

- name: test cancelling a refresh with an ASG name
ec2_asg_instance_refresh:
autoscaling_instance_refresh:
name: "{{ asg_name }}"
state: "cancelled"
access_key: "{{ aws_access_key }}"
Expand Down

0 comments on commit 8d99f87

Please sign in to comment.