Skip to content

Commit

Permalink
Merge pull request #11703 from sergiocazzolato/tests-add-more-nested-…
Browse files Browse the repository at this point in the history
…to-uc22

tests: initial set of tests to uc22 nested execution
  • Loading branch information
sergiocazzolato authored Apr 23, 2022
2 parents 8e98f75 + c84fc80 commit 992c910
Show file tree
Hide file tree
Showing 22 changed files with 54 additions and 29 deletions.
6 changes: 3 additions & 3 deletions spread.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ backends:
- ubuntu-22.04-64:
image: ubuntu-2204-64-virt-enabled
storage: 20G
workers: 3
workers: 6

qemu-nested:
memory: 4G
Expand Down Expand Up @@ -961,7 +961,7 @@ suites:
tests/nested/manual/:
summary: Tests for nested images controlled manually from the tests
backends: [google-nested, qemu-nested]
systems: [ubuntu-16.04-64, ubuntu-18.04-64, ubuntu-20.04-64, ubuntu-21.10-64]
systems: [ubuntu-16.04-64, ubuntu-18.04-64, ubuntu-20.04-64, ubuntu-21.10-64, ubuntu-22.04-64]
environment:
NESTED_TYPE: "classic"
# Enable kvm in the qemu command line
Expand Down Expand Up @@ -1005,7 +1005,7 @@ suites:
tests/nested/classic/:
summary: Tests for nested images
backends: [google-nested, qemu-nested]
systems: [ubuntu-16.04-64, ubuntu-18.04-64, ubuntu-20.04-64, ubuntu-21.10-64]
systems: [ubuntu-16.04-64, ubuntu-18.04-64, ubuntu-20.04-64, ubuntu-21.10-64, ubuntu-22.04-64]
environment:
NESTED_TYPE: "classic"
# Channel used to create the nested vm
Expand Down
5 changes: 4 additions & 1 deletion tests/lib/tools/tests.nested
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ show_help() {
echo " restore"
echo " build-image IMAGE-TYPE"
echo " create-vm IMAGE-TYPE [--param-cdrom PARAM] [--param-mem PARAM]"
echo " is-nested [core|classic|uc16|uc18|uc20]"
echo " is-nested [core|classic|uc16|uc18|uc20|uc22]"
echo " vm <ACTION>"
echo " exec [--user <USER>] [--pwd <PWD>] <CMD>"
echo " copy <FILEPATH>"
Expand Down Expand Up @@ -166,6 +166,9 @@ is_nested() {
uc20)
nested_is_core_20_system
;;
uc22)
nested_is_core_22_system
;;
*)
echo "tests.nested: parameter not supported: $1" >&2
exit 1
Expand Down
2 changes: 1 addition & 1 deletion tests/nested/core/core20-create-recovery/task.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
summary: verify creating recovery system on UC20

systems: [ubuntu-20.04-64]
systems: [ubuntu-20.04-64, ubuntu-22.04-64]

prepare: |
tests.nested exec sudo snap install test-snapd-curl --edge --devmode
Expand Down
2 changes: 1 addition & 1 deletion tests/nested/core/core20-degraded/task.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
summary: Transition to recover mode with things missing so we use degraded mode

systems: [ubuntu-20.04-64]
systems: [ubuntu-20.04-64, ubuntu-22.04-64]

environment:
DEGRADED_JSON: /run/snapd/snap-bootstrap/degraded.json
Expand Down
3 changes: 2 additions & 1 deletion tests/nested/core/core20-factory-reset/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ summary: Verify factory reset of a UC20 system
details: |
This test checks that UC20 can be reset to factory state
systems: [ubuntu-20.04-64]
systems: [ubuntu-20.04-64, ubuntu-22.04-64]

environment:
NESTED_ENABLE_SECURE_BOOT: false
Expand All @@ -12,6 +12,7 @@ environment:
execute: |
echo "Wait for the system to be seeded first"
tests.nested exec "sudo snap wait system seed.loaded"
tests.nested wait-for device-initialized
tests.nested exec snap model > initial-model
tests.nested exec snap model --serial > initial-serial
Expand Down
2 changes: 1 addition & 1 deletion tests/nested/core/core20-fault-inject/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ details: |
The test injects a reboot fault during link snap and verifies that a reboot
actually happens.
systems: [ubuntu-20.04-64]
systems: [ubuntu-20.04-64, ubuntu-22.04-64]

