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 34 35 36 37 38
|
summary: Check that `snap run --command=reload` works
details: |
A snap application may have more than one command associated with it. For
example the shell completion program is another command for a given
application. Services may have more commands, for instance when the service
is started or when the service is stopped or reloaded.
The test installs a service, reloads it and looks at the system log to
observe the text emitted by the reload command, which sends a SIGHUP to the
main process, but this is internal to the test.
kill-timeout: 10m
restore: |
snap remove --purge test-snapd-service || true
execute: |
echo "When the service snap is installed"
"$TESTSTOOLS"/snaps-state install-local test-snapd-service
echo "We can see it running"
systemctl status snap.test-snapd-service.test-snapd-service|MATCH "running"
echo "When we reload"
systemctl reload snap.test-snapd-service.test-snapd-service
echo "We see the reload command from the snap was run"
retry -n 30 --wait 1 sh -c 'systemctl status snap.test-snapd-service.test-snapd-service | MATCH "reloading reloading reloading"'
echo "A snap that refuses to stop is killed eventually"
snap stop test-snapd-service.test-snapd-service-refuses-to-stop
# systemd in 14.04 does not provide the "Result: timeout" information
if os.query is-trusty; then
systemctl status snap.test-snapd-service.test-snapd-service-refuses-to-stop|MATCH "code=killed"
else
systemctl status snap.test-snapd-service.test-snapd-service-refuses-to-stop|MATCH "Result: timeout"
fi
|