-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
spread: add tests based on the spread framework
This adds the required files for running tests inside generated VM images using the spread framework (https://github.com/snapcore/spread). Spread tests can be run by running the following commands (the build directory refers to the location where the Kiwi images were built): ``` mkdir -p ~/.spread/adhoc cp build/nemos-image-minimal-lunar.x86_64-1.0.1.qcow2 \ ~/.spread/adhoc/nemos-image-minimal-lunar.qcow2 cp build/nemos-image-reference-lunar.x86_64-1.0.1.qcow2 \ ~/.spread/adhoc/nemos-image-reference-lunar.qcow2 spread -v adhoc: ``` Signed-off-by: Isaac True <isaac.true@canonical.com>
- Loading branch information
Showing
6 changed files
with
168 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
|
||
project: nemos-images | ||
|
||
path: /tmp/nemos | ||
|
||
backends: | ||
adhoc: | ||
allocate: | | ||
VM_IMAGE="${HOME}/.spread/${SPREAD_BACKEND}/${SPREAD_SYSTEM}.qcow2" | ||
NVRAM="/tmp/${SPREAD_BACKEND}-${SPREAD_SYSTEM}.fd" | ||
if [ ! -f "${VM_IMAGE}" ]; then | ||
FATAL "File not found: ${VM_IMAGE}" | ||
fi | ||
SSH_PORT=$((30000 + $RANDOM % 20000)) | ||
cp /usr/share/OVMF/OVMF_VARS.fd ${NVRAM} | ||
qemu-system-x86_64 -M q35 -m 1G -daemonize \ | ||
-drive file="/usr/share/OVMF/OVMF_CODE.fd",readonly=on,if=pflash,format=raw,unit=0 \ | ||
-drive file="${NVRAM}",if=pflash,format=raw,unit=1 \ | ||
-drive file="${VM_IMAGE}",format=qcow2,if=virtio \ | ||
-netdev user,id=user0,hostfwd=tcp:127.0.0.1:${SSH_PORT}-:22 \ | ||
-device netdev=user0,driver=virtio-net-pci \ | ||
-serial null -parallel null -monitor none -display none -vga none \ | ||
-pidfile /tmp/${SPREAD_BACKEND}-${SPREAD_SYSTEM}.pid | ||
sleep 30 | ||
ADDRESS 127.0.0.1:${SSH_PORT} | ||
discard: | | ||
kill -9 $(cat /tmp/${SPREAD_BACKEND}-${SPREAD_SYSTEM}.pid) | ||
rm -f /tmp/${SPREAD_BACKEND}-${SPREAD_SYSTEM}.{fd,pid} | ||
systems: | ||
- nemos-image-reference-lunar: | ||
username: admin | ||
password: linux | ||
- nemos-image-minimal-lunar: | ||
username: admin | ||
password: linux | ||
|
||
suites: | ||
tests/spread/: | ||
summary: Integration tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
|
||
summary: "Verify Ubuntu 23.04 OS release information" | ||
|
||
systems: | ||
- "nemos-image-*-lunar" | ||
|
||
execute: | | ||
. /etc/os-release | ||
test "${NAME}" = "Ubuntu" | ||
test "${VERSION_ID}" = "23.04" | ||
test "${VERSION_CODENAME}" = "lunar" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
|
||
summary: "Verify storage configuration" | ||
|
||
systems: | ||
- "nemos-image-reference-*" | ||
|
||
execute: | | ||
# Check that the dm-crypt parameters are correct | ||
test $(dmsetup status luks | awk '{ print $3;}') = "crypt" | ||
export LUKS="$(cryptsetup status luks)" | ||
test $(echo "${LUKS}" | awk '{ if ($1 == "type:") print $2;}') = "LUKS2" | ||
test $(echo "${LUKS}" | awk '{ if ($1 == "cipher:") print $2;}') = "aesgis128-random" | ||
test $(echo "${LUKS}" | awk '{ if ($1 == "integrity:") print $2;}') = "aead" | ||
test $(echo "${LUKS}" | awk '{ if ($1 == "mode:") print $2;}') = "read/write" | ||
# Check that the dm-integrity parameters are correct | ||
test $(dmsetup status luks_dif | awk '{ print $3;}') = "integrity" | ||
test $(cryptsetup status luks_dif | grep type | awk '{ print $2;}') = "INTEGRITY" | ||
export INTEGRITY="$(integritysetup status luks_dif)" | ||
test $(echo "${INTEGRITY}" | awk '{ if ($1 == "type:") print $2;}') = "INTEGRITY" | ||
test $(echo "${INTEGRITY}" | awk '{ if ($1 == "failures:") print $2;}') = "0" | ||
test $(echo "${INTEGRITY}" | awk '{ if ($1 == "mode:") print $2;}') = "read/write" | ||
# Check that the dm-verity parameters are correct | ||
test $(dmsetup status verityRoot | awk '{ print $3;}') = "verity" | ||
export VERITY="$(veritysetup status verityRoot)" | ||
test $(echo "${VERITY}" | awk '{ if ($1 == "type:") print $2;}') = "VERITY" | ||
test $(echo "${VERITY}" | awk '{ if ($1 == "status:") print $2;}') = "verified" | ||
test $(echo "${VERITY}" | awk '{ if ($1 == "mode:") print $2;}') = "readonly" | ||
# Check that / is using overlayfs | ||
test $(mount | grep "on / " | awk '{ print $1;}') = "overlay" |