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
|
summary: |
Test that device initialisation and registration work with the model
specifying serial-authority: [generic]
details: |
Check that a device is initialized and registered properly when a
generic serial-authority is used in its model.
# TODO:UC20: enable for UC20, it assumes /var/lib/snapd/seed/assertions/model
# which we don't have currently
systems: [ubuntu-core-18*]
prepare: |
if [ "$TRUST_TEST_KEYS" = "false" ]; then
echo "This test needs test keys to be trusted"
exit
fi
systemctl stop snapd.service snapd.socket
rm -rf /var/lib/snapd/assertions/*
rm -rf /var/lib/snapd/device
rm -rf /var/lib/snapd/state.json
mv /var/lib/snapd/seed/assertions/model model.bak
# get the account and signing account-key of the
# pc-18-amd64-accept-generic.model's signer (pedronis)
snap known --remote account account-id=CA5GLZgNQWPhspDQK63Er46Uxz2SO7ez > /var/lib/snapd/seed/assertions/pedronis.account
snap known --remote account-key public-key-sha3-384=x1Tnl94nkgb-rMDs_l63gvgkLYGjXKfpkCCIQZwJ72-LR6X6OrSvNS9z2WS1lAGz > /var/lib/snapd/seed/assertions/test-models.account-key
cp "$TESTSLIB"/assertions/pc-18-amd64-accept-generic.model /var/lib/snapd/seed/assertions/
# kick first boot again
systemctl start snapd.service snapd.socket
restore: |
if [ "$TRUST_TEST_KEYS" = "false" ]; then
echo "This test needs test keys to be trusted"
exit
fi
#shellcheck source=tests/lib/core-config.sh
. "$TESTSLIB"/core-config.sh
systemctl stop snapd.service snapd.socket
rm -rf /var/lib/snapd/assertions/*
rm -rf /var/lib/snapd/device
rm -rf /var/lib/snapd/state.json
rm -f /var/lib/snapd/seed/assertions/pedronis.account
rm -f /var/lib/snapd/seed/assertions/test-models.account-key
rm -f /var/lib/snapd/seed/assertions/pc-18-amd64-accept-generic.model
cp model.bak /var/lib/snapd/seed/assertions/model
# kick first boot again
systemctl start snapd.service snapd.socket
# wait for first boot to be done
wait_for_first_boot_change
execute: |
if [ "$TRUST_TEST_KEYS" = "false" ]; then
echo "This test needs test keys to be trusted"
exit
fi
#shellcheck source=tests/lib/core-config.sh
. "$TESTSLIB"/core-config.sh
echo "Wait for first boot to be done"
wait_for_first_boot_change
echo "We have a model assertion"
snap model --verbose|MATCH "model:\s* pc-18-amd64-accept-generic"
echo "Wait for device initialisation to be done"
wait_for_device_initialized_change
echo "Check we have a serial with authority-id: generic"
snap model --serial --assertion|MATCH "authority-id: generic"
snap model --serial --assertion|MATCH "brand-id: CA5GLZgNQWPhspDQK63Er46Uxz2SO7ez"
snap model --serial --assertion|MATCH "model: pc-18-amd64-accept-generic"
|