Skip to content

Commit

Permalink
try splitting up tests further
Browse files Browse the repository at this point in the history
  • Loading branch information
marknet15 committed Jan 23, 2022
1 parent f8dcaa2 commit 25e9753
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 8 deletions.
1 change: 1 addition & 0 deletions tests/integration/targets/rds_instance/inventory
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ states
modify
tagging
replica
upgrade

# TODO: uncomment after adding rds_cluster module
# aurora
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/targets/rds_instance/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
- hosts: all
gather_facts: no
strategy: free
serial: 8
serial: 9
roles:
- rds_instance
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@
backup_retention_period: 2
preferred_backup_window: "05:00-06:00"
preferred_maintenance_window: "{{ preferred_maintenance_window }}"
engine_version: "{{ mariadb_engine_version_2 }}"
allow_major_version_upgrade: true
auto_minor_version_upgrade: false
monitoring_interval: "{{ monitoring_interval }}"
monitoring_role_arn: "{{ enhanced_monitoring_role.arn }}"
Expand All @@ -73,7 +71,6 @@
- '"max_allocated_storage" in result.pending_modified_values or result.max_allocated_storage == 150'
- '"port" in result.pending_modified_values or result.endpoint.port == 1150'
- '"db_instance_class" in result.pending_modified_values or result.db_instance_class == modified_db_instance_class'
- '"engine_version" in result.pending_modified_values or result.engine_version == mariadb_engine_version_2'
- '"monitoring_interval" in result.pending_modified_values or result.monitoring_interval == monitoring_interval'

- name: Idempotence modifying several pending attributes
Expand All @@ -85,16 +82,13 @@
backup_retention_period: 2
preferred_backup_window: "05:00-06:00"
preferred_maintenance_window: "{{ preferred_maintenance_window }}"
engine_version: "{{ mariadb_engine_version_2 }}"
allow_major_version_upgrade: true
auto_minor_version_upgrade: false
monitoring_interval: "{{ monitoring_interval }}"
monitoring_role_arn: "{{ enhanced_monitoring_role.arn }}"
iops: "{{ iops }}"
port: 1150
max_allocated_storage: 150
apply_immediately: True
wait: false
register: result

- assert:
Expand All @@ -104,7 +98,6 @@
- '"max_allocated_storage" in result.pending_modified_values or result.max_allocated_storage == 150'
- '"port" in result.pending_modified_values or result.endpoint.port == 1150'
- '"db_instance_class" in result.pending_modified_values or result.db_instance_class == modified_db_instance_class'
- '"engine_version" in result.pending_modified_values or result.engine_version == mariadb_engine_version_2'

always:
- name: Delete the instance
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
- block:
- name: Ensure the resource doesn't exist
rds_instance:
id: "{{ instance_id }}"
state: absent
skip_final_snapshot: True
register: result

- assert:
that:
- not result.changed
ignore_errors: yes

- name: Create a mariadb instance
rds_instance:
id: "{{ instance_id }}"
state: present
engine: mariadb
engine_version: "{{ mariadb_engine_version }}"
allow_major_version_upgrade: true
username: "{{ username }}"
password: "{{ password }}"
db_instance_class: "{{ db_instance_class }}"
allocated_storage: "{{ io1_allocated_storage }}"
storage_type: "{{ storage_type }}"
iops: "{{ iops }}"
register: result

- assert:
that:
- result.changed
- "result.db_instance_identifier == '{{ instance_id }}'"

# Test upgrade of DB instance

- name: Uprade a mariadb instance
rds_instance:
id: "{{ instance_id }}"
state: present
engine: mariadb
engine_version: "{{ mariadb_engine_version_2 }}"
allow_major_version_upgrade: true
username: "{{ username }}"
password: "{{ password }}"
db_instance_class: "{{ db_instance_class }}"
allocated_storage: "{{ io1_allocated_storage }}"
storage_type: "{{ storage_type }}"
iops: "{{ iops }}"
apply_immediately: True
register: result

- assert:
that:
- result.changed
- '"engine_version" in result.pending_modified_values or result.engine_version == mariadb_engine_version_2'

- name: Idempotence uprading a mariadb instance
rds_instance:
id: "{{ instance_id }}"
state: present
engine: mariadb
engine_version: "{{ mariadb_engine_version_2 }}"
allow_major_version_upgrade: true
username: "{{ username }}"
password: "{{ password }}"
db_instance_class: "{{ db_instance_class }}"
allocated_storage: "{{ io1_allocated_storage }}"
storage_type: "{{ storage_type }}"
iops: "{{ iops }}"
apply_immediately: True
register: result

- assert:
that:
- not result.changed
- '"engine_version" in result.pending_modified_values or result.engine_version == mariadb_engine_version_2'

always:
- name: Delete the instance
rds_instance:
id: "{{ instance_id }}"
state: absent
skip_final_snapshot: True
wait: false
ignore_errors: yes

0 comments on commit 25e9753

Please sign in to comment.