Skip to content

Commit

Permalink
Cleanup after renamed plugins (#1751)
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
tests/integration
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis
  • Loading branch information
tremble authored Sep 11, 2023
1 parent 520019d commit 989f4dd
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/20230908-alias-cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
trivial:
- Update integration tests to reflect renamed plugins
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@
- 'alarm_info.metric_alarms | length == 0'

- name: create ec2 metric alarm with metrics
ec2_metric_alarm:
cloudwatch_metric_alarm:
state: present
name: '{{ alarm_full_name }}'
treat_missing_data: missing
Expand Down Expand Up @@ -444,7 +444,7 @@


- name: try to remove the alarm
ec2_metric_alarm:
cloudwatch_metric_alarm:
state: absent
name: '{{ alarm_full_name }}'
register: ec2_instance_metric_alarm_deletion_no_unit
Expand All @@ -466,7 +466,7 @@
- 'alarm_info_no_unit.metric_alarms | length == 0'

- name: create ec2 metric alarm by providing mutually exclusive values
ec2_metric_alarm:
cloudwatch_metric_alarm:
dimensions:
InstanceId: '{{ ec2_instance_results.instances[0].instance_id }}'
state: present
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

- name: lookup missing secret (skip)
set_fact:
missing_secret: "{{ lookup('amazon.aws.aws_secret', secret_name, on_missing=skip, **connection_args) }}"
missing_secret: "{{ lookup('amazon.aws.secretsmanager_secret', secret_name, on_missing=skip, **connection_args) }}"

- name: assert that missing_secret is defined
assert:
Expand All @@ -36,7 +36,7 @@

- name: lookup missing secret (warn)
set_fact:
missing_secret: "{{ lookup('amazon.aws.aws_secret', secret_name, on_missing=warn, **connection_args) }}"
missing_secret: "{{ lookup('amazon.aws.secretsmanager_secret', secret_name, on_missing=warn, **connection_args) }}"

- name: assert that missing_secret is defined
assert:
Expand All @@ -46,7 +46,7 @@

- name: lookup missing secret (error)
set_fact:
missing_secret: "{{ lookup('amazon.aws.aws_secret', secret_name, **connection_args) }}"
missing_secret: "{{ lookup('amazon.aws.secretsmanager_secret', secret_name, **connection_args) }}"
ignore_errors: True
register: get_missing_secret

Expand All @@ -56,7 +56,7 @@
- get_missing_secret is failed

- name: create secret "{{ secret_name }}"
aws_secret:
secretsmanager_secret:
name: "{{ secret_name }}"
secret: "{{ secret_value }}"
tags:
Expand All @@ -65,22 +65,22 @@

- name: read secret value
set_fact:
look_secret: "{{ lookup('amazon.aws.aws_secret', secret_name, **connection_args) }}"
look_secret: "{{ lookup('amazon.aws.secretsmanager_secret', secret_name, **connection_args) }}"

- name: assert that secret was successfully retrieved
assert:
that:
- look_secret == secret_value

- name: delete secret
aws_secret:
secretsmanager_secret:
name: "{{ secret_name }}"
state: absent
recovery_window: 7

- name: lookup deleted secret (skip)
set_fact:
deleted_secret: "{{ lookup('amazon.aws.aws_secret', secret_name, on_deleted=skip, **connection_args) }}"
deleted_secret: "{{ lookup('amazon.aws.secretsmanager_secret', secret_name, on_deleted=skip, **connection_args) }}"

- name: assert that deleted_secret is defined
assert:
Expand All @@ -90,7 +90,7 @@

- name: lookup deleted secret (warn)
set_fact:
deleted_secret: "{{ lookup('amazon.aws.aws_secret', secret_name, on_deleted=warn, **connection_args) }}"
deleted_secret: "{{ lookup('amazon.aws.secretsmanager_secret', secret_name, on_deleted=warn, **connection_args) }}"

- name: assert that deleted_secret is defined
assert:
Expand All @@ -100,7 +100,7 @@

- name: lookup deleted secret (error)
set_fact:
missing_secret: "{{ lookup('amazon.aws.aws_secret', secret_name, **connection_args) }}"
missing_secret: "{{ lookup('amazon.aws.secretsmanager_secret', secret_name, **connection_args) }}"
ignore_errors: True
register: get_deleted_secret

Expand All @@ -113,7 +113,7 @@

# delete secret created
- name: delete secret
aws_secret:
secretsmanager_secret:
name: "{{ secret_name }}"
state: absent
recovery_window: 0
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/targets/setup_ec2_vpc/tasks/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
register: remaining_enis

- name: '(VPC Cleanup) Retrieve security group info based on VPC ID'
ec2_group_info:
ec2_security_group_info:
filters:
vpc-id: '{{ vpc_id }}'
register: remaining_groups
Expand Down

0 comments on commit 989f4dd

Please sign in to comment.