Files
snapd/tests/nested/core/core20-basic/task.yaml
Sergio Cazzolato 59659cc621 Moving functions to tests.nested tool
The change includes:
 . Many functions added to tests.nested tool
	. is-nested
        . get
    	. boot-id
        . secboot-sign
 . Restructured the tests.nested tool command to simplify the cli
        . exec
        . vm (before was start-vm, stop-vm, and remove-vm)

The tests were update to use the tests.nested tool instead of the
nested.sh helper.
Next step is to reorganize the helper in 2 parts.
2021-09-06 15:45:49 -03:00

65 lines
3.0 KiB
YAML

summary: Run a smoke test on UC20 with encryption enabled
details: |
This test checks basic snapd commands on UC20 with secure boot and encryption enabled
systems: [ubuntu-20.04-64]
execute: |
echo "Wait for the system to be seeded first"
tests.nested exec "sudo snap wait system seed.loaded"
echo "Ensure 'snap install' works"
# The install command could cause a ssh break, so || true is used
# and then we check the installation was completed successfully
tests.nested exec "sudo snap install test-snapd-sh" || true
echo "Ensure 'snap list' works and test-snapd-sh snap is installed"
tests.nested exec "snap list" | MATCH test-snapd-sh
echo "Ensure 'snap find' works"
tests.nested exec "snap find test-snapd-sh" | MATCH ^test-snapd-sh
echo "Ensure 'snap info' works"
tests.nested exec "snap info test-snapd-sh" | MATCH '^name:\ +test-snapd-sh'
echo "Ensure 'snap remove' works"
# The install command could cause a ssh break, so || true is used
# and then we check the removal was completed successfully
tests.nested exec "sudo snap remove test-snapd-sh" || true
echo "Ensure 'snap list' works and test-snapd-sh snap is removed"
tests.nested exec "! snap list test-snapd-sh"
echo "Ensure 'snap debug show-keys' works as root"
tests.nested exec "sudo snap recovery --show-keys" | MATCH 'recovery:\s+[0-9]{5}-[0-9]{5}-[0-9]{5}-[0-9]{5}-[0-9]{5}-[0-9]{5}-[0-9]{5}-[0-9]{5}'
tests.nested exec "sudo snap recovery --show-keys" | MATCH 'reinstall:\s+[0-9]{5}-[0-9]{5}-[0-9]{5}-[0-9]{5}-[0-9]{5}-[0-9]{5}-[0-9]{5}-[0-9]{5}'
echo "But not as user (normal file permissions prevent this)"
if tests.nested exec "snap recovery --show-key"; then
echo "snap recovery --show-key should not work as a user"
exit 1
fi
echo "Wait for device initialisation to be done"
tests.nested exec "retry --wait 5 -n 10 sh -c 'snap changes | MATCH \"Done.*Initialize device\"'"
echo "Check that the serial backed up to save is as expected"
tests.nested exec 'cat /var/lib/snapd/save/device/asserts-v0/serial/'"$(tests.nested get model-authority)"'/pc/*/active' >serial.saved
tests.nested exec snap model --serial --assertion >serial
cmp serial serial.saved
echo "Check that we go the install log after the transition to run mode"
tests.nested exec "test -e /var/log/install-mode.log.gz"
echo "Transparently verify that the format is gzip"
tests.nested exec "zcat /var/log/install-mode.log.gz" | MATCH 'installing a new system'
echo "Check that we go the timings after the transition to run mode"
tests.nested exec "test -e /var/log/install-timings.txt.gz"
tests.nested exec "zcat /var/log/install-timings.txt.gz" > install-timings.txt
MATCH "Install the system" < install-timings.txt
MATCH "^seed" < install-timings.txt
MATCH "Mark system seeded" < install-timings.txt
MATCH "Setup system for run mode" < install-timings.txt
MATCH "ensure=install-system" < install-timings.txt