execute: |
# automatically cleaned up in restore
Expand Down
2 changes: 1 addition & 1 deletion tests/nested/core/core20-gadget-reseal/task.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
summary: Check that a gadget refresh reseals

systems: [ubuntu-20.04-64]
systems: [ubuntu-20.04-64, ubuntu-22.04-64]

execute: |
SEALED_KEY_MTIME_1="$(tests.nested exec sudo stat --format="%Y" /run/mnt/ubuntu-boot/device/fde/ubuntu-data.sealed-key)"
Expand Down
8 changes: 6 additions & 2 deletions tests/nested/core/core20-kernel-failover/task.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
summary: Check that a broken kernel snap automatically rolls itself back

# TODO:UC20: write equivalent test for base snap failover
systems: [ubuntu-20.04-64]
systems: [ubuntu-20.04-64, ubuntu-22.04-64]

prepare: |
echo "Build a broken kernel snap where the initramfs panic's"
Expand All @@ -14,7 +14,11 @@ prepare: |
# TODO:UC20: this doesn't work for some reason when we copy it from the
# running system, we should look into that, but for now just
# re-download the snap
snap download pc-kernel --channel=20/edge --basename=pc-kernel
version=20
if tests.nested is-nested uc22; then
version=22
fi
snap download pc-kernel --channel="$version/edge" --basename=pc-kernel
uc20_build_initramfs_kernel_snap pc-kernel.snap "$PWD" --inject-kernel-panic-in-initramfs
mv pc-kernel_*.snap panicking-initramfs-kernel.snap
Expand Down
2 changes: 1 addition & 1 deletion tests/nested/core/core20-kernel-reseal/task.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
summary: Check that a kernel refresh reseals

systems: [ubuntu-20.04-64]
systems: [ubuntu-20.04-64, ubuntu-22.04-64]

prepare: |
# we cannot use the kernel from store as it may have a version of
Expand Down
3 changes: 2 additions & 1 deletion tests/nested/core/core20-reinstall-partitions/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ summary: Verify reinstallation of a UC20 system
details: |
This test checks that UC20 can be reinstalled
systems: [ubuntu-20.04-64]
systems: [ubuntu-20.04-64, ubuntu-22.04-64]

environment:
# TODO: figure out a way to do this test where we reset the swtpm after the
Expand All @@ -15,6 +15,7 @@ environment:
execute: |
echo "Wait for the system to be seeded first"
tests.nested exec "sudo snap wait system seed.loaded"
tests.nested wait-for device-initialized
INITIAL_SERIAL=$(tests.nested exec snap model --serial | grep -Po 'serial:\s+\K.*')
Expand Down
2 changes: 1 addition & 1 deletion tests/nested/core/coreconfig-services/task.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
summary: Disable and enable back core services via snap set with reboot.

systems: [ubuntu-18.04-64, ubuntu-20.04-64]
systems: [ubuntu-18.04-64, ubuntu-20.04-64, ubuntu-22.04-64]

execute: |
tests.nested exec "systemctl status systemd-resolved.service" | MATCH "Active: +active"
Expand Down
2 changes: 1 addition & 1 deletion tests/nested/core/interfaces-custom-devices/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ details: |
The custom-device interface allows a gadget snap to provide custom slots
granting access to the devices it defines.
systems: [ubuntu-20.04-64]
systems: [ubuntu-20.04-64, ubuntu-22.04-64]

prepare: |
# Add our interface to the gadget snap
Expand Down
8 changes: 6 additions & 2 deletions tests/nested/manual/core20-boot-config-update/task.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
summary: Check that the boot config is correctly updated when snapd is refreshed

systems: [ubuntu-20.04-64]
systems: [ubuntu-20.04-64, ubuntu-22.04-64]

environment:
VARIANT/nogadget: "no-gadget"
Expand Down Expand Up @@ -32,7 +32,11 @@ prepare: |
if [ "$VARIANT" != "no-gadget" ]; then
echo "Grab and prepare the gadget snap"
snap download --basename=pc --channel="20/edge" pc
version=20
if tests.nested is-nested uc22; then
version=22
fi
snap download --basename=pc --channel="$version/edge" pc
unsquashfs -d pc-gadget pc.snap
echo "Sign the shim binary"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ summary: Verify custom kernel command line handling in UC20
details: |
This test checks support for customized kernel command line arguments in UC20
systems: [ubuntu-20.04-64]
systems: [ubuntu-20.04-64, ubuntu-22.04-64]

