From 7b3d8431dd743b897d069ab1cbb905c4e327a6ee Mon Sep 17 00:00:00 2001 From: Andrey Klychkov Date: Thu, 19 Sep 2019 16:57:45 +0300 Subject: [PATCH] postgresql: move CI tests of *_tablespace, *_membership, *_idx to separate targets (#62575) * postgresql: move CI tests of *_tablespace, *_membership, *_idx to separate targets * postgresql: move CI tests of *_tablespace, *_membership, *_idx to separate targets, change formatting --- test/integration/targets/postgresql/aliases | 3 -- .../targets/postgresql/tasks/main.yml | 9 ------ .../postgresql/tasks/postgresql_db.yml | 32 ++++++++++++++++--- .../targets/postgresql_idx/aliases | 4 +++ .../targets/postgresql_idx/meta/main.yml | 3 ++ .../targets/postgresql_idx/tasks/main.yml | 2 ++ .../tasks/postgresql_idx_initial.yml} | 0 .../targets/postgresql_membership/aliases | 4 +++ .../postgresql_membership/meta/main.yml | 3 ++ .../postgresql_membership/tasks/main.yml | 2 ++ .../tasks/postgresql_membership_initial.yml} | 0 .../targets/postgresql_tablespace/aliases | 4 +++ .../postgresql_tablespace/defaults/main.yml | 2 ++ .../postgresql_tablespace/meta/main.yml | 3 ++ .../postgresql_tablespace/tasks/main.yml | 2 ++ .../tasks/postgresql_tablespace_initial.yml} | 4 +-- 16 files changed, 59 insertions(+), 18 deletions(-) create mode 100644 test/integration/targets/postgresql_idx/aliases create mode 100644 test/integration/targets/postgresql_idx/meta/main.yml create mode 100644 test/integration/targets/postgresql_idx/tasks/main.yml rename test/integration/targets/{postgresql/tasks/postgresql_idx.yml => postgresql_idx/tasks/postgresql_idx_initial.yml} (100%) create mode 100644 test/integration/targets/postgresql_membership/aliases create mode 100644 test/integration/targets/postgresql_membership/meta/main.yml create mode 100644 test/integration/targets/postgresql_membership/tasks/main.yml rename test/integration/targets/{postgresql/tasks/postgresql_membership.yml => postgresql_membership/tasks/postgresql_membership_initial.yml} (100%) create mode 100644 test/integration/targets/postgresql_tablespace/aliases create mode 100644 test/integration/targets/postgresql_tablespace/defaults/main.yml create mode 100644 test/integration/targets/postgresql_tablespace/meta/main.yml create mode 100644 test/integration/targets/postgresql_tablespace/tasks/main.yml rename test/integration/targets/{postgresql/tasks/postgresql_tablespace.yml => postgresql_tablespace/tasks/postgresql_tablespace_initial.yml} (98%) diff --git a/test/integration/targets/postgresql/aliases b/test/integration/targets/postgresql/aliases index f0ed8d31840..13148010ddb 100644 --- a/test/integration/targets/postgresql/aliases +++ b/test/integration/targets/postgresql/aliases @@ -2,9 +2,7 @@ destructive shippable/posix/group4 postgresql_db postgresql_ext -postgresql_idx postgresql_lang -postgresql_membership postgresql_pg_hba postgresql_privs postgresql_publication @@ -13,6 +11,5 @@ postgresql_sequence postgresql_set postgresql_slot postgresql_table -postgresql_tablespace postgresql_user skip/osx diff --git a/test/integration/targets/postgresql/tasks/main.yml b/test/integration/targets/postgresql/tasks/main.yml index d4312b0b730..0a9b53bff8f 100644 --- a/test/integration/targets/postgresql/tasks/main.yml +++ b/test/integration/targets/postgresql/tasks/main.yml @@ -34,12 +34,6 @@ # Verify different session_role scenarios - session_role.yml - # Test postgresql_idx module - - postgresql_idx.yml - - # Test postgresql_tablespace module - - postgresql_tablespace.yml - # Test postgresql_db module, specific options - postgresql_db.yml @@ -49,9 +43,6 @@ # Test postgresql_schema module - postgresql_schema.yml - # Test postgresql_membership module - - postgresql_membership.yml - # Test postgresql_table module - postgresql_table.yml diff --git a/test/integration/targets/postgresql/tasks/postgresql_db.yml b/test/integration/targets/postgresql/tasks/postgresql_db.yml index d24568c8ace..f47c521127b 100644 --- a/test/integration/targets/postgresql/tasks/postgresql_db.yml +++ b/test/integration/targets/postgresql/tasks/postgresql_db.yml @@ -16,13 +16,37 @@ # Start tablespace option tests: block: - # create tablespace for tests - - name: postgresql_db_tablespace - Create tablespace - <<: *task_parameters + # Preparation for tests. + - name: postgresql_db - drop dir for test tablespace + become: yes + become_user: root + file: + path: "{{ tblspc_location }}" + state: absent + ignore_errors: yes + + - name: postgresql_db - disable selinux + become: yes + become_user: root + shell: setenforce 0 + ignore_errors: yes + + - name: postgresql_db - create dir for test tablespace + become: yes + become_user: root + file: + path: "{{ tblspc_location }}" + state: directory + owner: "{{ pg_user }}" + group: "{{ pg_user }}" + mode: 0700 + + # Create tablespace: + - name: postgresql_db_ - create a new tablespace postgresql_tablespace: <<: *pg_parameters login_db: postgres - name: "{{ db_tablespace }}" + name: "{{ db_tablespace }}" location: "{{ tblspc_location }}" # Check mode for DB creation with tablespace option: diff --git a/test/integration/targets/postgresql_idx/aliases b/test/integration/targets/postgresql_idx/aliases new file mode 100644 index 00000000000..4ac11c3d26e --- /dev/null +++ b/test/integration/targets/postgresql_idx/aliases @@ -0,0 +1,4 @@ +destructive +shippable/posix/group4 +postgresql_idx +skip/osx diff --git a/test/integration/targets/postgresql_idx/meta/main.yml b/test/integration/targets/postgresql_idx/meta/main.yml new file mode 100644 index 00000000000..f3345cb6151 --- /dev/null +++ b/test/integration/targets/postgresql_idx/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: +- setup_postgresql_db diff --git a/test/integration/targets/postgresql_idx/tasks/main.yml b/test/integration/targets/postgresql_idx/tasks/main.yml new file mode 100644 index 00000000000..22ec9d4a9ce --- /dev/null +++ b/test/integration/targets/postgresql_idx/tasks/main.yml @@ -0,0 +1,2 @@ +# Initial CI tests of postgresql_idx module +- import_tasks: postgresql_idx_initial.yml diff --git a/test/integration/targets/postgresql/tasks/postgresql_idx.yml b/test/integration/targets/postgresql_idx/tasks/postgresql_idx_initial.yml similarity index 100% rename from test/integration/targets/postgresql/tasks/postgresql_idx.yml rename to test/integration/targets/postgresql_idx/tasks/postgresql_idx_initial.yml diff --git a/test/integration/targets/postgresql_membership/aliases b/test/integration/targets/postgresql_membership/aliases new file mode 100644 index 00000000000..70678f4c771 --- /dev/null +++ b/test/integration/targets/postgresql_membership/aliases @@ -0,0 +1,4 @@ +destructive +shippable/posix/group4 +postgresql_membership +skip/osx diff --git a/test/integration/targets/postgresql_membership/meta/main.yml b/test/integration/targets/postgresql_membership/meta/main.yml new file mode 100644 index 00000000000..f3345cb6151 --- /dev/null +++ b/test/integration/targets/postgresql_membership/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: +- setup_postgresql_db diff --git a/test/integration/targets/postgresql_membership/tasks/main.yml b/test/integration/targets/postgresql_membership/tasks/main.yml new file mode 100644 index 00000000000..89ce1d0fff3 --- /dev/null +++ b/test/integration/targets/postgresql_membership/tasks/main.yml @@ -0,0 +1,2 @@ +# Initial CI tests of postgresql_membership module +- import_tasks: postgresql_membership_initial.yml diff --git a/test/integration/targets/postgresql/tasks/postgresql_membership.yml b/test/integration/targets/postgresql_membership/tasks/postgresql_membership_initial.yml similarity index 100% rename from test/integration/targets/postgresql/tasks/postgresql_membership.yml rename to test/integration/targets/postgresql_membership/tasks/postgresql_membership_initial.yml diff --git a/test/integration/targets/postgresql_tablespace/aliases b/test/integration/targets/postgresql_tablespace/aliases new file mode 100644 index 00000000000..489dbd6f0a0 --- /dev/null +++ b/test/integration/targets/postgresql_tablespace/aliases @@ -0,0 +1,4 @@ +destructive +shippable/posix/group4 +postgresql_tablespace +skip/osx diff --git a/test/integration/targets/postgresql_tablespace/defaults/main.yml b/test/integration/targets/postgresql_tablespace/defaults/main.yml new file mode 100644 index 00000000000..62370e8aeb0 --- /dev/null +++ b/test/integration/targets/postgresql_tablespace/defaults/main.yml @@ -0,0 +1,2 @@ +--- +test_tablespace_path: "/ssd" diff --git a/test/integration/targets/postgresql_tablespace/meta/main.yml b/test/integration/targets/postgresql_tablespace/meta/main.yml new file mode 100644 index 00000000000..f3345cb6151 --- /dev/null +++ b/test/integration/targets/postgresql_tablespace/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: +- setup_postgresql_db diff --git a/test/integration/targets/postgresql_tablespace/tasks/main.yml b/test/integration/targets/postgresql_tablespace/tasks/main.yml new file mode 100644 index 00000000000..72a8cb6994e --- /dev/null +++ b/test/integration/targets/postgresql_tablespace/tasks/main.yml @@ -0,0 +1,2 @@ +# Initial CI tests of postgresql_tablespace module +- import_tasks: postgresql_tablespace_initial.yml diff --git a/test/integration/targets/postgresql/tasks/postgresql_tablespace.yml b/test/integration/targets/postgresql_tablespace/tasks/postgresql_tablespace_initial.yml similarity index 98% rename from test/integration/targets/postgresql/tasks/postgresql_tablespace.yml rename to test/integration/targets/postgresql_tablespace/tasks/postgresql_tablespace_initial.yml index ea6e3366228..4bf95395c7e 100644 --- a/test/integration/targets/postgresql/tasks/postgresql_tablespace.yml +++ b/test/integration/targets/postgresql_tablespace/tasks/postgresql_tablespace_initial.yml @@ -5,7 +5,7 @@ - name: postgresql_tablespace - drop dir for test tablespace become: yes file: - path: /ssd + path: "{{ test_tablespace_path }}" state: absent ignore_errors: yes @@ -17,7 +17,7 @@ - name: postgresql_tablespace - create dir for test tablespace become: yes file: - path: /ssd + path: "{{ test_tablespace_path }}" state: directory owner: "{{ pg_user }}" group: "{{ pg_user }}"