1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
summary: Ensure that the snap logs command works.
details: |
Validate the logs command fetches logs of the given services and displays them in chronological order
for all supported systems.
prepare: |
"$TESTSTOOLS"/snaps-state install-local test-snapd-service
restore: |
snap remove --purge test-snapd-service || true
execute: |
echo "check the logs are displayed by service-name and service-name.app"
snap logs test-snapd-service | MATCH "running"
snap logs test-snapd-service.test-snapd-service | MATCH "running"
snap logs test-snapd-service.test-snapd-other-service | MATCH "running"
echo "check output lines for the logs"
snap logs -n=20 test-snapd-service | MATCH "running"
snap logs -n=all test-snapd-service | MATCH "running"
echo "check -f option works"
# XXX: journalctl -f -u .. drops some lines of service output when
# asked for multiple units, therefore query for specific service instead
# of test-snapd-service (which would expand to all services).
snap logs -f test-snapd-service.test-snapd-service > service.log &
snap stop test-snapd-service
retry -n 10 --wait 1 sh -c 'MATCH "stop service" < service.log'
echo "stop the logs command"
kill $!
|