Skip to content

Commit

Permalink
EFS integration tests cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
zeten30 committed Aug 10, 2021
1 parent 79b8c2a commit 409696d
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 83 deletions.
1 change: 1 addition & 0 deletions tests/integration/targets/efs/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
efs_name: "ansible-test-{{ tiny_prefix }}"
9 changes: 0 additions & 9 deletions tests/integration/targets/efs/playbooks/full_test.yml

This file was deleted.

32 changes: 0 additions & 32 deletions tests/integration/targets/efs/playbooks/version_fail.yml

This file was deleted.

15 changes: 0 additions & 15 deletions tests/integration/targets/efs/runme.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# ============================================================
- name: Create VPC for testing
ec2_vpc_net:
name: "{{ resource_prefix }}-vpc"
name: "{{ efs_name }}-vpc"
cidr_block: 10.22.32.0/23
tags:
Name: Ansible ec2_instance Testing VPC
Expand All @@ -27,7 +27,7 @@
cidr: 10.22.32.0/24
az: "{{ aws_region }}a"
resource_tags:
Name: "{{ resource_prefix }}-subnet-a"
Name: "{{ efs_name }}-subnet-a"
register: testing_subnet_a

- name: Create subnet in zone B for testing
Expand All @@ -37,7 +37,7 @@
cidr: 10.22.33.0/24
az: "{{ aws_region }}b"
resource_tags:
Name: "{{ resource_prefix }}-subnet-b"
Name: "{{ efs_name }}-subnet-b"
register: testing_subnet_b

- name: Get default security group id for vpc
Expand All @@ -54,9 +54,9 @@
- name: Create Efs for testing
efs:
state: present
name: "{{ resource_prefix }}-test-efs"
name: "{{ efs_name }}-test-efs"
tags:
Name: "{{ resource_prefix }}-test-tag"
Name: "{{ efs_name }}-test-tag"
Purpose: file-storage
targets:
- subnet_id: "{{testing_subnet_a.subnet.id}}"
Expand All @@ -76,19 +76,19 @@
# ============================================================
- name: Get EFS by creation token
efs_info:
name: "{{ resource_prefix }}-test-efs"
name: "{{ efs_name }}-test-efs"
register: efs_result

- set_fact:
efs_result_assertions:
- efs_result is not changed
- (efs_result.efs | length) == 1
- efs_result.efs[0].creation_token == "{{ resource_prefix }}-test-efs"
- efs_result.efs[0].creation_token == "{{ efs_name }}-test-efs"
- efs_result.efs[0].file_system_id == created_efs.efs.file_system_id
- efs_result.efs[0].number_of_mount_targets == 2
- (efs_result.efs[0].mount_targets | length) == 2
- efs_result.efs[0].name == "{{ resource_prefix }}-test-tag"
- efs_result.efs[0].tags.Name == "{{ resource_prefix }}-test-tag"
- efs_result.efs[0].name == "{{ efs_name }}-test-tag"
- efs_result.efs[0].tags.Name == "{{ efs_name }}-test-tag"
- efs_result.efs[0].tags.Purpose == "file-storage"
- efs_result.efs[0].encrypted == false
- efs_result.efs[0].life_cycle_state == "available"
Expand All @@ -113,7 +113,7 @@
- name: Get EFS by tag
efs_info:
tags:
Name: "{{ resource_prefix }}-test-tag"
Name: "{{ efs_name }}-test-tag"
register: efs_result

