1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
summary: Check that a service installed by a snap is reported as active by systemd
details: |
Snap packages may contain applications that are marked as services. The test
installs one such package and observes that the application is started as a
systemd service.
environment:
SERVICE_NAME: snap.test-snapd-service.test-snapd-service.service
restore: |
snap remove --purge test-snapd-service || true
execute: |
echo "Given a service snap is installed"
"$TESTSTOOLS"/snaps-state install-local test-snapd-service
echo "When the service state is reported as active"
while ! systemctl show -p ActiveState "$SERVICE_NAME" | grep -Pq "ActiveState=active"; do sleep 0.5; done
echo "Then systemctl reports the status of the service as loaded, active and running"
expected='(?s).*?Loaded: loaded .*?Active: active \(running\)'
systemctl status "$SERVICE_NAME" | grep -Pqz "$expected"
|