postgresql: move CI tests to separate targets (#62732)

This commit is contained in:
Andrey Klychkov 2019-09-23 11:28:52 +03:00 committed by John R Barker
parent cb76be17d6
commit 0530a08b67
15 changed files with 82 additions and 23 deletions

View file

@ -5,8 +5,5 @@ postgresql_lang
postgresql_pg_hba
postgresql_privs
postgresql_schema
postgresql_sequence
postgresql_set
postgresql_table
postgresql_user
skip/osx

View file

@ -10,9 +10,6 @@
- ansible_os_family == 'Debian'
- postgres_version_resp.stdout is version('9.4', '>=')
- include_tasks: postgresql_set.yml
when: postgres_version_resp.stdout is version('9.4', '>=')
- include_tasks: '{{ loop_item }}'
loop:
# Test postgresql_user module
@ -30,9 +27,6 @@
# Test postgresql_schema module
- postgresql_schema.yml
# Test postgresql_table module
- postgresql_table.yml
# Test postgres_pg_hba module
- postgresql_pg_hba.yml
loop_control:
@ -42,10 +36,6 @@
- import_tasks: test_target_role.yml
when: postgres_version_resp.stdout is version('9.1', '>=')
# Test postgresql_sequence module
- import_tasks: postgresql_sequence.yml
when: postgres_version_resp.stdout is version('9.0', '>=')
# Test postgresql_lang module.
# To implement tests, it needs to install some additional packages
# that may cause problems on different distributions,

View file

@ -0,0 +1,4 @@
destructive
shippable/posix/group4
postgresql_sequence
skip/osx

View file

@ -0,0 +1,5 @@
---
db_name: 'ansible_db'
db_user1: 'ansible_db_user1'
db_user2: 'ansible_db_user2'
db_default: 'postgres'

View file

@ -0,0 +1,3 @@
---
dependencies:
- setup_postgresql_db

View file

@ -0,0 +1,3 @@
# Initial CI tests of postgresql_sequence module
- import_tasks: postgresql_sequence_initial.yml
when: postgres_version_resp.stdout is version('9.0', '>=')

View file

@ -2,15 +2,6 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Preparation for tests.
- name: postgresql_sequence - create DB
become_user: "{{ pg_user }}"
become: yes
postgresql_db:
state: present
name: "{{ db_name }}"
owner: "{{ db_user1 }}"
login_user: "{{ pg_user }}"
- name: postgresql_sequence - create a user to be owner of a database
become_user: "{{ pg_user }}"
become: yes
@ -20,7 +11,16 @@
encrypted: yes
password: password
role_attr_flags: LOGIN
db: "{{ db_name }}"
db: "{{ db_default }}"
login_user: "{{ pg_user }}"
- name: postgresql_sequence - create DB
become_user: "{{ pg_user }}"
become: yes
postgresql_db:
state: present
name: "{{ db_name }}"
owner: "{{ db_user1 }}"
login_user: "{{ pg_user }}"
- name: Create a user to be owner of a sequence
@ -694,3 +694,15 @@
state: absent
name: "{{ db_name }}"
login_user: "{{ pg_user }}"
- name: remove test roles
become_user: "{{ pg_user }}"
become: yes
postgresql_user:
state: absent
login_db: "{{ db_default }}"
login_user: "{{ pg_user }}"
name: "{{ item }}"
loop:
- "{{ db_user1 }}"
- "{{ db_user2 }}"

View file

@ -0,0 +1,4 @@
destructive
shippable/posix/group4
postgresql_set
skip/osx

View file

@ -0,0 +1,3 @@
---
dependencies:
- setup_postgresql_db

View file

@ -0,0 +1,3 @@
# Initial CI tests of postgresql_initial module
- include_tasks: postgresql_set_initial.yml
when: postgres_version_resp.stdout is version('9.4', '>=')

View file

@ -0,0 +1,4 @@
destructive
shippable/posix/group4
postgresql_table
skip/osx

View file

@ -0,0 +1,3 @@
---
dependencies:
- setup_postgresql_db

View file

@ -0,0 +1,2 @@
# Initial CI tests of postgresql_table module
- import_tasks: postgresql_table_initial.yml

View file

@ -852,3 +852,29 @@
that:
- result is changed
- result.queries == ['ALTER TABLE "public"."test_schema_table" RENAME TO "new_test_schema_table"']
#
# Clean up
#
- name: postgresql_table - drop test schema
become_user: "{{ pg_user }}"
become: yes
postgresql_schema:
database: postgres
login_user: "{{ pg_user }}"
name: acme
state: absent
cascade_drop: yes
- name: postgresql_table - drop test role
become_user: "{{ pg_user }}"
become: yes
postgresql_user:
db: postgres
login_user: "{{ pg_user }}"
name: "{{ item }}"
state: absent
loop:
- test_user
- alice
ignore_errors: yes