- assert:
Expand Down Expand Up @@ -143,7 +143,7 @@
- name: Get EFS by tag and target
efs_info:
tags:
Name: "{{ resource_prefix }}-test-tag"
Name: "{{ efs_name }}-test-tag"
targets:
- "{{testing_subnet_a.subnet.id}}"
register: efs_result
Expand All @@ -157,9 +157,9 @@
- name: Update Efs to use provisioned throughput_mode
efs:
state: present
name: "{{ resource_prefix }}-test-efs"
name: "{{ efs_name }}-test-efs"
tags:
Name: "{{ resource_prefix }}-test-tag"
Name: "{{ efs_name }}-test-tag"
Purpose: file-storage
targets:
- subnet_id: "{{testing_subnet_a.subnet.id}}"
Expand All @@ -176,9 +176,9 @@
- name: Efs same value for provisioned_throughput_in_mibps
efs:
state: present
name: "{{ resource_prefix }}-test-efs"
name: "{{ efs_name }}-test-efs"
tags:
Name: "{{ resource_prefix }}-test-tag"
Name: "{{ efs_name }}-test-tag"
Purpose: file-storage
targets:
- subnet_id: "{{testing_subnet_a.subnet.id}}"
Expand All @@ -197,9 +197,9 @@
- name: Efs new value for provisioned_throughput_in_mibps
efs:
state: present
name: "{{ resource_prefix }}-test-efs"
name: "{{ efs_name }}-test-efs"
tags:
Name: "{{ resource_prefix }}-test-tag"
Name: "{{ efs_name }}-test-tag"
Purpose: file-storage
targets:
- subnet_id: "{{testing_subnet_a.subnet.id}}"
Expand All @@ -218,7 +218,7 @@
# ============================================================
- name: Check new facts with provisioned mode
efs_info:
name: "{{ resource_prefix }}-test-efs"
name: "{{ efs_name }}-test-efs"
register: efs_result

- set_fact:
Expand All @@ -227,7 +227,7 @@
- efs_result.efs[0].throughput_mode == "provisioned"
- efs_result.efs[0].provisioned_throughput_in_mibps == 8.0
- (efs_result.efs | length) == 1
- efs_result.efs[0].creation_token == "{{ resource_prefix }}-test-efs"
- efs_result.efs[0].creation_token == "{{ efs_name }}-test-efs"
- efs_result.efs[0].file_system_id == created_efs.efs.file_system_id

- assert:
Expand All @@ -237,7 +237,7 @@
- name: Query unknown EFS by tag
efs_info:
tags:
Name: "{{ resource_prefix }}-unknown"
Name: "{{ efs_name }}-unknown"
register: efs_result

- assert:
Expand Down Expand Up @@ -296,7 +296,7 @@
- efs_tag_result.tags.Env is defined
- efs_tag_result.tags.Env is search("IntegrationTests")
- efs_tag_result.tags.Name is defined
- efs_tag_result.tags.Name is search("{{ resource_prefix }}-test-tag")
- efs_tag_result.tags.Name is search("{{ efs_name }}-test-tag")
- efs_tag_result.tags["CamelCase"] == 'SimpleCamelCase'
- efs_tag_result.tags["Title Case"] == 'Hello Cruel World'
- efs_tag_result.tags["lowercase spaced"] == 'hello cruel world'
Expand Down Expand Up @@ -394,7 +394,7 @@
- efs_tag_result.tags.Env is defined
- efs_tag_result.tags.Env is search("IntegrationTests")
- efs_tag_result.tags.Name is defined
- efs_tag_result.tags.Name is search("{{ resource_prefix }}-test-tag")
- efs_tag_result.tags.Name is search("{{ efs_name }}-test-tag")
- not efs_tag_result.tags["CamelCase"] is defined
- not efs_tag_result.tags["Title Case"] is defined
- not efs_tag_result.tags["lowercase spaced"] is defined
Expand Down Expand Up @@ -437,9 +437,9 @@
- name: Delete EFS used for tests
efs:
state: absent
name: "{{ resource_prefix }}-test-efs"
name: "{{ efs_name }}-test-efs"
tags:
Name: "{{ resource_prefix }}-test-tag"
Name: "{{ efs_name }}-test-tag"
Purpose: file-storage
register: removed
until: removed is not failed
Expand All @@ -453,7 +453,7 @@
cidr: 10.22.32.0/24
az: "{{ aws_region }}a"
resource_tags:
Name: "{{ resource_prefix }}-subnet-a"
Name: "{{ efs_name }}-subnet-a"
register: removed
until: removed is not failed
ignore_errors: yes
Expand All @@ -466,15 +466,15 @@
cidr: 10.22.33.0/24
az: "{{ aws_region }}b"
resource_tags:
Name: "{{ resource_prefix }}-subnet-b"
Name: "{{ efs_name }}-subnet-b"
register: removed
until: removed is not failed
ignore_errors: yes
retries: 10

- name: remove the VPC
ec2_vpc_net:
name: "{{ resource_prefix }}-vpc"
name: "{{ efs_name }}-vpc"
cidr_block: 10.22.32.0/23
state: absent
register: removed
Expand Down

0 comments on commit 409696d

Please sign in to comment.