ansible/test/integration/targets/rds_subnet_group/tasks/tests.yml
Mark Chappell 4d72b69035 rds_subnet_group : Sanity Check fixes (docs) and Integration tests (#63214)
* rds_subnet_group: Fixup sanity test issues

* rds_subnet_group: Add integration tests

* rds_subnet_group: Add testing policy
2019-10-23 08:27:07 -04:00

221 lines
6.5 KiB
YAML

---
# XXX rds_subnet_group doesn't support check_mode yet
# ============================================================
# Basic creation
- name: 'Create a subnet group'
rds_subnet_group:
state: present
name: '{{ resource_prefix }}'
description: '{{ group_description }}'
subnets:
- '{{ subnet_ids[0] }}'
- '{{ subnet_ids[1] }}'
register: result
- assert:
that:
- result is changed
- result.subnet_group.description == group_description
- result.subnet_group.name == resource_prefix
- result.subnet_group.vpc_id == vpc.vpc.id
- result.subnet_group.subnet_ids | length == 2
- subnet_ids[0] in result.subnet_group.subnet_ids
- subnet_ids[1] in result.subnet_group.subnet_ids
- name: 'Create a subnet group (idempotency)'
rds_subnet_group:
state: present
name: '{{ resource_prefix }}'
description: '{{ group_description }}'
subnets:
- '{{ subnet_ids[0] }}'
- '{{ subnet_ids[1] }}'
register: result
- assert:
that:
- result is not changed
- result.subnet_group.description == group_description
- result.subnet_group.name == resource_prefix
- result.subnet_group.vpc_id == vpc.vpc.id
- result.subnet_group.subnet_ids | length == 2
- subnet_ids[0] in result.subnet_group.subnet_ids
- subnet_ids[1] in result.subnet_group.subnet_ids
# ============================================================
# Update description
- name: 'Update subnet group description'
rds_subnet_group:
state: present
name: '{{ resource_prefix }}'
description: '{{ group_description_changed }}'
subnets:
- '{{ subnet_ids[0] }}'
- '{{ subnet_ids[1] }}'
register: result
- assert:
that:
- result is changed
- result.subnet_group.description == group_description_changed
- result.subnet_group.name == resource_prefix
- result.subnet_group.vpc_id == vpc.vpc.id
- result.subnet_group.subnet_ids | length == 2
- subnet_ids[0] in result.subnet_group.subnet_ids
- subnet_ids[1] in result.subnet_group.subnet_ids
- name: 'Update subnet group description (idempotency)'
rds_subnet_group:
state: present
name: '{{ resource_prefix }}'
description: '{{ group_description_changed }}'
subnets:
- '{{ subnet_ids[0] }}'
- '{{ subnet_ids[1] }}'
register: result
- assert:
that:
- result is not changed
- result.subnet_group.description == group_description_changed
- result.subnet_group.name == resource_prefix
- result.subnet_group.vpc_id == vpc.vpc.id
- result.subnet_group.subnet_ids | length == 2
- subnet_ids[0] in result.subnet_group.subnet_ids
- subnet_ids[1] in result.subnet_group.subnet_ids
- name: 'Restore subnet group description'
rds_subnet_group:
state: present
name: '{{ resource_prefix }}'
description: '{{ group_description }}'
subnets:
- '{{ subnet_ids[0] }}'
- '{{ subnet_ids[1] }}'
register: result
- assert:
that:
- result is changed
- result.subnet_group.description == group_description
- result.subnet_group.name == resource_prefix
- result.subnet_group.vpc_id == vpc.vpc.id
- result.subnet_group.subnet_ids | length == 2
- subnet_ids[0] in result.subnet_group.subnet_ids
- subnet_ids[1] in result.subnet_group.subnet_ids
# ============================================================
# Update subnets
- name: 'Update subnet group list'
rds_subnet_group:
state: present
name: '{{ resource_prefix }}'
description: '{{ group_description }}'
subnets:
- '{{ subnet_ids[2] }}'
- '{{ subnet_ids[3] }}'
register: result
- assert:
that:
- result is changed
- result.subnet_group.description == group_description
- result.subnet_group.name == resource_prefix
- result.subnet_group.vpc_id == vpc.vpc.id
- result.subnet_group.subnet_ids | length == 2
- subnet_ids[2] in result.subnet_group.subnet_ids
- subnet_ids[3] in result.subnet_group.subnet_ids
- name: 'Update subnet group list (idempotency)'
rds_subnet_group:
state: present
name: '{{ resource_prefix }}'
description: '{{ group_description }}'
subnets:
- '{{ subnet_ids[2] }}'
- '{{ subnet_ids[3] }}'
register: result
- assert:
that:
- result is not changed
- result.subnet_group.description == group_description
- result.subnet_group.name == resource_prefix
- result.subnet_group.vpc_id == vpc.vpc.id
- result.subnet_group.subnet_ids | length == 2
- subnet_ids[2] in result.subnet_group.subnet_ids
- subnet_ids[3] in result.subnet_group.subnet_ids
- name: 'Add more subnets subnet group list'
rds_subnet_group:
state: present
name: '{{ resource_prefix }}'
description: '{{ group_description }}'
subnets:
- '{{ subnet_ids[0] }}'
- '{{ subnet_ids[1] }}'
- '{{ subnet_ids[2] }}'
- '{{ subnet_ids[3] }}'
register: result
- assert:
that:
- result is changed
- result.subnet_group.description == group_description
- result.subnet_group.name == resource_prefix
- result.subnet_group.vpc_id == vpc.vpc.id
- result.subnet_group.subnet_ids | length == 4
- subnet_ids[0] in result.subnet_group.subnet_ids
- subnet_ids[1] in result.subnet_group.subnet_ids
- subnet_ids[2] in result.subnet_group.subnet_ids
- subnet_ids[3] in result.subnet_group.subnet_ids
- name: 'Add more members to subnet group list (idempotency)'
rds_subnet_group:
state: present
name: '{{ resource_prefix }}'
description: '{{ group_description }}'
subnets:
- '{{ subnet_ids[0] }}'
- '{{ subnet_ids[1] }}'
- '{{ subnet_ids[2] }}'
- '{{ subnet_ids[3] }}'
register: result
- assert:
that:
- result is not changed
- result.subnet_group.description == group_description
- result.subnet_group.name == resource_prefix
- result.subnet_group.vpc_id == vpc.vpc.id
- result.subnet_group.subnet_ids | length == 4
- subnet_ids[0] in result.subnet_group.subnet_ids
- subnet_ids[1] in result.subnet_group.subnet_ids
- subnet_ids[2] in result.subnet_group.subnet_ids
- subnet_ids[3] in result.subnet_group.subnet_ids
# ============================================================
# Deletion
- name: 'Delete a subnet group'
rds_subnet_group:
state: absent
name: '{{ resource_prefix }}'
register: result
- assert:
that:
- result is changed
- name: 'Delete a subnet group (idempotency)'
rds_subnet_group:
state: absent
name: '{{ resource_prefix }}'
register: result
- assert:
that:
- result is not changed