summaryrefslogtreecommitdiff
diff options
authorMichael Vogt <mvo@ubuntu.com>2021-07-07 12:30:28 +0200
committerGitHub <noreply@github.com>2021-07-07 12:30:28 +0200
commit782d380ac53a42fa3a83595cceaff1fbf70e5593 (patch)
tree5949d177d3f4c973196745a92db54218df2f5de1
parentb7ea9a772c950a2febbcd90776bc90a0a896bcc5 (diff)
parent69b8f02ecfce8371cb3ef0ecbf7ffb243509d408 (diff)
Merge pull request #10500 from sergiocazzolato/tests-new-nested-tool
tests: Renaming tool nested-state to tests.nested
-rw-r--r--spread.yaml26
l---------tests/bin/tests.nested1
-rwxr-xr-xtests/lib/tools/tests.nested (renamed from tests/lib/tools/nested-state)0
-rw-r--r--tests/nested/manual/cloud-init-never-used-not-vuln/task.yaml8
-rw-r--r--tests/nested/manual/cloud-init-nocloud-not-vuln/task.yaml8
-rw-r--r--tests/nested/manual/core-early-config/task.yaml4
-rw-r--r--tests/nested/manual/core20-boot-config-update/task.yaml4
-rw-r--r--tests/nested/manual/core20-custom-kernel-commandline/task.yaml4
-rw-r--r--tests/nested/manual/core20-early-config/task.yaml4
-rw-r--r--tests/nested/manual/core20-gadget-cloud-conf/task.yaml4
-rw-r--r--tests/nested/manual/core20-initramfs-time-moves-forward/task.yaml4
-rw-r--r--tests/nested/manual/core20-install-mode-shutdown-via-hook/task.yaml4
-rw-r--r--tests/nested/manual/core20-save/task.yaml4
-rw-r--r--tests/nested/manual/grade-signed-above-testkeys-boot/task.yaml4
-rw-r--r--tests/nested/manual/grade-signed-cloud-init-testkeys/task.yaml4
-rw-r--r--tests/nested/manual/minimal-smoke/task.yaml4
-rw-r--r--tests/nested/manual/preseed/task.yaml4
-rw-r--r--tests/nested/manual/refresh-revert-fundamentals/task.yaml4
-rw-r--r--tests/nested/manual/snapd-refresh-from-old/task.yaml4
-rw-r--r--tests/nested/manual/uc20-storage-safety/task.yaml4
20 files changed, 52 insertions, 51 deletions
diff --git a/spread.yaml b/spread.yaml
index 4772082057..8fccba4bf3 100644
--- a/spread.yaml
+++ b/spread.yaml
@@ -887,10 +887,10 @@ suites:
dpkg -i "$SPREAD_PATH"/../snapd_*.deb
prepare-each: |
tests.backup prepare
- "$TESTSTOOLS"/nested-state prepare
+ tests.nested prepare
restore-each: |
- "$TESTSTOOLS"/nested-state remove-vm
- "$TESTSTOOLS"/nested-state restore
+ tests.nested remove-vm
+ tests.nested restore
tests.backup restore
restore: |
#shellcheck source=tests/lib/pkgdb.sh
@@ -920,16 +920,16 @@ suites:
# Install the snapd built
dpkg -i "$SPREAD_PATH"/../snapd_*.deb
- "$TESTSTOOLS"/nested-state prepare
- "$TESTSTOOLS"/nested-state build-image classic
+ tests.nested prepare
+ tests.nested build-image classic
prepare-each: |
tests.backup prepare
- "$TESTSTOOLS"/nested-state create-vm classic
+ tests.nested create-vm classic
restore-each: |
- "$TESTSTOOLS"/nested-state remove-vm
+ tests.nested remove-vm
tests.backup restore
restore: |
- "$TESTSTOOLS"/nested-state restore
+ tests.nested restore
#shellcheck source=tests/lib/pkgdb.sh
. "$TESTSLIB"/pkgdb.sh
@@ -958,16 +958,16 @@ suites:
# Install the snapd built
dpkg -i "$SPREAD_PATH"/../snapd_*.deb
- "$TESTSTOOLS"/nested-state prepare
- "$TESTSTOOLS"/nested-state build-image core
+ tests.nested prepare
+ tests.nested build-image core
prepare-each: |
tests.backup prepare
- "$TESTSTOOLS"/nested-state create-vm core
+ tests.nested create-vm core
restore-each: |
- "$TESTSTOOLS"/nested-state remove-vm
+ tests.nested remove-vm
tests.backup restore
restore: |
- "$TESTSTOOLS"/nested-state restore
+ tests.nested restore
#shellcheck source=tests/lib/pkgdb.sh
. "$TESTSLIB"/pkgdb.sh
diff --git a/tests/bin/tests.nested b/tests/bin/tests.nested
new file mode 120000
index 0000000000..9ddd33b500
--- /dev/null
+++ b/tests/bin/tests.nested
@@ -0,0 +1 @@
+../lib/tools/tests.nested \ No newline at end of file
diff --git a/tests/lib/tools/nested-state b/tests/lib/tools/tests.nested
index b0cf2c142d..b0cf2c142d 100755
--- a/tests/lib/tools/nested-state
+++ b/tests/lib/tools/tests.nested
diff --git a/tests/nested/manual/cloud-init-never-used-not-vuln/task.yaml b/tests/nested/manual/cloud-init-never-used-not-vuln/task.yaml
index 513707cbaf..48c3a20a0d 100644
--- a/tests/nested/manual/cloud-init-never-used-not-vuln/task.yaml
+++ b/tests/nested/manual/cloud-init-never-used-not-vuln/task.yaml
@@ -23,11 +23,11 @@ prepare: |
# build the attacker cloud-init NoCloud cdrom drive
nested_build_seed_cdrom "$TESTSLIB/cloud-init-seeds/attacker-user" seed2.iso cidata user-data meta-data
- "$TESTSTOOLS"/nested-state build-image core
+ tests.nested build-image core
# first boot will use seed1 which is empty, but the same file name will be
# replace while the VM is shutdown to use the second attacker iso
- "$TESTSTOOLS"/nested-state create-vm core --param-cdrom "-cdrom $(pwd)/seed.iso"
+ tests.nested create-vm core --param-cdrom "-cdrom $(pwd)/seed.iso"
debug: |
if [ -f snapd-before-reboot.logs ]; then
@@ -114,13 +114,13 @@ execute: |
echo "Gracefully shutting down the nested VM to prepare a simulated attack"
boot_id="$(nested_get_boot_id)"
- "$TESTSTOOLS"/nested-state stop-vm
+ tests.nested stop-vm
echo "Replace the empty seed.iso with the new attacker iso"
mv seed2.iso seed.iso
echo "Restarting nested VM with attacker cloud-init CD-ROM drive"
- "$TESTSTOOLS"/nested-state start-vm
+ tests.nested start-vm
nested_wait_for_reboot "${boot_id}"
# cloud-init should not actually run, since it was disabled, but in case the
diff --git a/tests/nested/manual/cloud-init-nocloud-not-vuln/task.yaml b/tests/nested/manual/cloud-init-nocloud-not-vuln/task.yaml
index 1d6aff4759..f14061aa22 100644
--- a/tests/nested/manual/cloud-init-nocloud-not-vuln/task.yaml
+++ b/tests/nested/manual/cloud-init-nocloud-not-vuln/task.yaml
@@ -26,11 +26,11 @@ prepare: |
# second boot - attacker drive
nested_build_seed_cdrom "$TESTSLIB/cloud-init-seeds/attacker-user" seed2.iso cidata user-data meta-data
- "$TESTSTOOLS"/nested-state build-image core
+ tests.nested build-image core
# first boot uses seed1 to create the normal-user in addition to the
# system-user assertion
- "$TESTSTOOLS"/nested-state create-vm core --param-cdrom "-cdrom $(pwd)/seed.iso"
+ tests.nested create-vm core --param-cdrom "-cdrom $(pwd)/seed.iso"
debug: |
if [ -f snapd-before-reboot.logs ]; then
@@ -123,13 +123,13 @@ execute: |
# gracefully shutdown so that we don't have file corruption
echo "Gracefully shutting down the nested VM to prepare a simulated attack"
boot_id="$(nested_get_boot_id)"
- "$TESTSTOOLS"/nested-state stop-vm
+ tests.nested stop-vm
# replace the seed.iso with the new attacker iso
mv seed2.iso seed.iso
echo "Restarting nested VM with attacker cloud-init CD-ROM drive"
- "$TESTSTOOLS"/nested-state start-vm
+ tests.nested start-vm
nested_wait_for_reboot "${boot_id}"
# cloud-init will actually still run because it was not disabled and we
diff --git a/tests/nested/manual/core-early-config/task.yaml b/tests/nested/manual/core-early-config/task.yaml
index e20399853f..2b73ae2c38 100644
--- a/tests/nested/manual/core-early-config/task.yaml
+++ b/tests/nested/manual/core-early-config/task.yaml
@@ -28,7 +28,7 @@ prepare: |
KERNEL_SNAP=$(ls pc-kernel_*.snap)
mv "$KERNEL_SNAP" extra-snaps/
- "$TESTSTOOLS"/nested-state build-image core
+ tests.nested build-image core
# Modify seed to use devmode for pc gadget snap. This is needed for the
# install hook to have access to /etc/systemd. Ideally we would use
@@ -43,7 +43,7 @@ prepare: |
kpartx -d "$NESTED_IMAGES_DIR/$IMAGE_NAME"
rmdir "$tmp"
- "$TESTSTOOLS"/nested-state create-vm core
+ tests.nested create-vm core
execute: |
#shellcheck source=tests/lib/nested.sh
diff --git a/tests/nested/manual/core20-boot-config-update/task.yaml b/tests/nested/manual/core20-boot-config-update/task.yaml
index a648a6d266..56f6e9467b 100644
--- a/tests/nested/manual/core20-boot-config-update/task.yaml
+++ b/tests/nested/manual/core20-boot-config-update/task.yaml
@@ -62,8 +62,8 @@ prepare: |
snap pack pc-gadget/ extra-snaps/
fi
- "$TESTSTOOLS"/nested-state build-image core
- "$TESTSTOOLS"/nested-state create-vm core
+ tests.nested build-image core
+ tests.nested create-vm core
nested_copy snapd-boot-config-update.snap
diff --git a/tests/nested/manual/core20-custom-kernel-commandline/task.yaml b/tests/nested/manual/core20-custom-kernel-commandline/task.yaml
index 590d250c3c..f320aebf82 100644
--- a/tests/nested/manual/core20-custom-kernel-commandline/task.yaml
+++ b/tests/nested/manual/core20-custom-kernel-commandline/task.yaml
@@ -46,8 +46,8 @@ prepare: |
rm pc-gadget/cmdline.full
snap pack pc-gadget --filename=pc-gadget-cmdline-none.snap
- "$TESTSTOOLS"/nested-state build-image core
- "$TESTSTOOLS"/nested-state create-vm core
+ tests.nested build-image core
+ tests.nested create-vm core
for f in pc-gadget-cmdline-extra-updated.snap pc-gadget-cmdline-full.snap pc-gadget-cmdline-none.snap; do
nested_copy "$f"
diff --git a/tests/nested/manual/core20-early-config/task.yaml b/tests/nested/manual/core20-early-config/task.yaml
index c07115cf55..d85a1429da 100644
--- a/tests/nested/manual/core20-early-config/task.yaml
+++ b/tests/nested/manual/core20-early-config/task.yaml
@@ -32,8 +32,8 @@ prepare: |
rm -f "$SNAKEOIL_KEY" "$SNAKEOIL_CERT"
- "$TESTSTOOLS"/nested-state build-image core
- "$TESTSTOOLS"/nested-state create-vm core
+ tests.nested build-image core
+ tests.nested create-vm core
execute: |
#shellcheck source=tests/lib/nested.sh
diff --git a/tests/nested/manual/core20-gadget-cloud-conf/task.yaml b/tests/nested/manual/core20-gadget-cloud-conf/task.yaml
index 995a99f746..c5fd09fd85 100644
--- a/tests/nested/manual/core20-gadget-cloud-conf/task.yaml
+++ b/tests/nested/manual/core20-gadget-cloud-conf/task.yaml
@@ -104,10 +104,10 @@ prepare: |
# #shellcheck disable=SC2148
# systemd-run --unit fakedevicesvc fakedevicesvc localhost:11029
- "$TESTSTOOLS"/nested-state build-image core
+ tests.nested build-image core
# first boot will use seed1 to create the normal-user in addition to the
# system-user assertion
- "$TESTSTOOLS"/nested-state create-vm core
+ tests.nested create-vm core
restore: |
if [ "$TRUST_TEST_KEYS" = "false" ]; then
diff --git a/tests/nested/manual/core20-initramfs-time-moves-forward/task.yaml b/tests/nested/manual/core20-initramfs-time-moves-forward/task.yaml
index b13a87d0b7..ae5c33f15d 100644
--- a/tests/nested/manual/core20-initramfs-time-moves-forward/task.yaml
+++ b/tests/nested/manual/core20-initramfs-time-moves-forward/task.yaml
@@ -25,8 +25,8 @@ prepare: |
#shellcheck source=tests/lib/nested.sh
. "$TESTSLIB/nested.sh"
- "$TESTSTOOLS"/nested-state build-image core
- "$TESTSTOOLS"/nested-state create-vm core
+ tests.nested build-image core
+ tests.nested create-vm core
execute: |
#shellcheck source=tests/lib/nested.sh
diff --git a/tests/nested/manual/core20-install-mode-shutdown-via-hook/task.yaml b/tests/nested/manual/core20-install-mode-shutdown-via-hook/task.yaml
index ac4d5c180f..c6e47ffc49 100644
--- a/tests/nested/manual/core20-install-mode-shutdown-via-hook/task.yaml
+++ b/tests/nested/manual/core20-install-mode-shutdown-via-hook/task.yaml
@@ -36,7 +36,7 @@ prepare: |
cp install-device pc-gadget/meta/hooks/install-device
snap pack pc-gadget/ extra-snaps/
- "$TESTSTOOLS"/nested-state build-image core
+ tests.nested build-image core
restore: |
# Cleanup restore is needed in this case because nested tests are not
@@ -81,7 +81,7 @@ execute: |
MATCH "ubuntu-data" < partitions.txt
echo "Now starting the VM again will proceed to run mode appropriately"
- "$TESTSTOOLS"/nested-state start-vm
+ tests.nested start-vm
# setup SSH since that was not done with the previous stage, as the device
# shut down while still in install mode, we need to manually do this stage
diff --git a/tests/nested/manual/core20-save/task.yaml b/tests/nested/manual/core20-save/task.yaml
index f1b7184b96..2405f3a3f2 100644
--- a/tests/nested/manual/core20-save/task.yaml
+++ b/tests/nested/manual/core20-save/task.yaml
@@ -28,9 +28,9 @@ environment:
prepare: |
# NESTED_ENABLE_TPM and NESTED_UBUNTU_SAVE are used by build-image
- "$TESTSTOOLS"/nested-state build-image core
+ tests.nested build-image core
# NESTED_ENABLE_TPM is used by create-vm
- "$TESTSTOOLS"/nested-state create-vm core
+ tests.nested create-vm core
debug: |
env | sort | grep NESTED_ || true
diff --git a/tests/nested/manual/grade-signed-above-testkeys-boot/task.yaml b/tests/nested/manual/grade-signed-above-testkeys-boot/task.yaml
index 2830e6e166..b478ee0ecb 100644
--- a/tests/nested/manual/grade-signed-above-testkeys-boot/task.yaml
+++ b/tests/nested/manual/grade-signed-above-testkeys-boot/task.yaml
@@ -99,8 +99,8 @@ prepare: |
# #shellcheck disable=SC2148
# systemd-run --unit fakedevicesvc fakedevicesvc localhost:11029
- "$TESTSTOOLS"/nested-state build-image core
- "$TESTSTOOLS"/nested-state create-vm core
+ tests.nested build-image core
+ tests.nested create-vm core
restore: |
if [ "$TRUST_TEST_KEYS" = "false" ]; then
diff --git a/tests/nested/manual/grade-signed-cloud-init-testkeys/task.yaml b/tests/nested/manual/grade-signed-cloud-init-testkeys/task.yaml
index 2360e9dc15..cb5f48b0dd 100644
--- a/tests/nested/manual/grade-signed-cloud-init-testkeys/task.yaml
+++ b/tests/nested/manual/grade-signed-cloud-init-testkeys/task.yaml
@@ -102,10 +102,10 @@ prepare: |
# second boot - attacker drive
nested_build_seed_cdrom "$TESTSLIB/cloud-init-seeds/attacker-user" seed2.iso cidata user-data meta-data
- "$TESTSTOOLS"/nested-state build-image core
+ tests.nested build-image core
# first boot will use seed1 to create the normal-user in addition to the
# system-user assertion
- "$TESTSTOOLS"/nested-state create-vm core --param-cdrom "-cdrom $(pwd)/seed.iso"
+ tests.nested create-vm core --param-cdrom "-cdrom $(pwd)/seed.iso"
restore: |
if [ "$TRUST_TEST_KEYS" = "false" ]; then
diff --git a/tests/nested/manual/minimal-smoke/task.yaml b/tests/nested/manual/minimal-smoke/task.yaml
index 0165c80ada..eba06144ad 100644
--- a/tests/nested/manual/minimal-smoke/task.yaml
+++ b/tests/nested/manual/minimal-smoke/task.yaml
@@ -12,7 +12,7 @@ prepare: |
#shellcheck source=tests/lib/nested.sh
. "$TESTSLIB/nested.sh"
nested_fetch_spread
- "$TESTSTOOLS"/nested-state build-image core
+ tests.nested build-image core
execute: |
#shellcheck source=tests/lib/nested.sh
@@ -39,7 +39,7 @@ execute: |
exit 1
fi
- "$TESTSTOOLS"/nested-state create-vm core --param-mem "-m $MINIMAL_MEM"
+ tests.nested create-vm core --param-mem "-m $MINIMAL_MEM"
echo "Run spread smoke tests using mem: $MINIMAL_MEM"
set +x
diff --git a/tests/nested/manual/preseed/task.yaml b/tests/nested/manual/preseed/task.yaml
index f53dc515c3..bc117f3b91 100644
--- a/tests/nested/manual/preseed/task.yaml
+++ b/tests/nested/manual/preseed/task.yaml
@@ -25,7 +25,7 @@ prepare: |
dpkg -i "$SPREAD_PATH"/../snapd_*.deb
# create a VM and mount a cloud image
- "$TESTSTOOLS"/nested-state build-image classic
+ tests.nested build-image classic
mkdir -p "$IMAGE_MOUNTPOINT"
IMAGE_NAME=$(nested_get_image_name classic)
mount_ubuntu_image "$NESTED_IMAGES_DIR/$IMAGE_NAME" "$IMAGE_MOUNTPOINT"
@@ -89,7 +89,7 @@ execute: |
. "$TESTSLIB/preseed.sh"
umount_ubuntu_image "$IMAGE_MOUNTPOINT"
- "$TESTSTOOLS"/nested-state create-vm classic
+ tests.nested create-vm classic
#shellcheck source=tests/lib/nested.sh
. "$TESTSLIB/nested.sh"
diff --git a/tests/nested/manual/refresh-revert-fundamentals/task.yaml b/tests/nested/manual/refresh-revert-fundamentals/task.yaml
index 58d9248814..321e0e4370 100644
--- a/tests/nested/manual/refresh-revert-fundamentals/task.yaml
+++ b/tests/nested/manual/refresh-revert-fundamentals/task.yaml
@@ -42,8 +42,8 @@ prepare: |
exit
fi
- "$TESTSTOOLS"/nested-state build-image core
- "$TESTSTOOLS"/nested-state create-vm core
+ tests.nested build-image core
+ tests.nested create-vm core
debug: |
#shellcheck source=tests/lib/nested.sh
diff --git a/tests/nested/manual/snapd-refresh-from-old/task.yaml b/tests/nested/manual/snapd-refresh-from-old/task.yaml
index 82c853c941..466b85bca3 100644
--- a/tests/nested/manual/snapd-refresh-from-old/task.yaml
+++ b/tests/nested/manual/snapd-refresh-from-old/task.yaml
@@ -27,8 +27,8 @@ prepare: |
wget -P extra-snaps "$SNAPD_SNAP_URL" "$CORE18_SNAP_URL"
# create core image with old snapd & core18
- "$TESTSTOOLS"/nested-state build-image core
- "$TESTSTOOLS"/nested-state create-vm core
+ tests.nested build-image core
+ tests.nested create-vm core
# for refresh in later step of the test
repack_snapd_deb_into_snapd_snap "$PWD"
diff --git a/tests/nested/manual/uc20-storage-safety/task.yaml b/tests/nested/manual/uc20-storage-safety/task.yaml
index ebe0e09e6c..e21749c074 100644
--- a/tests/nested/manual/uc20-storage-safety/task.yaml
+++ b/tests/nested/manual/uc20-storage-safety/task.yaml
@@ -39,8 +39,8 @@ prepare: |
cp "$TESTSLIB"/assertions/developer1.account "$NESTED_FAKESTORE_BLOB_DIR/asserts"
cp "$TESTSLIB"/assertions/developer1.account-key "$NESTED_FAKESTORE_BLOB_DIR/asserts"
- "$TESTSTOOLS"/nested-state build-image core
- "$TESTSTOOLS"/nested-state create-vm core
+ tests.nested build-image core
+ tests.nested create-vm core
restore: |
if [ "$TRUST_TEST_KEYS" = "false" ]; then