Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken ec2_vpc_vgw tests #1579

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/1579-ec2_vpc_vgw-deleted.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
trivial:
- ec2_vpc_vgw - update integration tests to allow for attachments being removed from the list once deleted (https://github.com/ansible-collections/community.aws/pull/1579).
16 changes: 11 additions & 5 deletions tests/integration/targets/ec2_vpc_vgw/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,11 @@
- vgw_details.state == 'available'
- '"Name" in vgw_details.resource_tags'
- vgw_details.resource_tags.Name == vgw_name
- vgw_details.vpc_attachments | length == 2
- attach_1_description in vgw_details.vpc_attachments
- (
attach_1_description in vgw_details.vpc_attachments
and
vgw_details.vpc_attachments | length == 2
) or ( vgw_details.vpc_attachments | length == 1 )
- attach_2_description in vgw_details.vpc_attachments

- name: get VPC VGW facts by Tag
Expand Down Expand Up @@ -138,8 +141,11 @@
- vgw_details.state == 'available'
- '"Name" in vgw_details.resource_tags'
- vgw_details.resource_tags.Name == vgw_name
- vgw_details.vpc_attachments | length == 2
- attach_1_description in vgw_details.vpc_attachments
- (
attach_1_description in vgw_details.vpc_attachments
and
vgw_details.vpc_attachments | length == 2
) or ( vgw_details.vpc_attachments | length == 1 )
- attach_2_description in vgw_details.vpc_attachments

# ============================================================
Expand Down Expand Up @@ -211,7 +217,7 @@
- name: delete vpn gateway
ec2_vpc_vgw:
state: absent
vpn_gateway_id: '{{ vgw.vgw.id }}'
vpn_gateway_id: '{{ vgw.vgw.id | default(vgw_id) }}'
ignore_errors: yes

- name: delete vpc
Expand Down