environment:
NESTED_IMAGE_ID: core20-kernel-commandline
Expand All @@ -17,7 +17,11 @@ prepare: |
SNAKEOIL_CERT="$PWD/$KEY_NAME.pem"
echo "Grab and prepare the gadget snap"
snap download --basename=pc --channel="20/edge" pc
version=20
if tests.nested is-nested uc22; then
version=22
fi
snap download --basename=pc --channel="$version/edge" pc
unsquashfs -d pc-gadget pc.snap
echo "Sign the shim binary"
Expand Down
8 changes: 6 additions & 2 deletions tests/nested/manual/core20-early-config/task.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
summary: Test that gadget config defaults are applied early on core20.

systems: [ubuntu-20.04-64]
systems: [ubuntu-20.04-64, ubuntu-22.04-64]

environment:
NESTED_IMAGE_ID: core20-early-config
Expand All @@ -15,7 +15,11 @@ prepare: |
SNAKEOIL_CERT="$PWD/$KEY_NAME.pem"
# modify and repack gadget snap (add defaults section and install hook)
snap download --basename=pc --channel="20/edge" pc
version=20
if tests.nested is-nested uc22; then
version=22
fi
snap download --basename=pc --channel="$version/edge" pc
unsquashfs -d pc-gadget pc.snap
cat defaults.yaml >> pc-gadget/meta/gadget.yaml
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
summary: Test that time moves forward when the RTC is broken/unavailable in UC20

systems: [ubuntu-20.04-64]
systems: [ubuntu-20.04-64, ubuntu-22.04-64]

environment:
NESTED_IMAGE_ID: core20-initramfs-time-moves-forward
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ details: |
This test checks support for shutting down the device at the end of install
mode via the install-device hook
systems: [ubuntu-20.04-64]
systems: [ubuntu-20.04-64, ubuntu-22.04-64]

environment:
NESTED_IMAGE_ID: core20-install-device
Expand All @@ -22,7 +22,11 @@ prepare: |
SNAKEOIL_CERT="$PWD/$KEY_NAME.pem"
echo "Grab and prepare the gadget snap"
snap download --basename=pc --channel="20/edge" pc
version=20
if tests.nested is-nested uc22; then
version=22
fi
snap download --basename=pc --channel="$version/edge" pc
unsquashfs -d pc-gadget pc.snap
echo "Sign the shim binary"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
summary: Check that devmode snaps can be seeded with a dangerous uc20 model

# this is a UC20 specific test
systems: [ubuntu-20.04-64]
systems: [ubuntu-20.04-64, ubuntu-22.04-64]

environment:
NESTED_IMAGE_ID: core20-devmode-seeding
Expand Down
2 changes: 1 addition & 1 deletion tests/nested/manual/refresh-revert-fundamentals/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ details: |
This test validates the fundamental snaps can be refreshed
and reverted to the new snaps published to edge channel.
systems: [ubuntu-20.04-*]
systems: [ubuntu-20.04-64, ubuntu-22.04-64]

environment:
NESTED_CORE_CHANNEL: beta
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ summary: Check that refreshing snapd to a fixed version removes vulnerable revs

# just focal is fine for this test - we only need to check that things happen on
# classic
systems: [ubuntu-20.04-*]
systems: [ubuntu-20.04-*, ubuntu-22.04-64]

environment:
# which snap snapd comes from in this test
Expand Down
2 changes: 1 addition & 1 deletion tests/nested/manual/uc20-fde-hooks-v1/task.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
summary: Check that the deprecated v1 fde-setup hooks keep working

# this is a UC20 specific test
systems: [ubuntu-20.04-64]
systems: [ubuntu-20.04-64, ubuntu-22.04-64]

environment:
NESTED_IMAGE_ID: core20-fde-setup
Expand Down
2 changes: 1 addition & 1 deletion tests/nested/manual/uc20-fde-hooks/task.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
summary: Check that the fde-setup hooks work

# this is a UC20 specific test
systems: [ubuntu-20.04-64]
systems: [ubuntu-20.04-64, ubuntu-22.04-64]

environment:
NESTED_IMAGE_ID: core20-fde-setup
Expand Down

0 comments on commit 992c910

Please sign in to comment.