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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
summary: Check that broken seeding generates an error
details: |
Verify that when the seed process fails, then an error is
generated (details in snap warnings output). Also check in
ubuntu that the seed file is renamed after the
snapd.postinst is executed.
# not running on 14.04 as we have no real systemd here
systems: [-ubuntu-core-*, -ubuntu-14.04-*]
environment:
SEED_DIR: /var/lib/snapd/seed
prepare: |
if [ "$TRUST_TEST_KEYS" = "false" ]; then
echo "This test needs test keys to be trusted"
exit
fi
snap pack "$TESTSLIB/snaps/basic18"
snap download "--$CORE_CHANNEL" core
echo "Break the seed.yaml by not providing a model assertion"
"$TESTSLIB/reset.sh" --keep-stopped
mkdir -p "$SEED_DIR/snaps"
mkdir -p "$SEED_DIR/assertions"
# Break the seed by not providing a model assertion and using
# a base18 snap that needs a core18 base but not providing one.
# XXX: Another common failure is to not provide some assertions
# in the seed, provide a test for this too?
cat > "$SEED_DIR/seed.yaml" <<EOF
snaps:
- name: core
channel: $CORE_CHANNEL
file: core.snap
- name: basic18
unasserted: true
file: basic18.snap
EOF
echo "Copy the needed assertions to /var/lib/snapd/"
cp core_*.assert "$SEED_DIR/assertions"
echo "Copy the needed snaps to $SEED_DIR/snaps"
cp ./core_*.snap "$SEED_DIR/snaps/core.snap"
cp ./basic18_1.0_all.snap "$SEED_DIR/snaps/basic.snap"
restore: |
if [ "$TRUST_TEST_KEYS" = "false" ]; then
echo "This test needs test keys to be trusted"
exit
fi
rm -rf "$SEED_DIR"
systemctl start snapd.socket snapd.service
execute: |
if [ "$TRUST_TEST_KEYS" = "false" ]; then
echo "This test needs test keys to be trusted"
exit
fi
echo "Start the daemon with an empty state"
systemctl start snapd.service
echo "Ensure we get a warning message"
retry -n 30 sh -c 'snap warnings | MATCH "seeding failed "'
echo "Check the ubuntu postinst will fix broken seeds, see LP: 1868706"
if os.query is-ubuntu; then
# XXX: why is this needed?
mkdir -p /var/lib/snapd/void
# the prerm does not do much anymore but we keep it here to simulate
# a package upgrade
DPKG_MAINTSCRIPT_NAME=prerm DPKG_MAINTSCRIPT_PACKAGE=snapd /var/lib/dpkg/info/snapd.prerm upgrade 2.44
# run the postinst snapd is restarted
DPKG_MAINTSCRIPT_NAME=postinst DPKG_MAINTSCRIPT_PACKAGE=snapd /var/lib/dpkg/info/snapd.postinst configure 2.44 | MATCH "Found incorrect seed"
echo "Check that the seed dir got renamed"
test -d /var/lib/snapd/seed.disabled
if test -d /var/lib/snapd/seed/seed; then
echo "The seed dir should be renamed, test broken"
exit 1
fi
fi
|