Skip to content

Commit

Permalink
test: fix check for max journal size
Browse files Browse the repository at this point in the history
Some systems report the max size as 2G instead of 2.0G:

```
Aug 18 17:54:34 xxxxxx systemd-journald[14084]: System Journal (/var/log/journal/c353583eb4fd4abf81720811415b21e0) is 8M, max 2G, 1.9G free.
```

Some systems have "max" in the hostname and the test would match the wrong line.

Also add some debugging for test failures

Signed-off-by: Rich Megginson <[email protected]>
  • Loading branch information
richm committed Aug 19, 2024
1 parent f10433d commit e019bb5
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions tests/tests_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,28 @@
shell:
cmd: >
set -euo pipefail;
journalctl -b -u systemd-journald -p info | grep max | tail -n 1 |
grep -q -E 'max( allowed)? 2.0G'
journalctl -b -u systemd-journald -p info |
grep -E "((System [Jj]ournal)|(Permanent journal)) .*max" | tail -n 1 |
grep -q -E 'max( allowed)? 2([.]0)?G'
changed_when: false

- name: Check generated files for ansible_managed, fingerprint
include_tasks: tasks/check_header.yml
vars:
__file: "{{ __journald_dropin_dir }}/{{ __journald_dropin_conf }}"
__fingerprint: "system_role:journald"

rescue:
- name: Debug
shell: |
set -x
exec 1>&2
journalctl -ex
journalctl -b -u systemd-journald
cat "{{ __journald_dropin_dir }}/{{ __journald_dropin_conf }}"
changed_when: false
failed_when: true

always:
- name: Cleanup
file:
Expand Down

0 comments on commit e019bb5

Please sign in to comment.