mirror of
https://github.com/token2/snapd.git
synced 2026-03-13 11:15:47 -07:00
49 lines
1.6 KiB
YAML
49 lines
1.6 KiB
YAML
summary: Check that the undo on refresh keeps the previous snap intact
|
|
details: |
|
|
When a snap is refreshed and the refresh fails, the undo code had
|
|
a bug that removed the security confinement (LP: #1637981)
|
|
|
|
# trusty has unreliable journalctl output for unknown reasonsg
|
|
systems: [-ubuntu-14.04-*]
|
|
|
|
environment:
|
|
SNAP_NAME: test-snapd-service
|
|
SNAP_NAME_GOOD: ${SNAP_NAME}-v1-good
|
|
SNAP_NAME_BAD: ${SNAP_NAME}-v2-bad
|
|
SNAP_FILE_GOOD: ${SNAP_NAME}_1.0_all.snap
|
|
SNAP_FILE_BAD: ${SNAP_NAME}_2.0_all.snap
|
|
|
|
prepare: |
|
|
echo "Given a good (v1) and a bad (v2) snap"
|
|
snap pack "$TESTSLIB/snaps/$SNAP_NAME_GOOD"
|
|
snap pack "$TESTSLIB/snaps/$SNAP_NAME_BAD"
|
|
|
|
debug: |
|
|
"$TESTSTOOLS"/journal-state get-log -u snap.test-snapd-service.service.service
|
|
|
|
execute: |
|
|
wait_for_service_status() {
|
|
retries=0
|
|
while ! systemctl status snap.test-snapd-service.service.service|grep "$1"; do
|
|
# retry
|
|
retries=$((retries+1))
|
|
if [ $retries -gt 30 ]; then
|
|
echo 'expected "service v1" output did not appear in systemctl status snap.test-snapd-service.service.service'
|
|
exit 1
|
|
fi
|
|
sleep 1
|
|
done
|
|
}
|
|
echo "When we install v1"
|
|
snap install --dangerous "${SNAP_FILE_GOOD}"
|
|
echo "The v1 service started correctly"
|
|
wait_for_service_status "service v1"
|
|
|
|
echo "When we refresh to v2"
|
|
if snap install --dangerous "${SNAP_FILE_BAD}"; then
|
|
echo "The ${SNAP_FILE_BAD} snap should not install cleanly, test broken"
|
|
exit 1
|
|
fi
|
|
echo "Then v2 is rolled back and v1 is started again"
|
|
wait_for_service_status "service v1"
|