Skip to content

Commit 398d73d

Browse files
committed
test: add role fingerprints to syslog
Test updates based on testing with bootc and on other platforms.
1 parent 6d1266c commit 398d73d

1 file changed

Lines changed: 17 additions & 8 deletions

File tree

tests/tests_default.yml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,30 @@
22
- name: Ensure that the role runs with default parameters
33
hosts: all
44
tasks:
5+
- name: See if /dev/log exists for the fingerprint check
6+
stat:
7+
path: /dev/log
8+
register: __register_dev_log
9+
510
- name: Set the start time for the journal search
611
set_fact:
712
__journal_start_time: "{{ ansible_facts['date_time']['date'] ~ ' ' ~ ansible_facts['date_time']['time'] }}"
13+
when: __register_dev_log.stat.exists
814

915
- name: Run the role
1016
include_tasks: tasks/run_role_with_clear_facts.yml
1117

1218
# look for the exact module invocation, not some other message that might contain the string
1319
- name: Check system journal contains role fingerprints
14-
shell: >-
15-
set -eo pipefail;
16-
journalctl --since "{{ __journal_start_time }}" --no-pager |
17-
grep -v " Invoked with" | grep "sr_fingerprint.*begin system_role:storage" ||
18-
{ echo ERROR: BEGIN fingerprint not found; exit 1; };
19-
journalctl --since "{{ __journal_start_time }}" --no-pager |
20-
grep -v " Invoked with" | grep "sr_fingerprint.*success system_role:storage" ||
21-
{ echo ERROR: SUCCESS fingerprint not found; exit 1; }
20+
shell:
21+
executable: /bin/bash
22+
cmd: >-
23+
set -eo pipefail;
24+
journalctl --since "{{ __journal_start_time }}" --no-pager |
25+
grep -v " Invoked with" | grep "sr_fingerprint.*begin system_role:storage" ||
26+
{ echo ERROR: BEGIN fingerprint not found; exit 1; };
27+
journalctl --since "{{ __journal_start_time }}" --no-pager |
28+
grep -v " Invoked with" | grep "sr_fingerprint.*success system_role:storage" ||
29+
{ echo ERROR: SUCCESS fingerprint not found; exit 1; }
2230
changed_when: false
31+
when: __register_dev_log.stat.exists

0 commit comments

Comments
 (0)