Skip to content

Commit df7a745

Browse files
fila43richm
authored andcommitted
fix: Add test for postgresql_cert_name
1 parent 3397099 commit df7a745

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

tests/tests_custom_certificate.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
3+
- name: Test PostgreSQL server with ssl support using certificate role
4+
hosts: all
5+
tasks:
6+
- name: Test PostgreSQL server user certificate in custom path
7+
vars:
8+
postgresql_password: redhat
9+
block:
10+
- name: Generate certificate using certificate role
11+
include_role:
12+
name: fedora.linux_system_roles.certificate
13+
vars:
14+
certificate_requests:
15+
- name: /etc/pki/tls/certs/postgresql_test
16+
dns: www.example.com
17+
ca: self-sign
18+
19+
- name: Deploy postgresql
20+
include_tasks: tasks/install_and_check.yml
21+
vars:
22+
__test_clean_instance: false
23+
__test_check_unix_socket: false
24+
postgresql_cert_name: /etc/pki/tls/certs/postgresql_test
25+
postgresql_ssl_enable: true
26+
postgresql_pg_hba_conf:
27+
- type: hostssl
28+
database: all
29+
user: all
30+
auth_method: md5
31+
address: '127.0.0.1/32'
32+
33+
- name: Gather output of psql
34+
environment:
35+
PGPASSWORD: "{{ postgresql_password }}"
36+
shell: |
37+
set -euo pipefail
38+
echo "\conninfo" | psql -U postgres -h 127.0.0.1
39+
register: result
40+
changed_when: false
41+
42+
- name: Check output of psql
43+
assert:
44+
that: >-
45+
"SSL connection" in result.stdout
46+
always:
47+
- name: Clean up
48+
include_tasks: tasks/clean_instance.yml
49+
tags: tests::cleanup

0 commit comments

Comments
 (0)