diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-04-07 09:28:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-07 09:28:27 +0200 |
commit | 1e094cb4ba258496dd8b210658106f3d196252a2 (patch) | |
tree | 5c3fa8f17a8525d15fe911dc68b94657322dffc1 /test | |
parent | 744b04c5571eb1518e686dce505357aa3fb94ce8 (diff) | |
parent | d23a1c52a93206b0dbabcb4336752ccb796c11c3 (diff) | |
download | systemd-1e094cb4ba258496dd8b210658106f3d196252a2.tar.gz |
Merge pull request #27126 from yuwata/journal-compress
sd-journal: allow to specify compression algorithm through env
Diffstat (limited to 'test')
-rwxr-xr-x | test/units/testsuite-04.sh | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/units/testsuite-04.sh b/test/units/testsuite-04.sh index 3f3d8bc9c8..b7cbfeb75a 100755 --- a/test/units/testsuite-04.sh +++ b/test/units/testsuite-04.sh @@ -290,4 +290,36 @@ rm -rf "$JTMP" rm /tmp/lb1 +# https://bugzilla.redhat.com/show_bug.cgi?id=2183546 +mkdir /run/systemd/system/systemd-journald.service.d +MID=$(cat /etc/machine-id) +for c in "NONE" "XZ" "LZ4" "ZSTD"; do + cat >/run/systemd/system/systemd-journald.service.d/compress.conf <<EOF +[Service] +Environment=SYSTEMD_JOURNAL_COMPRESS=${c} +EOF + systemctl daemon-reload + systemctl restart systemd-journald.service + journalctl --rotate + + ID=$(systemd-id128 new) + systemd-cat -t "$ID" /bin/bash -c "for ((i=0;i<100;i++)); do echo -n hoge with ${c}; done; echo" + journalctl --sync + timeout 10 bash -c "while ! SYSTEMD_LOG_LEVEL=debug journalctl --verify --quiet --file /var/log/journal/$MID/system.journal 2>&1 | grep -q -F 'compress=${c}'; do sleep .5; done" + + # $SYSTEMD_JOURNAL_COMPRESS= also works for journal-remote + if [[ -x /usr/lib/systemd/systemd-journal-remote ]]; then + for cc in "NONE" "XZ" "LZ4" "ZSTD"; do + rm -f /tmp/foo.journal + SYSTEMD_JOURNAL_COMPRESS="${cc}" /usr/lib/systemd/systemd-journal-remote --split-mode=none -o /tmp/foo.journal --getter="journalctl -b -o export -t $ID" + SYSTEMD_LOG_LEVEL=debug journalctl --verify --quiet --file /tmp/foo.journal 2>&1 | grep -q -F "compress=${cc}" + journalctl -t "$ID" -o cat --file /tmp/foo.journal | grep -q -F "hoge with ${c}" + done + fi +done +rm /run/systemd/system/systemd-journald.service.d/compress.conf +systemctl daemon-reload +systemctl restart systemd-journald.service +journalctl --rotate + touch /testok |