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
|
summary: |
Ensure after device initialisation registration worked and
we have a serial and can acquire a session macaroon
details: |
Check that initialised devices have a serial and a session macaroon
execute: |
#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 --assertion | MATCH "series: 16"
if ! snap model --verbose | grep "brand-id:\s+ canonical" ; then
echo "Not a canonical model. Skipping."
exit 0
fi
echo "Wait for device initialisation to be done"
wait_for_device_initialized_change
echo "Check we have a serial"
snap model --serial --assertion | MATCH "authority-id: canonical"
snap model --serial --assertion | MATCH "brand-id: canonical"
gadget_name="$(snaps.name gadget)"
case "$SPREAD_SYSTEM" in
ubuntu-core-24-64)
snap model --serial --assertion | MATCH "model: ubuntu-core-24-amd64"
;;
ubuntu-core-22-64)
snap model --serial --assertion | MATCH "model: ubuntu-core-22-amd64"
;;
ubuntu-core-22-arm-*)
snap model --serial --assertion | MATCH "model: ubuntu-core-22-$gadget_name"
;;
ubuntu-core-20-64)
snap model --serial --assertion | MATCH "model: ubuntu-core-20-amd64"
;;
ubuntu-core-20-arm-*)
snap model --serial --assertion | MATCH "model: ubuntu-core-20-$gadget_name"
;;
ubuntu-core-18-64)
snap model --serial --assertion | MATCH "model: ubuntu-core-18-amd64"
;;
ubuntu-core-18-arm-*)
snap model --serial --assertion | MATCH "model: ubuntu-core-18-$gadget_name"
;;
ubuntu-core-16-64)
snap model --serial --assertion | MATCH "model: pc"
;;
*)
snap model --serial --assertion | MATCH "model: $gadget_name"
esac
echo "Make sure we could acquire a session macaroon"
snap find pc
MATCH '"session-macaroon":"[^"]' < /var/lib/snapd/state.json
|