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 39 40 41 42 43 44 45 46 47 48
|
summary: Ensure that refresh --amend works
details: |
Check snapd can handle a refresh for a dangerous snap by using the
`snap --amend` command. Verify after the refresh process the snap
has a store revision.
environment:
TRY_MODE: false
TRY_MODE/try_mode: true
execute: |
echo "When installing a local snap"
snap download --edge test-snapd-just-edge
if [ "${TRY_MODE}" = 'true' ]; then
unsquashfs -d ./test-snapd-just-edge ./test-snapd-just-edge_*.snap
snap try ./test-snapd-just-edge
else
snap install --dangerous ./test-snapd-just-edge_*.snap
fi
snap list |MATCH "test-snapd-just-edge.*x1"
echo "A normal refresh will not refresh it to the store rev"
if snap refresh test-snapd-just-edge 2> stderr.out; then
echo "snap refresh should error but did not"
exit 1
fi
MATCH 'local snap "test-snapd-just-edge" is unknown to the store' < stderr.out
echo "A refresh with --amend is not enough, the channel needs to be added"
if snap refresh --amend test-snapd-just-edge 2> stderr.out; then
echo "snap refresh --amend without --edge should error but it did not"
exit 1
fi
echo "A refresh with --amend refreshes it to the store revision"
snap refresh --edge --amend test-snapd-just-edge
# we remove this dir, otherwise "snap info" will look into it and report
# information about the local snap directory
if [ "${TRY_MODE}" = 'true' ]; then
rm -r ./test-snapd-just-edge
fi
echo "And we have a store revision now"
snap info test-snapd-just-edge | MATCH "^snap-id:.*[a-zA-Z0-9]+$"
|