Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2c2094b

Browse files
committedOct 13, 2024·
fix: Add test for postgresql_cert_name
1 parent 0b2d126 commit 2c2094b

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
 

‎tests/tests_custom_certificate.yaml

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

0 commit comments

Comments
 (0)
Please sign in to comment.