From b6c89d6fbd5510015e232e5ee8059e6fb715f59b Mon Sep 17 00:00:00 2001 From: Sergio Cazzolato Date: Fri, 26 Jul 2024 16:53:47 -0300 Subject: [PATCH] tests: fix uc-update-assets-secure nested test in uc24 (#14262) * tests:fix uc-update-assets-secure nested test This test failes with the executables are moved to EFI/ubuntu instead of EFI/boot * fix also core20-install-mode-shutdown-via-hook test used the code we have in nested.sh to check "cloud-init status --wait" * fix case when 'cloud-init status --wait' doesn't fail prevent unbound variable error --- .../core20-install-mode-shutdown-via-hook/task.yaml | 7 ++++++- tests/nested/manual/uc-update-assets-secure/task.yaml | 11 ++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) 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 79607f95e54..e44933e733c 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 @@ -87,7 +87,12 @@ execute: | # Wait for snap seeding to be done remote.exec "sudo snap wait system seed.loaded" # Wait for cloud init to be done - remote.exec "cloud-init status --wait" + ret=0 + remote.exec "cloud-init status --wait" || ret=$? + if [ "$ret" -ne 0 ] && [ "$ret" -ne 2 ]; then + echo "cloud-init finished with error $ret" + exit 1 + fi echo "The device is using encrypted ubuntu-data and is in run mode now" remote.exec test -L /dev/disk/by-label/ubuntu-data-enc diff --git a/tests/nested/manual/uc-update-assets-secure/task.yaml b/tests/nested/manual/uc-update-assets-secure/task.yaml index b5098e9280e..e4ea0ea3813 100644 --- a/tests/nested/manual/uc-update-assets-secure/task.yaml +++ b/tests/nested/manual/uc-update-assets-secure/task.yaml @@ -74,19 +74,24 @@ prepare: | snap pack pc --filename=pc_2.snap + grubx64_dir=boot + if os.query is-ubuntu-ge 24.04; then + grubx64_dir=ubuntu + fi + cat <>expected-before ${old_shim_sha} */boot/efi/EFI/boot/bootx64.efi - ${old_grub_sha} */boot/efi/EFI/boot/grubx64.efi + ${old_grub_sha} */boot/efi/EFI/${grubx64_dir}/grubx64.efi EOF if [ "${UPDATE_SEED}" = true ]; then cat <>expected-after ${new_shim_sha} */boot/efi/EFI/boot/bootx64.efi - ${new_grub_sha} */boot/efi/EFI/boot/grubx64.efi + ${new_grub_sha} */boot/efi/EFI/${grubx64_dir}/grubx64.efi EOF else cat <>expected-after ${old_shim_sha} */boot/efi/EFI/boot/bootx64.efi - ${old_grub_sha} */boot/efi/EFI/boot/grubx64.efi + ${old_grub_sha} */boot/efi/EFI/${grubx64_dir}/grubx64.efi EOF fi