From 8b0444ef87c9a65c7ce6b788535dfb6f1744d062 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A9ri=20Le=20Bouder?= Date: Wed, 26 Oct 2022 13:12:06 -0400 Subject: [PATCH] rds_instance: split up the integration tests (#1185) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rds_instance: split up the integration tests Split the rds_instance target in smaller targets. Reviewed-by: Alina Buzachis Reviewed-by: Gonéri Le Bouder --- ...ance_split_the_integration_test-suite.yaml | 3 + .../targets/rds_instance/inventory | 23 -- .../integration/targets/rds_instance/main.yml | 9 - .../targets/rds_instance/meta/main.yml | 1 - .../roles/rds_instance/defaults/main.yml | 38 -- .../roles/rds_instance/tasks/main.yml | 12 - .../rds_instance/tasks/test_iam_roles.yml | 336 ------------------ .../integration/targets/rds_instance/runme.sh | 12 - .../targets/rds_instance_aurora/aliases | 5 + .../rds_instance_aurora/defaults/main.yml | 9 + .../tasks/main.yml} | 12 +- .../targets/rds_instance_complex/aliases | 3 + .../rds_instance_complex/defaults/main.yml | 16 + .../enhanced_monitoring_assume_policy.json | 0 .../files/s3_integration_policy.json | 0 .../files/s3_integration_trust_policy.json | 0 .../tasks/main.yml} | 13 +- .../targets/rds_instance_modify/aliases | 3 + .../rds_instance_modify/defaults/main.yml | 9 + .../tasks/main.yml} | 12 +- .../targets/rds_instance_processor/aliases | 3 + .../rds_instance_processor/defaults/main.yml | 12 + .../tasks/main.yml} | 11 +- .../targets/rds_instance_replica/aliases | 3 + .../rds_instance_replica/defaults/main.yml | 6 + .../tasks/main.yml} | 11 +- .../targets/rds_instance_restore/aliases | 3 + .../rds_instance_restore/defaults/main.yml | 5 + .../tasks/main.yml} | 11 +- .../targets/rds_instance_sgroups/aliases | 3 + .../rds_instance_sgroups/defaults/main.yml | 5 + .../tasks/main.yml} | 10 +- .../rds_instance_snapshot_mgmt/aliases | 4 + .../defaults/main.yml | 9 + .../tasks/main.yml} | 11 +- .../aliases | 4 +- .../rds_instance_states/defaults/main.yml | 5 + .../tasks/main.yml} | 11 +- .../targets/rds_instance_tagging/aliases | 3 + .../rds_instance_tagging/defaults/main.yml | 6 + .../tasks/main.yml} | 11 +- .../targets/rds_instance_upgrade/aliases | 3 + .../rds_instance_upgrade/defaults/main.yml | 10 + .../tasks/main.yml} | 11 +- 44 files changed, 241 insertions(+), 446 deletions(-) create mode 100644 changelogs/fragments/rds_instance_split_the_integration_test-suite.yaml delete mode 100644 tests/integration/targets/rds_instance/inventory delete mode 100644 tests/integration/targets/rds_instance/main.yml delete mode 100644 tests/integration/targets/rds_instance/meta/main.yml delete mode 100644 tests/integration/targets/rds_instance/roles/rds_instance/defaults/main.yml delete mode 100644 tests/integration/targets/rds_instance/roles/rds_instance/tasks/main.yml delete mode 100644 tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_iam_roles.yml delete mode 100755 tests/integration/targets/rds_instance/runme.sh create mode 100644 tests/integration/targets/rds_instance_aurora/aliases create mode 100644 tests/integration/targets/rds_instance_aurora/defaults/main.yml rename tests/integration/targets/{rds_instance/roles/rds_instance/tasks/test_aurora.yml => rds_instance_aurora/tasks/main.yml} (89%) create mode 100644 tests/integration/targets/rds_instance_complex/aliases create mode 100644 tests/integration/targets/rds_instance_complex/defaults/main.yml rename tests/integration/targets/{rds_instance/roles/rds_instance => rds_instance_complex}/files/enhanced_monitoring_assume_policy.json (100%) rename tests/integration/targets/{rds_instance/roles/rds_instance => rds_instance_complex}/files/s3_integration_policy.json (100%) rename tests/integration/targets/{rds_instance/roles/rds_instance => rds_instance_complex}/files/s3_integration_trust_policy.json (100%) rename tests/integration/targets/{rds_instance/roles/rds_instance/tasks/test_complex.yml => rds_instance_complex/tasks/main.yml} (95%) create mode 100644 tests/integration/targets/rds_instance_modify/aliases create mode 100644 tests/integration/targets/rds_instance_modify/defaults/main.yml rename tests/integration/targets/{rds_instance/roles/rds_instance/tasks/test_modify.yml => rds_instance_modify/tasks/main.yml} (92%) create mode 100644 tests/integration/targets/rds_instance_processor/aliases create mode 100644 tests/integration/targets/rds_instance_processor/defaults/main.yml rename tests/integration/targets/{rds_instance/roles/rds_instance/tasks/test_processor.yml => rds_instance_processor/tasks/main.yml} (92%) create mode 100644 tests/integration/targets/rds_instance_replica/aliases create mode 100644 tests/integration/targets/rds_instance_replica/defaults/main.yml rename tests/integration/targets/{rds_instance/roles/rds_instance/tasks/test_replica.yml => rds_instance_replica/tasks/main.yml} (95%) create mode 100644 tests/integration/targets/rds_instance_restore/aliases create mode 100644 tests/integration/targets/rds_instance_restore/defaults/main.yml rename tests/integration/targets/{rds_instance/roles/rds_instance/tasks/test_restore.yml => rds_instance_restore/tasks/main.yml} (91%) create mode 100644 tests/integration/targets/rds_instance_sgroups/aliases create mode 100644 tests/integration/targets/rds_instance_sgroups/defaults/main.yml rename tests/integration/targets/{rds_instance/roles/rds_instance/tasks/test_sgroups.yml => rds_instance_sgroups/tasks/main.yml} (96%) create mode 100644 tests/integration/targets/rds_instance_snapshot_mgmt/aliases create mode 100644 tests/integration/targets/rds_instance_snapshot_mgmt/defaults/main.yml rename tests/integration/targets/{rds_instance/roles/rds_instance/tasks/test_snapshot.yml => rds_instance_snapshot_mgmt/tasks/main.yml} (94%) rename tests/integration/targets/{rds_instance => rds_instance_states}/aliases (57%) create mode 100644 tests/integration/targets/rds_instance_states/defaults/main.yml rename tests/integration/targets/{rds_instance/roles/rds_instance/tasks/test_states.yml => rds_instance_states/tasks/main.yml} (95%) create mode 100644 tests/integration/targets/rds_instance_tagging/aliases create mode 100644 tests/integration/targets/rds_instance_tagging/defaults/main.yml rename tests/integration/targets/{rds_instance/roles/rds_instance/tasks/test_tagging.yml => rds_instance_tagging/tasks/main.yml} (94%) create mode 100644 tests/integration/targets/rds_instance_upgrade/aliases create mode 100644 tests/integration/targets/rds_instance_upgrade/defaults/main.yml rename tests/integration/targets/{rds_instance/roles/rds_instance/tasks/test_upgrade.yml => rds_instance_upgrade/tasks/main.yml} (91%) diff --git a/changelogs/fragments/rds_instance_split_the_integration_test-suite.yaml b/changelogs/fragments/rds_instance_split_the_integration_test-suite.yaml new file mode 100644 index 00000000000..fed2a389ad7 --- /dev/null +++ b/changelogs/fragments/rds_instance_split_the_integration_test-suite.yaml @@ -0,0 +1,3 @@ +--- +minor_changes: +- "rds_instance - Split up the integration test-suite in a series of smaller tests (https://github.com/ansible-collections/amazon.aws/pull/1185)." diff --git a/tests/integration/targets/rds_instance/inventory b/tests/integration/targets/rds_instance/inventory deleted file mode 100644 index f669860382c..00000000000 --- a/tests/integration/targets/rds_instance/inventory +++ /dev/null @@ -1,23 +0,0 @@ -# inventory names shortened down to fit resource name length limits -[tests] -processor -restore -sgroups -complex -states -modify -tagging -replica -upgrade -snapshot -# Disabled until https://github.com/ansible-collections/amazon.aws/pull/941 -# is merged -#aurora - -# TODO: uncomment after adding iam:CreatePolicy and iam:DeletePolicy -# iam_roles - - -[all:vars] -ansible_connection=local -ansible_python_interpreter="{{ ansible_playbook_python }}" diff --git a/tests/integration/targets/rds_instance/main.yml b/tests/integration/targets/rds_instance/main.yml deleted file mode 100644 index 178e569a666..00000000000 --- a/tests/integration/targets/rds_instance/main.yml +++ /dev/null @@ -1,9 +0,0 @@ -# Beware: most of our tests here are run in parallel. -# To add new tests you'll need to add a new host to the inventory and a matching -# '{{ inventory_hostname }}'.yml file in roles/rds_instance/tasks/ - -- hosts: all - gather_facts: no - strategy: free - roles: - - rds_instance diff --git a/tests/integration/targets/rds_instance/meta/main.yml b/tests/integration/targets/rds_instance/meta/main.yml deleted file mode 100644 index 32cf5dda7ed..00000000000 --- a/tests/integration/targets/rds_instance/meta/main.yml +++ /dev/null @@ -1 +0,0 @@ -dependencies: [] diff --git a/tests/integration/targets/rds_instance/roles/rds_instance/defaults/main.yml b/tests/integration/targets/rds_instance/roles/rds_instance/defaults/main.yml deleted file mode 100644 index c84aed0c230..00000000000 --- a/tests/integration/targets/rds_instance/roles/rds_instance/defaults/main.yml +++ /dev/null @@ -1,38 +0,0 @@ -instance_id: ansible-test-{{ inventory_hostname | replace('_','-') }}{{ tiny_prefix - }} -modified_instance_id: '{{ instance_id }}-updated' -username: test -password: test12345678 -db_instance_class: db.t3.micro -storage_encrypted_db_instance_class: db.t3.small -modified_db_instance_class: db.t3.medium -allocated_storage: 20 -modified_allocated_storage: 30 -io1_allocated_storage: 100 -io1_modified_allocated_storage: 110 -monitoring_interval: 60 -preferred_maintenance_window: mon:06:20-mon:06:50 -storage_type: io1 -iops: 1000 - -# For aurora tests -cluster_id: '{{ instance_id }}-cluster' -aurora_db_instance_class: db.t3.medium - -# For oracle tests -# Smallest instance that permits modification of the coreCount -oracle_ee_db_instance_class: db.r5.2xlarge -modified_processor_features: - coreCount: 4 - threadsPerCore: 2 - -# For mariadb tests -mariadb_engine_version: 10.3.31 -mariadb_engine_version_2: 10.4.21 - -# For iam roles tests -postgres_db_instance_class: db.m6g.large # smallest psql instance -postgres_db_engine_version: 14.2 - -# For snapshot tests -snapshot_id: '{{ instance_id }}-ss' diff --git a/tests/integration/targets/rds_instance/roles/rds_instance/tasks/main.yml b/tests/integration/targets/rds_instance/roles/rds_instance/tasks/main.yml deleted file mode 100644 index 9d4bce8b863..00000000000 --- a/tests/integration/targets/rds_instance/roles/rds_instance/tasks/main.yml +++ /dev/null @@ -1,12 +0,0 @@ -- name: rds_instance integration tests - collections: - - community.aws - module_defaults: - group/aws: - aws_access_key: '{{ aws_access_key }}' - aws_secret_key: '{{ aws_secret_key }}' - security_token: '{{ security_token | default(omit) }}' - region: '{{ aws_region }}' - block: - - include: ./test_{{ inventory_hostname }}.yml - #- include: ./test_restore_instance.yml # TODO: snapshot, s3 diff --git a/tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_iam_roles.yml b/tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_iam_roles.yml deleted file mode 100644 index 534d1d254a5..00000000000 --- a/tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_iam_roles.yml +++ /dev/null @@ -1,336 +0,0 @@ -- 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 postgresql instance - rds_instance: - id: '{{ instance_id }}' - state: present - engine: postgres - engine_version: '{{ postgres_db_engine_version }}' - username: '{{ username }}' - password: '{{ password }}' - db_instance_class: '{{ postgres_db_instance_class }}' - allocated_storage: '{{ allocated_storage }}' - allow_major_version_upgrade: yes - register: result - - - assert: - that: - - result.changed - - result.db_instance_identifier == '{{ instance_id }}' - - - name: Create s3 integration policy - iam_managed_policy: - policy_name: '{{ instance_id }}-s3-policy' - policy: "{{ lookup('file','files/s3_integration_policy.json') }}" - state: present - register: s3_integration_policy - - - name: Create an s3 integration role - iam_role: - assume_role_policy_document: "{{ lookup('file','files/s3_integration_trust_policy.json')\ - \ }}" - name: '{{ instance_id }}-s3-role-1' - state: present - managed_policy: '{{ s3_integration_policy.policy.arn }}' - register: s3_integration_role_1 - - - name: Create an s3 integration role - iam_role: - assume_role_policy_document: "{{ lookup('file','files/s3_integration_trust_policy.json')\ - \ }}" - name: '{{ instance_id }}-s3-role-2' - state: present - managed_policy: '{{ s3_integration_policy.policy.arn }}' - register: s3_integration_role_2 - - - name: Create an s3 integration role - iam_role: - assume_role_policy_document: "{{ lookup('file','files/s3_integration_trust_policy.json')\ - \ }}" - name: '{{ instance_id }}-s3-role-3' - state: present - managed_policy: '{{ s3_integration_policy.policy.arn }}' - register: s3_integration_role_3 - - # ------------------------------------------------------------------------------------------ - - - name: Add IAM roles - check_mode - rds_instance: - id: '{{ instance_id }}' - state: present - iam_roles: - - role_arn: '{{ s3_integration_role_1.arn }}' - feature_name: s3Export - - role_arn: '{{ s3_integration_role_2.arn }}' - feature_name: Lambda - - role_arn: '{{ s3_integration_role_3.arn }}' - feature_name: s3Import - register: result - check_mode: yes - - - assert: - that: - - result.changed - - - name: Add IAM roles - rds_instance: - id: '{{ instance_id }}' - state: present - iam_roles: - - role_arn: '{{ s3_integration_role_1.arn }}' - feature_name: s3Export - - role_arn: '{{ s3_integration_role_2.arn }}' - feature_name: Lambda - - role_arn: '{{ s3_integration_role_3.arn }}' - feature_name: s3Import - register: result - - - assert: - that: - - result.changed - - result.db_instance_identifier == '{{ instance_id }}' - - result.associated_roles | length == 3 - - "{{ 's3Export' in result.associated_roles | map(attribute='feature_name')\ - \ }}" - - "{{ 'Lambda' in result.associated_roles | map(attribute='feature_name') }}" - - "{{ 's3Import' in result.associated_roles | map(attribute='feature_name')\ - \ }}" - - - name: Add IAM roles (idempotence) - check_mode - rds_instance: - id: '{{ instance_id }}' - state: present - iam_roles: - - role_arn: '{{ s3_integration_role_1.arn }}' - feature_name: s3Export - - role_arn: '{{ s3_integration_role_2.arn }}' - feature_name: Lambda - - role_arn: '{{ s3_integration_role_3.arn }}' - feature_name: s3Import - register: result - check_mode: yes - - - assert: - that: - - not result.changed - - - name: Add IAM roles (idempotence) - rds_instance: - id: '{{ instance_id }}' - state: present - iam_roles: - - role_arn: '{{ s3_integration_role_1.arn }}' - feature_name: s3Export - - role_arn: '{{ s3_integration_role_2.arn }}' - feature_name: Lambda - - role_arn: '{{ s3_integration_role_3.arn }}' - feature_name: s3Import - register: result - - - assert: - that: - - not result.changed - - result.db_instance_identifier == '{{ instance_id }}' - - result.associated_roles | length == 3 - - "{{ 's3Export' in result.associated_roles | map(attribute='feature_name')\ - \ }}" - - "{{ 'Lambda' in result.associated_roles | map(attribute='feature_name') }}" - - "{{ 's3Import' in result.associated_roles | map(attribute='feature_name')\ - \ }}" - - - name: Add IAM roles (idempotence) - purge roles - rds_instance: - id: '{{ instance_id }}' - state: present - iam_roles: - - role_arn: '{{ s3_integration_role_1.arn }}' - feature_name: s3Export - - role_arn: '{{ s3_integration_role_2.arn }}' - feature_name: Lambda - - role_arn: '{{ s3_integration_role_3.arn }}' - feature_name: s3Import - purge_iam_roles: yes - register: result - - - assert: - that: - - not result.changed - - result.db_instance_identifier == '{{ instance_id }}' - - result.associated_roles | length == 3 - - "{{ 's3Export' in result.associated_roles | map(attribute='feature_name')\ - \ }}" - - "{{ 'Lambda' in result.associated_roles | map(attribute='feature_name') }}" - - "{{ 's3Import' in result.associated_roles | map(attribute='feature_name')\ - \ }}" - - # ------------------------------------------------------------------------------------------ - - - name: Remove s3Import IAM role from db instance - check_mode - rds_instance: - id: '{{ instance_id }}' - state: present - iam_roles: - - role_arn: '{{ s3_integration_role_1.arn }}' - feature_name: s3Export - - role_arn: '{{ s3_integration_role_2.arn }}' - feature_name: Lambda - purge_iam_roles: yes - register: result - check_mode: yes - - - assert: - that: - - result.changed - - - name: Remove s3Import IAM role from db instance - rds_instance: - id: '{{ instance_id }}' - state: present - iam_roles: - - role_arn: '{{ s3_integration_role_1.arn }}' - feature_name: s3Export - - role_arn: '{{ s3_integration_role_2.arn }}' - feature_name: Lambda - purge_iam_roles: yes - register: result - - - assert: - that: - - result.changed - - result.db_instance_identifier == '{{ instance_id }}' - - result.associated_roles | length == 2 - - "{{ 's3Export' in result.associated_roles | map(attribute='feature_name')\ - \ }}" - - "{{ 'Lambda' in result.associated_roles | map(attribute='feature_name') }}" - - "{{ 's3Import' not in result.associated_roles | map(attribute='feature_name')\ - \ }}" - - - name: Remove s3Import IAM role from db instance (idempotence) - check_mode - rds_instance: - id: '{{ instance_id }}' - state: present - iam_roles: - - role_arn: '{{ s3_integration_role_1.arn }}' - feature_name: s3Export - - role_arn: '{{ s3_integration_role_2.arn }}' - feature_name: Lambda - purge_iam_roles: yes - register: result - check_mode: yes - - - assert: - that: - - not result.changed - - - name: Remove s3Import IAM role from db instance (idempotence) - rds_instance: - id: '{{ instance_id }}' - state: present - iam_roles: - - role_arn: '{{ s3_integration_role_1.arn }}' - feature_name: s3Export - - role_arn: '{{ s3_integration_role_2.arn }}' - feature_name: Lambda - purge_iam_roles: yes - register: result - - - assert: - that: - - not result.changed - - result.db_instance_identifier == '{{ instance_id }}' - - result.associated_roles | length == 2 - - "{{ 's3Export' in result.associated_roles | map(attribute='feature_name')\ - \ }}" - - "{{ 'Lambda' in result.associated_roles | map(attribute='feature_name') }}" - - "{{ 's3Import' not in result.associated_roles | map(attribute='feature_name')\ - \ }}" - - # ------------------------------------------------------------------------------------------ - - - name: Remove IAM roles from db instance - check_mode - rds_instance: - id: '{{ instance_id }}' - state: present - purge_iam_roles: yes - register: result - check_mode: yes - - - assert: - that: - - result.changed - - - name: Remove IAM roles from db instance - rds_instance: - id: '{{ instance_id }}' - state: present - purge_iam_roles: yes - register: result - - - assert: - that: - - result.changed - - result.db_instance_identifier == '{{ instance_id }}' - - result.associated_roles | length == 0 - - - name: Remove IAM roles from db instance (idempotence) - check_mode - rds_instance: - id: '{{ instance_id }}' - state: present - purge_iam_roles: yes - register: result - check_mode: yes - - - assert: - that: - - not result.changed - - - name: Remove IAM roles from db instance (idempotence) - rds_instance: - id: '{{ instance_id }}' - state: present - purge_iam_roles: yes - register: result - - - assert: - that: - - not result.changed - - result.db_instance_identifier == '{{ instance_id }}' - - result.associated_roles | length == 0 - - always: - - name: Delete IAM policy - iam_managed_policy: - policy_name: '{{ instance_id }}-s3-policy' - state: absent - ignore_errors: yes - - - name: Delete IAM roles - iam_role: - name: '{{ item.role_name }}' - assume_role_policy_document: "{{ lookup('file','files/s3_integration_trust_policy.json')\ - \ }}" - state: absent - ignore_errors: yes - with_items: - - '{{ s3_integration_role_1 }}' - - '{{ s3_integration_role_2 }}' - - '{{ s3_integration_role_3 }}' - - - name: Delete the instance - rds_instance: - id: '{{ instance_id }}' - state: absent - skip_final_snapshot: true - wait: false - ignore_errors: yes diff --git a/tests/integration/targets/rds_instance/runme.sh b/tests/integration/targets/rds_instance/runme.sh deleted file mode 100755 index aa324772bbe..00000000000 --- a/tests/integration/targets/rds_instance/runme.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -# -# Beware: most of our tests here are run in parallel. -# To add new tests you'll need to add a new host to the inventory and a matching -# '{{ inventory_hostname }}'.yml file in roles/ec2_instance/tasks/ - - -set -eux - -export ANSIBLE_ROLES_PATH=../ - -ansible-playbook main.yml -i inventory "$@" diff --git a/tests/integration/targets/rds_instance_aurora/aliases b/tests/integration/targets/rds_instance_aurora/aliases new file mode 100644 index 00000000000..461a588ec83 --- /dev/null +++ b/tests/integration/targets/rds_instance_aurora/aliases @@ -0,0 +1,5 @@ +# See: https://github.com/ansible-collections/amazon.aws/pull/1192 +disabled +cloud/aws +time=15m +rds_instance diff --git a/tests/integration/targets/rds_instance_aurora/defaults/main.yml b/tests/integration/targets/rds_instance_aurora/defaults/main.yml new file mode 100644 index 00000000000..3647e4126b1 --- /dev/null +++ b/tests/integration/targets/rds_instance_aurora/defaults/main.yml @@ -0,0 +1,9 @@ +instance_id: ansible-test-{{ tiny_prefix }} +modified_instance_id: '{{ instance_id }}-updated' +username: test +password: test12345678 +db_instance_class: db.t3.micro + +# For aurora tests +cluster_id: '{{ instance_id }}-cluster' +aurora_db_instance_class: db.t3.medium diff --git a/tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_aurora.yml b/tests/integration/targets/rds_instance_aurora/tasks/main.yml similarity index 89% rename from tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_aurora.yml rename to tests/integration/targets/rds_instance_aurora/tasks/main.yml index 44d50ee2fcb..ff6f7177ff7 100644 --- a/tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_aurora.yml +++ b/tests/integration/targets/rds_instance_aurora/tasks/main.yml @@ -1,4 +1,13 @@ -- block: +- name: rds_instance / aurora integration tests + collections: + - community.aws + module_defaults: + group/aws: + aws_access_key: '{{ aws_access_key }}' + aws_secret_key: '{{ aws_secret_key }}' + security_token: '{{ security_token | default(omit) }}' + region: '{{ aws_region }}' + block: - name: Ensure the resource doesn't exist rds_instance: @@ -16,6 +25,7 @@ rds_cluster: state: present engine: aurora + engine_mode: provisioned cluster_id: '{{ cluster_id }}' username: '{{ username }}' password: '{{ password }}' diff --git a/tests/integration/targets/rds_instance_complex/aliases b/tests/integration/targets/rds_instance_complex/aliases new file mode 100644 index 00000000000..777fbe40a66 --- /dev/null +++ b/tests/integration/targets/rds_instance_complex/aliases @@ -0,0 +1,3 @@ +cloud/aws +time=15m +rds_instance diff --git a/tests/integration/targets/rds_instance_complex/defaults/main.yml b/tests/integration/targets/rds_instance_complex/defaults/main.yml new file mode 100644 index 00000000000..8ed85230122 --- /dev/null +++ b/tests/integration/targets/rds_instance_complex/defaults/main.yml @@ -0,0 +1,16 @@ +instance_id: ansible-test-{{ tiny_prefix }} +modified_instance_id: '{{ instance_id }}-updated' +username: test +password: test12345678 +db_instance_class: db.t3.micro +modified_db_instance_class: db.t3.medium +allocated_storage: 20 +io1_allocated_storage: 100 +io1_modified_allocated_storage: 110 +monitoring_interval: 60 +preferred_maintenance_window: mon:06:20-mon:06:50 +storage_type: io1 +iops: 1000 + +# For mariadb tests +mariadb_engine_version: 10.3.31 diff --git a/tests/integration/targets/rds_instance/roles/rds_instance/files/enhanced_monitoring_assume_policy.json b/tests/integration/targets/rds_instance_complex/files/enhanced_monitoring_assume_policy.json similarity index 100% rename from tests/integration/targets/rds_instance/roles/rds_instance/files/enhanced_monitoring_assume_policy.json rename to tests/integration/targets/rds_instance_complex/files/enhanced_monitoring_assume_policy.json diff --git a/tests/integration/targets/rds_instance/roles/rds_instance/files/s3_integration_policy.json b/tests/integration/targets/rds_instance_complex/files/s3_integration_policy.json similarity index 100% rename from tests/integration/targets/rds_instance/roles/rds_instance/files/s3_integration_policy.json rename to tests/integration/targets/rds_instance_complex/files/s3_integration_policy.json diff --git a/tests/integration/targets/rds_instance/roles/rds_instance/files/s3_integration_trust_policy.json b/tests/integration/targets/rds_instance_complex/files/s3_integration_trust_policy.json similarity index 100% rename from tests/integration/targets/rds_instance/roles/rds_instance/files/s3_integration_trust_policy.json rename to tests/integration/targets/rds_instance_complex/files/s3_integration_trust_policy.json diff --git a/tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_complex.yml b/tests/integration/targets/rds_instance_complex/tasks/main.yml similarity index 95% rename from tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_complex.yml rename to tests/integration/targets/rds_instance_complex/tasks/main.yml index 8c88be8b449..024e0978a2c 100644 --- a/tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_complex.yml +++ b/tests/integration/targets/rds_instance_complex/tasks/main.yml @@ -1,5 +1,14 @@ -#TODO: test availability_zone and multi_az -- block: +- name: rds_instance / complex integration tests + collections: + - community.aws + module_defaults: + group/aws: + aws_access_key: '{{ aws_access_key }}' + aws_secret_key: '{{ aws_secret_key }}' + security_token: '{{ security_token | default(omit) }}' + region: '{{ aws_region }}' + block: + #TODO: test availability_zone and multi_az - name: Ensure the resource doesn't exist rds_instance: id: '{{ instance_id }}' diff --git a/tests/integration/targets/rds_instance_modify/aliases b/tests/integration/targets/rds_instance_modify/aliases new file mode 100644 index 00000000000..777fbe40a66 --- /dev/null +++ b/tests/integration/targets/rds_instance_modify/aliases @@ -0,0 +1,3 @@ +cloud/aws +time=15m +rds_instance diff --git a/tests/integration/targets/rds_instance_modify/defaults/main.yml b/tests/integration/targets/rds_instance_modify/defaults/main.yml new file mode 100644 index 00000000000..f1503230004 --- /dev/null +++ b/tests/integration/targets/rds_instance_modify/defaults/main.yml @@ -0,0 +1,9 @@ +instance_id: ansible-test-{{ tiny_prefix }} +modified_instance_id: '{{ instance_id }}-updated' +username: test +password: test12345678 +db_instance_class: db.t3.micro +allocated_storage: 20 + +# For mariadb tests +mariadb_engine_version: 10.3.31 diff --git a/tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_modify.yml b/tests/integration/targets/rds_instance_modify/tasks/main.yml similarity index 92% rename from tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_modify.yml rename to tests/integration/targets/rds_instance_modify/tasks/main.yml index 8e620333786..2bdfc1ec512 100644 --- a/tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_modify.yml +++ b/tests/integration/targets/rds_instance_modify/tasks/main.yml @@ -1,5 +1,13 @@ -#TODO: test availability_zone and multi_az -- block: +- name: rds_instance / modify integration tests + collections: + - community.aws + module_defaults: + group/aws: + aws_access_key: '{{ aws_access_key }}' + aws_secret_key: '{{ aws_secret_key }}' + security_token: '{{ security_token | default(omit) }}' + region: '{{ aws_region }}' + block: - name: Ensure the resource doesn't exist rds_instance: id: '{{ instance_id }}' diff --git a/tests/integration/targets/rds_instance_processor/aliases b/tests/integration/targets/rds_instance_processor/aliases new file mode 100644 index 00000000000..777fbe40a66 --- /dev/null +++ b/tests/integration/targets/rds_instance_processor/aliases @@ -0,0 +1,3 @@ +cloud/aws +time=15m +rds_instance diff --git a/tests/integration/targets/rds_instance_processor/defaults/main.yml b/tests/integration/targets/rds_instance_processor/defaults/main.yml new file mode 100644 index 00000000000..41d99538aa3 --- /dev/null +++ b/tests/integration/targets/rds_instance_processor/defaults/main.yml @@ -0,0 +1,12 @@ +instance_id: ansible-test-{{ tiny_prefix }} +username: test +password: test12345678 +db_instance_class: db.t3.micro +allocated_storage: 20 + +# For oracle tests +# Smallest instance that permits modification of the coreCount +oracle_ee_db_instance_class: db.r5.2xlarge +modified_processor_features: + coreCount: 4 + threadsPerCore: 2 diff --git a/tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_processor.yml b/tests/integration/targets/rds_instance_processor/tasks/main.yml similarity index 92% rename from tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_processor.yml rename to tests/integration/targets/rds_instance_processor/tasks/main.yml index 3d4895dc247..260a37951d7 100644 --- a/tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_processor.yml +++ b/tests/integration/targets/rds_instance_processor/tasks/main.yml @@ -1,4 +1,13 @@ -- block: +- name: rds_instance / processor integration tests + collections: + - community.aws + module_defaults: + group/aws: + aws_access_key: '{{ aws_access_key }}' + aws_secret_key: '{{ aws_secret_key }}' + security_token: '{{ security_token | default(omit) }}' + region: '{{ aws_region }}' + block: - name: Ensure the resource doesn't exist rds_instance: diff --git a/tests/integration/targets/rds_instance_replica/aliases b/tests/integration/targets/rds_instance_replica/aliases new file mode 100644 index 00000000000..4bdc79e4771 --- /dev/null +++ b/tests/integration/targets/rds_instance_replica/aliases @@ -0,0 +1,3 @@ +cloud/aws +time=25m +rds_instance diff --git a/tests/integration/targets/rds_instance_replica/defaults/main.yml b/tests/integration/targets/rds_instance_replica/defaults/main.yml new file mode 100644 index 00000000000..b559f8c3f85 --- /dev/null +++ b/tests/integration/targets/rds_instance_replica/defaults/main.yml @@ -0,0 +1,6 @@ +instance_id: ansible-test-{{ tiny_prefix }} +modified_instance_id: '{{ instance_id }}-updated' +username: test +password: test12345678 +db_instance_class: db.t3.micro +allocated_storage: 20 diff --git a/tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_replica.yml b/tests/integration/targets/rds_instance_replica/tasks/main.yml similarity index 95% rename from tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_replica.yml rename to tests/integration/targets/rds_instance_replica/tasks/main.yml index 6bb01bcfb00..c282f1f23bc 100644 --- a/tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_replica.yml +++ b/tests/integration/targets/rds_instance_replica/tasks/main.yml @@ -1,4 +1,13 @@ -- block: +- name: rds_instance / replica integration tests + collections: + - community.aws + module_defaults: + group/aws: + aws_access_key: '{{ aws_access_key }}' + aws_secret_key: '{{ aws_secret_key }}' + security_token: '{{ security_token | default(omit) }}' + region: '{{ aws_region }}' + block: - name: set the two regions for the source DB and the replica set_fact: diff --git a/tests/integration/targets/rds_instance_restore/aliases b/tests/integration/targets/rds_instance_restore/aliases new file mode 100644 index 00000000000..b9702d2859d --- /dev/null +++ b/tests/integration/targets/rds_instance_restore/aliases @@ -0,0 +1,3 @@ +cloud/aws +time=20m +rds_instance diff --git a/tests/integration/targets/rds_instance_restore/defaults/main.yml b/tests/integration/targets/rds_instance_restore/defaults/main.yml new file mode 100644 index 00000000000..5540ffb8997 --- /dev/null +++ b/tests/integration/targets/rds_instance_restore/defaults/main.yml @@ -0,0 +1,5 @@ +instance_id: ansible-test-{{ tiny_prefix }} +username: test +password: test12345678 +db_instance_class: db.t3.micro +allocated_storage: 20 diff --git a/tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_restore.yml b/tests/integration/targets/rds_instance_restore/tasks/main.yml similarity index 91% rename from tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_restore.yml rename to tests/integration/targets/rds_instance_restore/tasks/main.yml index f734235b551..c872db8804b 100644 --- a/tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_restore.yml +++ b/tests/integration/targets/rds_instance_restore/tasks/main.yml @@ -1,4 +1,13 @@ -- block: +- name: rds_instance / restore integration tests + collections: + - community.aws + module_defaults: + group/aws: + aws_access_key: '{{ aws_access_key }}' + aws_secret_key: '{{ aws_secret_key }}' + security_token: '{{ security_token | default(omit) }}' + region: '{{ aws_region }}' + block: # TODO: snapshot, s3 - name: Ensure the resource doesn't exist diff --git a/tests/integration/targets/rds_instance_sgroups/aliases b/tests/integration/targets/rds_instance_sgroups/aliases new file mode 100644 index 00000000000..777fbe40a66 --- /dev/null +++ b/tests/integration/targets/rds_instance_sgroups/aliases @@ -0,0 +1,3 @@ +cloud/aws +time=15m +rds_instance diff --git a/tests/integration/targets/rds_instance_sgroups/defaults/main.yml b/tests/integration/targets/rds_instance_sgroups/defaults/main.yml new file mode 100644 index 00000000000..5540ffb8997 --- /dev/null +++ b/tests/integration/targets/rds_instance_sgroups/defaults/main.yml @@ -0,0 +1,5 @@ +instance_id: ansible-test-{{ tiny_prefix }} +username: test +password: test12345678 +db_instance_class: db.t3.micro +allocated_storage: 20 diff --git a/tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_sgroups.yml b/tests/integration/targets/rds_instance_sgroups/tasks/main.yml similarity index 96% rename from tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_sgroups.yml rename to tests/integration/targets/rds_instance_sgroups/tasks/main.yml index 1847d7cf683..45c8f3b4e62 100644 --- a/tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_sgroups.yml +++ b/tests/integration/targets/rds_instance_sgroups/tasks/main.yml @@ -1,4 +1,12 @@ -- name: rds_instance test_vpc_security_groups tests +- name: rds_instance / sgroups integration tests + collections: + - community.aws + module_defaults: + group/aws: + aws_access_key: '{{ aws_access_key }}' + aws_secret_key: '{{ aws_secret_key }}' + security_token: '{{ security_token | default(omit) }}' + region: '{{ aws_region }}' block: - name: create a VPC diff --git a/tests/integration/targets/rds_instance_snapshot_mgmt/aliases b/tests/integration/targets/rds_instance_snapshot_mgmt/aliases new file mode 100644 index 00000000000..c4ee3f5a640 --- /dev/null +++ b/tests/integration/targets/rds_instance_snapshot_mgmt/aliases @@ -0,0 +1,4 @@ +cloud/aws +rds_instance_info +time=30m +rds_instance diff --git a/tests/integration/targets/rds_instance_snapshot_mgmt/defaults/main.yml b/tests/integration/targets/rds_instance_snapshot_mgmt/defaults/main.yml new file mode 100644 index 00000000000..d2ebe7f1881 --- /dev/null +++ b/tests/integration/targets/rds_instance_snapshot_mgmt/defaults/main.yml @@ -0,0 +1,9 @@ +instance_id: ansible-test-{{ tiny_prefix }} +modified_instance_id: '{{ instance_id }}-updated' +username: test +password: test12345678 +db_instance_class: db.t3.micro +allocated_storage: 20 + +# For snapshot tests +snapshot_id: '{{ instance_id }}-ss' diff --git a/tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_snapshot.yml b/tests/integration/targets/rds_instance_snapshot_mgmt/tasks/main.yml similarity index 94% rename from tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_snapshot.yml rename to tests/integration/targets/rds_instance_snapshot_mgmt/tasks/main.yml index bcdaf190b5b..f8ac5d5f965 100644 --- a/tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_snapshot.yml +++ b/tests/integration/targets/rds_instance_snapshot_mgmt/tasks/main.yml @@ -1,4 +1,13 @@ -- block: +- name: rds_instance / snapshot_mgmt integration tests + collections: + - community.aws + module_defaults: + group/aws: + aws_access_key: '{{ aws_access_key }}' + aws_secret_key: '{{ aws_secret_key }}' + security_token: '{{ security_token | default(omit) }}' + region: '{{ aws_region }}' + block: - name: Ensure the resource doesn't exist rds_instance: id: '{{ instance_id }}' diff --git a/tests/integration/targets/rds_instance/aliases b/tests/integration/targets/rds_instance_states/aliases similarity index 57% rename from tests/integration/targets/rds_instance/aliases rename to tests/integration/targets/rds_instance_states/aliases index d79ad32a38f..de79d418d95 100644 --- a/tests/integration/targets/rds_instance/aliases +++ b/tests/integration/targets/rds_instance_states/aliases @@ -1,4 +1,4 @@ -slow - cloud/aws rds_instance_info +time=15m +rds_instance \ No newline at end of file diff --git a/tests/integration/targets/rds_instance_states/defaults/main.yml b/tests/integration/targets/rds_instance_states/defaults/main.yml new file mode 100644 index 00000000000..5540ffb8997 --- /dev/null +++ b/tests/integration/targets/rds_instance_states/defaults/main.yml @@ -0,0 +1,5 @@ +instance_id: ansible-test-{{ tiny_prefix }} +username: test +password: test12345678 +db_instance_class: db.t3.micro +allocated_storage: 20 diff --git a/tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_states.yml b/tests/integration/targets/rds_instance_states/tasks/main.yml similarity index 95% rename from tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_states.yml rename to tests/integration/targets/rds_instance_states/tasks/main.yml index c9291be5d64..fdcfcbf8a73 100644 --- a/tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_states.yml +++ b/tests/integration/targets/rds_instance_states/tasks/main.yml @@ -1,4 +1,13 @@ -- block: +- name: rds_instance / states integration tests + collections: + - community.aws + module_defaults: + group/aws: + aws_access_key: '{{ aws_access_key }}' + aws_secret_key: '{{ aws_secret_key }}' + security_token: '{{ security_token | default(omit) }}' + region: '{{ aws_region }}' + block: - name: Ensure the resource doesn't exist rds_instance: id: '{{ instance_id }}' diff --git a/tests/integration/targets/rds_instance_tagging/aliases b/tests/integration/targets/rds_instance_tagging/aliases new file mode 100644 index 00000000000..777fbe40a66 --- /dev/null +++ b/tests/integration/targets/rds_instance_tagging/aliases @@ -0,0 +1,3 @@ +cloud/aws +time=15m +rds_instance diff --git a/tests/integration/targets/rds_instance_tagging/defaults/main.yml b/tests/integration/targets/rds_instance_tagging/defaults/main.yml new file mode 100644 index 00000000000..b559f8c3f85 --- /dev/null +++ b/tests/integration/targets/rds_instance_tagging/defaults/main.yml @@ -0,0 +1,6 @@ +instance_id: ansible-test-{{ tiny_prefix }} +modified_instance_id: '{{ instance_id }}-updated' +username: test +password: test12345678 +db_instance_class: db.t3.micro +allocated_storage: 20 diff --git a/tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_tagging.yml b/tests/integration/targets/rds_instance_tagging/tasks/main.yml similarity index 94% rename from tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_tagging.yml rename to tests/integration/targets/rds_instance_tagging/tasks/main.yml index 7b15dc48e38..72ce4a826fc 100644 --- a/tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_tagging.yml +++ b/tests/integration/targets/rds_instance_tagging/tasks/main.yml @@ -1,4 +1,13 @@ -- block: +- name: rds_instance / tagging integration tests + collections: + - community.aws + module_defaults: + group/aws: + aws_access_key: '{{ aws_access_key }}' + aws_secret_key: '{{ aws_secret_key }}' + security_token: '{{ security_token | default(omit) }}' + region: '{{ aws_region }}' + block: - name: Ensure the resource doesn't exist rds_instance: id: '{{ instance_id }}' diff --git a/tests/integration/targets/rds_instance_upgrade/aliases b/tests/integration/targets/rds_instance_upgrade/aliases new file mode 100644 index 00000000000..777fbe40a66 --- /dev/null +++ b/tests/integration/targets/rds_instance_upgrade/aliases @@ -0,0 +1,3 @@ +cloud/aws +time=15m +rds_instance diff --git a/tests/integration/targets/rds_instance_upgrade/defaults/main.yml b/tests/integration/targets/rds_instance_upgrade/defaults/main.yml new file mode 100644 index 00000000000..7cb826f0f8c --- /dev/null +++ b/tests/integration/targets/rds_instance_upgrade/defaults/main.yml @@ -0,0 +1,10 @@ +instance_id: ansible-test-{{ tiny_prefix }} +modified_instance_id: '{{ instance_id }}-updated' +username: test +password: test12345678 +db_instance_class: db.t3.micro +allocated_storage: 20 + +# For mariadb tests +mariadb_engine_version: 10.3.31 +mariadb_engine_version_2: 10.4.21 diff --git a/tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_upgrade.yml b/tests/integration/targets/rds_instance_upgrade/tasks/main.yml similarity index 91% rename from tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_upgrade.yml rename to tests/integration/targets/rds_instance_upgrade/tasks/main.yml index ba1397bf46c..5a21125435a 100644 --- a/tests/integration/targets/rds_instance/roles/rds_instance/tasks/test_upgrade.yml +++ b/tests/integration/targets/rds_instance_upgrade/tasks/main.yml @@ -1,4 +1,13 @@ -- block: +- name: rds_instance / upgrade integration tests + collections: + - community.aws + module_defaults: + group/aws: + aws_access_key: '{{ aws_access_key }}' + aws_secret_key: '{{ aws_secret_key }}' + security_token: '{{ security_token | default(omit) }}' + region: '{{ aws_region }}' + block: - name: Ensure the resource doesn't exist rds_instance: id: '{{ instance_id }}'