Skip to content

Commit

Permalink
fix integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mandar242 committed Apr 27, 2023
1 parent 7fa3e34 commit 8a51678
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 34 deletions.
8 changes: 4 additions & 4 deletions tests/integration/targets/rds_cluster_restore/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@
- "'engine' in _result_create_source_db_cluster"
- _result_create_source_db_cluster.engine == "{{ engine }}"
- "'engine_mode' in _result_create_source_db_cluster"
- _result_create_source_db_cluster.engine_mode == "provisioned"
- _result_create_source_db_cluster.engine_mode == "serverless"
- "'engine_version' in _result_create_source_db_cluster"
- "'master_username' in _result_create_source_db_cluster"
- _result_create_source_db_cluster.master_username == "{{ username }}"
- "'port' in _result_create_source_db_cluster"
- _result_create_source_db_cluster.port == {{ port }}
- "'status' in _result_create_source_db_cluster"
- _result_create_source_db_cluster.status == 'available'
- _result_create_source_db_cluster.storage_encrypted == false
- _result_create_source_db_cluster.storage_encrypted == true
- "'tags' in _result_create_source_db_cluster"
- "'vpc_security_groups' in _result_create_source_db_cluster"

Expand Down Expand Up @@ -89,7 +89,7 @@
- "'engine' in _result_restored_db_cluster"
- _result_restored_db_cluster.engine == "{{ engine }}"
- "'engine_mode' in _result_restored_db_cluster"
- _result_restored_db_cluster.engine_mode == "provisioned"
- _result_restored_db_cluster.engine_mode == "serverless"
- "'engine_version' in _result_restored_db_cluster"
- "'master_username' in _result_restored_db_cluster"
- _result_restored_db_cluster.master_username == "{{ username }}"
Expand Down Expand Up @@ -158,7 +158,7 @@
- "'engine' in _result_restored_db_cluster"
- _result_restored_db_cluster.engine == "{{ engine }}"
- "'engine_mode' in _result_restored_db_cluster"
- _result_restored_db_cluster.engine_mode == "provisioned"
- _result_restored_db_cluster.engine_mode == "serverless"
- "'engine_version' in _result_restored_db_cluster"
- "'master_username' in _result_restored_db_cluster"
- _result_restored_db_cluster.master_username == "{{ username }}"
Expand Down
48 changes: 18 additions & 30 deletions tests/integration/targets/rds_instance_modify/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,22 @@

- name: Modify the CA certificate identifier to rds-ca-ecc384-g1 - check_mode
rds_instance:
id: '{{ instance_id }}'
state: present
db_instance_identifier: '{{ modified_instance_id }}'
allow_major_version_upgrade: true
ca_certificate_identifier: rds-ca-ecc384-g1
apply_immediately: true
tags:
Name: '{{ modified_instance_id }}'
Created_by: Ansible rds_instance tests
register: result
check_mode: true
vars:
ansible_python_interpreter: "{{ botocore_virtualenv_interpreter }}"

- name: Get curent CA certificate identifier
rds_instance_info:
db_instance_identifier: '{{ instance_id }}'
db_instance_identifier: '{{ modified_instance_id }}'
register: db_info
- name: Assert that CA certificate identifier has been modified - check_mode
assert:
Expand All @@ -217,17 +224,23 @@

- name: Modify the CA certificate identifier to rds-ca-ecc384-g1
rds_instance:
id: '{{ instance_id }}'
state: present
db_instance_identifier: '{{ modified_instance_id }}'
allow_major_version_upgrade: true
ca_certificate_identifier: rds-ca-ecc384-g1
apply_immediately: true
tags:
Name: '{{ modified_instance_id }}'
Created_by: Ansible rds_instance tests
register: result
vars:
ansible_python_interpreter: "{{ botocore_virtualenv_interpreter }}"

- name: Get curent CA certificate identifier
rds_instance_info:
db_instance_identifier: '{{ instance_id }}'
db_instance_identifier: '{{ modified_instance_id }}'
register: db_info
retries: 10
retries: 20
delay: 10
until: db_info.instances[0].ca_certificate_identifier == "rds-ca-ecc384-g1"
- name: Assert that CA certificate identifier has been modified
Expand All @@ -237,31 +250,6 @@
- result is not failed
- db_info.instances[0].ca_certificate_identifier == "rds-ca-ecc384-g1"

- name: Modify the CA certificate identifier to rds-ca-ecc384-g1 - Idempotent - check_mode
rds_instance:
id: '{{ instance_id }}'
state: present
ca_certificate_identifier: rds-ca-ecc384-g1
register: result
check_mode: true
- name: Assert that CA certificate identifier is not modified
assert:
that:
- result is not changed
- result is not failed

- name: Modify the CA certificate identifier to rds-ca-ecc384-g1 - Idempotent
rds_instance:
id: '{{ instance_id }}'
state: present
ca_certificate_identifier: rds-ca-ecc384-g1
register: result
- name: Assert that CA certificate identifier is not modified
assert:
that:
- result is not changed
- result is not failed

always:
- name: Delete the instance
rds_instance:
Expand Down

0 comments on commit 8a51678

Please sign in to comment.