Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

postgresql: move CI tests to separate targets #62773

Merged
merged 1 commit into from
Sep 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 0 additions & 3 deletions test/integration/targets/postgresql/aliases
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
destructive
shippable/posix/group4
postgresql_db
postgresql_lang
postgresql_pg_hba
postgresql_privs
postgresql_schema
postgresql_user
skip/osx
15 changes: 0 additions & 15 deletions test/integration/targets/postgresql/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,13 @@

# Test postgresql_privs
- postgresql_privs.yml

# Test postgresql_schema module
- postgresql_schema.yml

# Test postgres_pg_hba module
- postgresql_pg_hba.yml
loop_control:
loop_var: loop_item

# Test default_privs with target_role
- import_tasks: test_target_role.yml
when: postgres_version_resp.stdout is version('9.1', '>=')

# Test postgresql_lang module.
# To implement tests, it needs to install some additional packages
# that may cause problems on different distributions,
# so I restricted the tests using CentOS because the results
# depend only on Postgres version
# (CentOS 6 repo contains the oldest PG version in these tests - 9.0):
- import_tasks: postgresql_lang.yml
when: ansible_distribution == 'CentOS'

# dump/restore tests per format
# ============================================================
- include_tasks: state_dump_restore.yml
Expand Down
1 change: 0 additions & 1 deletion test/integration/targets/postgresql_copy/aliases
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
destructive
shippable/posix/group4
postgresql_copy
skip/osx
1 change: 0 additions & 1 deletion test/integration/targets/postgresql_ext/aliases
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
destructive
shippable/posix/group4
postgresql_ext
skip/osx
1 change: 0 additions & 1 deletion test/integration/targets/postgresql_idx/aliases
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
destructive
shippable/posix/group4
postgresql_idx
skip/osx
1 change: 0 additions & 1 deletion test/integration/targets/postgresql_info/aliases
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
destructive
shippable/posix/group4
postgresql_info
skip/osx
3 changes: 3 additions & 0 deletions test/integration/targets/postgresql_lang/aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
destructive
shippable/posix/group4
skip/osx
3 changes: 3 additions & 0 deletions test/integration/targets/postgresql_lang/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
dependencies:
- setup_postgresql_db
3 changes: 3 additions & 0 deletions test/integration/targets/postgresql_lang/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Initial CI tests of postgresql_lang module
- import_tasks: postgresql_lang_initial.yml
when: ansible_distribution == 'CentOS'
1 change: 0 additions & 1 deletion test/integration/targets/postgresql_membership/aliases
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
destructive
shippable/posix/group4
postgresql_membership
skip/osx
1 change: 0 additions & 1 deletion test/integration/targets/postgresql_owner/aliases
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
destructive
shippable/posix/group4
postgresql_owner
skip/osx
3 changes: 3 additions & 0 deletions test/integration/targets/postgresql_pg_hba/aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
destructive
shippable/posix/group4
skip/osx
23 changes: 23 additions & 0 deletions test/integration/targets/postgresql_pg_hba/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
pg_hba_test_ips:
- contype: local
users: 'all,postgres,test'
- source: '0000:ffff::'
netmask: 'ffff:fff0::'
- source: '192.168.0.0/24'
netmask: ''
databases: 'all,replication'
- source: '192.168.1.0/24'
netmask: ''
databases: 'all'
method: reject
- source: '127.0.0.1/32'
netmask: ''
- source: '::1/128'
netmask: ''
- source: '0000:ff00::'
netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ff00'
method: scram-sha-256
- source: '172.16.0.0'
netmask: '255.255.0.0'
method: trust
3 changes: 3 additions & 0 deletions test/integration/targets/postgresql_pg_hba/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
dependencies:
- setup_postgresql_db
2 changes: 2 additions & 0 deletions test/integration/targets/postgresql_pg_hba/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Initial CI tests of postgresql_pg_hba module
- import_tasks: postgresql_pg_hba_initial.yml
1 change: 0 additions & 1 deletion test/integration/targets/postgresql_ping/aliases
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
destructive
shippable/posix/group4
postgresql_ping
skip/osx
1 change: 0 additions & 1 deletion test/integration/targets/postgresql_publication/aliases
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
destructive
shippable/posix/group4
postgresql_publication
skip/osx
1 change: 0 additions & 1 deletion test/integration/targets/postgresql_query/aliases
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
destructive
shippable/posix/group4
postgresql_query
skip/osx
3 changes: 3 additions & 0 deletions test/integration/targets/postgresql_schema/aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
destructive
shippable/posix/group4
skip/osx
4 changes: 4 additions & 0 deletions test/integration/targets/postgresql_schema/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
db_name: 'ansible_db'
db_user1: 'ansible_db_user1'
db_user2: 'ansible_db_user2'
3 changes: 3 additions & 0 deletions test/integration/targets/postgresql_schema/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
dependencies:
- setup_postgresql_db
2 changes: 2 additions & 0 deletions test/integration/targets/postgresql_schema/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Initial CI tests of postgresql_schema module
- import_tasks: postgresql_schema_initial.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
---

# Setup
- name: Create test roles
postgresql_user:
name: "{{ item }}"
state: present
encrypted: yes
password: password
role_attr_flags: LOGIN
db: postgres
login_user: "{{ pg_user }}"
loop:
- "{{ db_user1 }}"
- "{{ db_user2 }}"

- name: Create DB
become_user: "{{ pg_user }}"
become: yes
Expand All @@ -10,16 +23,6 @@
owner: "{{ db_user1 }}"
login_user: "{{ pg_user }}"

- name: Create a user to be owner of a schema
postgresql_user:
name: "{{ db_user2 }}"
state: present
encrypted: yes
password: password
role_attr_flags: LOGIN
db: "{{ db_name }}"
login_user: "{{ pg_user }}"

# Test: CREATE SCHEMA in checkmode
- name: Create a new schema with name "acme" in check_mode
become_user: "{{ pg_user }}"
Expand Down
1 change: 0 additions & 1 deletion test/integration/targets/postgresql_sequence/aliases
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
destructive
shippable/posix/group4
postgresql_sequence
skip/osx
1 change: 0 additions & 1 deletion test/integration/targets/postgresql_set/aliases
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
destructive
shippable/posix/group4
postgresql_set
skip/osx
1 change: 0 additions & 1 deletion test/integration/targets/postgresql_slot/aliases
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
destructive
shippable/posix/group4
postgresql_slot
skip/osx
1 change: 0 additions & 1 deletion test/integration/targets/postgresql_table/aliases
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
destructive
shippable/posix/group4
postgresql_table
skip/osx
1 change: 0 additions & 1 deletion test/integration/targets/postgresql_tablespace/aliases
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
destructive
shippable/posix/group4
postgresql_tablespace
skip/osx