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 test to separate targets #62823

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,3 @@ pg_hba_test_ips:
- source: '172.16.0.0'
netmask: '255.255.0.0'
method: trust

# defaults for test SSL
ssl_db: 'ssl_db'
ssl_user: 'ssl_user'
ssl_pass: 'ssl_pass'
ssl_rootcert: '~{{ pg_user }}/root.crt'
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
# Unsorted tests that were moved from here to unsorted.yml
- import_tasks: unsorted.yml

# Test ssl.
# Restricted using Debian family because of there are errors on other distributions
# that not related with PostgreSQL or psycopg2 SSL support.
# The tests' key point is to be sure that ssl options work in general
- import_tasks: ssl.yml
when:
- ansible_os_family == 'Debian'
- postgres_version_resp.stdout is version('9.4', '>=')

- include_tasks: '{{ loop_item }}'
loop:
# Test postgresql_user module
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,26 @@
- result.is_available == false
- result.server_version == {}
- result is not changed

- name: postgresql_ping - ping DB with SSL
become_user: "{{ pg_user }}"
become: yes
postgresql_ping:
db: "{{ ssl_db }}"
login_user: "{{ ssl_user }}"
login_password: "{{ ssl_pass }}"
login_host: 127.0.0.1
login_port: 5432
ssl_mode: require
ca_cert: '{{ ssl_rootcert }}'
register: result
when:
- ansible_os_family == 'Debian'
- postgres_version_resp.stdout is version('9.4', '>=')

- assert:
that:
- result.is_available == true
when:
- ansible_os_family == 'Debian'
- postgres_version_resp.stdout is version('9.4', '>=')
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ pg_group: root

locale_latin_suffix:
locale_utf8_suffix:

# defaults for test SSL
ssl_db: 'ssl_db'
ssl_user: 'ssl_user'
ssl_pass: 'ssl_pass'
ssl_rootcert: '~{{ pg_user }}/root.crt'
9 changes: 9 additions & 0 deletions test/integration/targets/setup_postgresql_db/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,12 @@
- name: Print PostgreSQL server version
debug:
msg: "{{ postgres_version_resp.stdout }}"

# SSL configuration.
# Restricted using Debian family because of there are errors on other distributions
# that not related with PostgreSQL or psycopg2 SSL support.
# The tests key point is to be sure that ssl options work in general
- import_tasks: ssl.yml
when:
- ansible_os_family == 'Debian'
- postgres_version_resp.stdout is version('9.4', '>=')
Original file line number Diff line number Diff line change
Expand Up @@ -79,27 +79,3 @@
service:
name: "{{ postgresql_service }}"
state: reloaded

###############
# Do main tests

- name: postgresql SSL - ping DB with SSL
become_user: "{{ pg_user }}"
become: yes
postgresql_ping:
db: "{{ ssl_db }}"
login_user: "{{ ssl_user }}"
login_password: "{{ ssl_pass }}"
login_host: 127.0.0.1
login_port: 5432
ssl_mode: require
ca_cert: '{{ ssl_rootcert }}'
register: result

- assert:
that:
- result.is_available == true

###################################################
# I decided not to clean ssl_db, ssl_user and certs
# for testing options related with SSL in other modules