Skip to content

Commit eaaa13c

Browse files
committed
Add journalctl in the cleanup section
1 parent 2e869ab commit eaaa13c

File tree

2 files changed

+11
-92
lines changed

2 files changed

+11
-92
lines changed

tests/clean_instance.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@
1313
file:
1414
path: /var/lib/pgsql/data
1515
state: absent
16+
17+
- name: Dump logs
18+
command: journalctl -u postgresql
19+
changed_when: false

tests/tests_certificate.yml

Lines changed: 7 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,7 @@
11
---
22
- name: Test PostgreSQL server with ssl support using certificate role
33
hosts: all
4-
54
tasks:
6-
- name: Test PostgreSQL server with certificate in non default path
7-
block:
8-
- name: Deploy postgresql
9-
include_role:
10-
name: linux-system-roles.postgresql
11-
vars:
12-
postgresql_certificates:
13-
- name: /tmp/tmp_cert
14-
dns: www.example.com
15-
ca: self-sign
16-
postgresql_ssl_enable: yes
17-
18-
- meta: flush_handlers
19-
20-
- name: Gather output of psql
21-
environment:
22-
PGPASSWORD: "{{ postgresql_password }}"
23-
shell: |
24-
set -euo pipefail
25-
echo "\conninfo" | psql -U postgres -h 127.0.0.1
26-
register: result
27-
changed_when: false
28-
29-
- name: Check output of psql
30-
assert:
31-
that: >
32-
"SSL connection" in result.stdout
33-
34-
vars:
35-
postgresql_password: redhat
36-
postgresql_pg_hba_conf:
37-
- type: hostssl
38-
database: all
39-
user: all
40-
auth_method: md5
41-
address: '127.0.0.1/32'
42-
postgresql_ssl_enable: yes
43-
always:
44-
- name: Clean up
45-
include_tasks: clean_instance.yml
46-
475
- name: Test PostgreSQL server with certificate in default path
486
block:
497
- name: Deploy postgresql
@@ -55,62 +13,12 @@
5513
dns: www.example.com
5614
ca: self-sign
5715
postgresql_ssl_enable: yes
58-
59-
- meta: flush_handlers
60-
61-
- name: Gather output of psql
62-
environment:
63-
PGPASSWORD: "{{ postgresql_password }}"
64-
shell: |
65-
set -euo pipefail
66-
echo "\conninfo" | psql -U postgres -h 127.0.0.1
67-
register: result
68-
changed_when: false
69-
70-
- name: Check output of psql
71-
assert:
72-
that: >
73-
"SSL connection" in result.stdout
74-
75-
vars:
76-
postgresql_password: redhat
77-
postgresql_pg_hba_conf:
78-
- type: hostssl
79-
database: all
80-
user: all
81-
auth_method: md5
82-
address: '127.0.0.1/32'
83-
postgresql_ssl_enable: yes
84-
85-
always:
86-
- name: Clean up
87-
include_tasks: clean_instance.yml
88-
89-
- name: Test using own certificate with path specificated in variable
90-
vars:
91-
postgresql_password: redhat
92-
block:
93-
- name: Generate own certificate
94-
include_role:
95-
name: fedora.linux_system_roles.certificate
96-
vars:
97-
certificate_requests:
98-
- name: /tmp/test_cert
99-
dns: www.example.com
100-
ca: self-sign
101-
102-
- name: Set up database server
103-
include_role:
104-
name: linux-system-roles.postgresql
105-
vars:
106-
postgresql_cert_name: "/tmp/test_cert"
10716
postgresql_pg_hba_conf:
10817
- type: hostssl
10918
database: all
11019
user: all
11120
auth_method: md5
11221
address: '127.0.0.1/32'
113-
postgresql_ssl_enable: yes
11422

11523
- meta: flush_handlers
11624

@@ -128,6 +36,13 @@
12836
that: >
12937
"SSL connection" in result.stdout
13038
39+
vars:
40+
postgresql_password: redhat
41+
13142
always:
43+
- name: Stop tracking certificate
44+
command: getcert stop-tracking -f test_crt
45+
changed_when: false
46+
13247
- name: Clean up
13348
include_tasks: clean_instance.yml

0 commit comments

Comments
 (0)