-
Notifications
You must be signed in to change notification settings - Fork 601
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wrappers: journal namespaces did not honor journal.persistent
* wrappers: journal namespaces did not honor journal.persistent as the default value for 'Storage=' varies * tests/core/persistent-journal-namespace: change a bit how we retried the command * tests/core/persistent-journal-namespace: move cleanup to restore * tests/core/persistent-journal-namespace: review feedback
- Loading branch information
1 parent
b6f5b6d
commit d82fb99
Showing
3 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
summary: Test journal.persistent core config option is honored by journal namespaces | ||
|
||
# these systems do not support journal quota groups due to their old systemd versions. | ||
# requires systemd v245+ | ||
systems: | ||
- -ubuntu-core-16-* | ||
- -ubuntu-core-18-* | ||
|
||
prepare: | | ||
"$TESTSTOOLS"/snaps-state install-local test-snapd-journal-quota | ||
snap set system experimental.quota-groups=true | ||
tests.cleanup defer snap unset system experimental.quota-groups | ||
restore: | | ||
# Stop test service and cleanup | ||
snap stop test-snapd-journal-quota.logger | ||
snap remove-quota group-one | ||
# disable persistent journal and reload the journal | ||
rm -rf /var/log/journal | ||
systemctl kill --signal=SIGUSR1 systemd-journald | ||
execute: | | ||
echo "Wait for first boot to be done" | ||
snap wait system seed.loaded | ||
echo "Precondition check, persistent journal is not available by default" | ||
not test -e /var/log/journal | ||
echo "Check that persistent journal can be enabled" | ||
snap set core journal.persistent=true | ||
test -e /var/log/journal/ | ||
test -e /var/log/journal/.snapd-created | ||
# Create a journal quota group and set arbitrary limits | ||
echo "Create a journal namespace with the logger snap in it" | ||
snap set-quota group-one --journal-size=16MB --journal-rate-limit=100/10ms test-snapd-journal-quota | ||
# this check relies on *anything* getting logged; enabling persistent | ||
# journal writes an entry about journal size, which should be sufficient. | ||
MACHINE_ID=$(cat /etc/machine-id) | ||
retry -n 30 --wait 1 test -e "/var/log/journal/$MACHINE_ID" | ||
echo "Starting service to fill namespace with logs" | ||
snap start test-snapd-journal-quota.logger | ||
# Verify the presence of the namespace log, and do this with retries as | ||
# the logger writes onces every second | ||
retry -n 5 sh -c "test -e /var/log/journal/$MACHINE_ID.snap-group-one" | ||
echo "Check that persistent journal can be disabled" | ||
snap set core journal.persistent=false | ||
not test -e /var/log/journal | ||
# Verify that, over a few seconds, nothing is created | ||
# to make sure the namespace is not recreating the path | ||
if retry -n 2 sh -c "test -e /var/log/journal"; then | ||
echo "Journal path was recreated, it shouldn't have happened" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters