From 3eeaca0b4d20612f6d7b821286b91ea9ea54f286 Mon Sep 17 00:00:00 2001 From: Patryk Matuszak <305846+pmtk@users.noreply.github.com> Date: Thu, 1 Jun 2023 09:17:50 +0200 Subject: [PATCH 1/6] wip do not merge debug test xyz123 --- e2e/tests/0040-reboot.sh | 2 +- e2e/tests/assets/greenboot-test.sh | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/e2e/tests/0040-reboot.sh b/e2e/tests/0040-reboot.sh index 22a5b84897..f058eaa734 100755 --- a/e2e/tests/0040-reboot.sh +++ b/e2e/tests/0040-reboot.sh @@ -8,7 +8,7 @@ set -x SCRIPT_PATH="$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")" -RETRIES=5 +RETRIES=15 BACKOFF=20 wait_until() { diff --git a/e2e/tests/assets/greenboot-test.sh b/e2e/tests/assets/greenboot-test.sh index ef9c1061be..60fc99599f 100644 --- a/e2e/tests/assets/greenboot-test.sh +++ b/e2e/tests/assets/greenboot-test.sh @@ -10,14 +10,20 @@ function check_greenboot_exit_status() { local cleanup=$2 if [ "${cleanup}" -ne 0 ]; then + crictl images + podman images echo 1 | microshift-cleanup-data --all + crictl images + podman images systemctl enable --now microshift || true + crictl images + podman images fi for check_script in $(find /etc/greenboot/check/ -name \*.sh | sort); do echo Running "${check_script}"... local currentRC=1 - if ${check_script}; then + if bash -x "${check_script}"; then currentRC=0 fi From 9a4e8561bd6c404b5a7f1c45ab34a9987004b19b Mon Sep 17 00:00:00 2001 From: Patryk Matuszak <305846+pmtk@users.noreply.github.com> Date: Thu, 1 Jun 2023 14:21:33 +0200 Subject: [PATCH 2/6] require N successful ssh connections after reboot --- e2e/tests/0040-reboot.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/e2e/tests/0040-reboot.sh b/e2e/tests/0040-reboot.sh index f058eaa734..f964c03bae 100755 --- a/e2e/tests/0040-reboot.sh +++ b/e2e/tests/0040-reboot.sh @@ -8,13 +8,22 @@ set -x SCRIPT_PATH="$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")" -RETRIES=15 -BACKOFF=20 +RETRIES=25 +BACKOFF=10 +SUCCESSFUL_TRIES=3 wait_until() { + successes=0 local cmd=$* for _ in $(seq "${RETRIES}"); do - ${cmd} && return 0 + if ${cmd}; then + successes=$((successes+=1)) + else + successes=0 + fi + if [[ "${successes}" -ge "${SUCCESSFUL_TRIES}" ]]; then + return 0 + fi sleep "${BACKOFF}" done return 1 From 8f087b3736768642d2716d0293409017cac16983 Mon Sep 17 00:00:00 2001 From: Patryk Matuszak <305846+pmtk@users.noreply.github.com> Date: Thu, 1 Jun 2023 16:24:27 +0200 Subject: [PATCH 3/6] install podman --- e2e/tests/assets/greenboot-test.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/e2e/tests/assets/greenboot-test.sh b/e2e/tests/assets/greenboot-test.sh index 60fc99599f..b6a9590c51 100644 --- a/e2e/tests/assets/greenboot-test.sh +++ b/e2e/tests/assets/greenboot-test.sh @@ -5,6 +5,9 @@ IFS=$'\n\t' PS4='+ $(date "+%T.%N")\011 ' set -x +sudo dnf install -y --setopt=install_weak_deps=False podman +whereis skopeo || true + function check_greenboot_exit_status() { local expectedRC=$1 local cleanup=$2 From 855a0f295d8b466c184cfbcc897fa971aad81a6d Mon Sep 17 00:00:00 2001 From: Patryk Matuszak <305846+pmtk@users.noreply.github.com> Date: Fri, 2 Jun 2023 09:56:08 +0200 Subject: [PATCH 4/6] save and load images --- e2e/tests/assets/greenboot-test.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/e2e/tests/assets/greenboot-test.sh b/e2e/tests/assets/greenboot-test.sh index b6a9590c51..e31e297c4b 100644 --- a/e2e/tests/assets/greenboot-test.sh +++ b/e2e/tests/assets/greenboot-test.sh @@ -14,19 +14,20 @@ function check_greenboot_exit_status() { if [ "${cleanup}" -ne 0 ]; then crictl images - podman images + podman save --output /root/images.tar $(podman images -q | tr '\n' ' ') + echo 1 | microshift-cleanup-data --all + + podman load --input /root/images.tar crictl images - podman images + systemctl enable --now microshift || true - crictl images - podman images fi for check_script in $(find /etc/greenboot/check/ -name \*.sh | sort); do echo Running "${check_script}"... local currentRC=1 - if bash -x "${check_script}"; then + if "${check_script}"; then currentRC=0 fi From a42413b5362877c6c48a0465466ad3e07c56efd6 Mon Sep 17 00:00:00 2001 From: Patryk Matuszak <305846+pmtk@users.noreply.github.com> Date: Fri, 2 Jun 2023 11:56:23 +0200 Subject: [PATCH 5/6] save at the start --- e2e/tests/assets/greenboot-test.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/e2e/tests/assets/greenboot-test.sh b/e2e/tests/assets/greenboot-test.sh index e31e297c4b..b96f6bf84f 100644 --- a/e2e/tests/assets/greenboot-test.sh +++ b/e2e/tests/assets/greenboot-test.sh @@ -8,16 +8,19 @@ set -x sudo dnf install -y --setopt=install_weak_deps=False podman whereis skopeo || true +mapfile -t images < <(podman images -q) +podman save --multi-image-archive --output /root/images.tar "${images[@]}" + function check_greenboot_exit_status() { local expectedRC=$1 local cleanup=$2 if [ "${cleanup}" -ne 0 ]; then crictl images - podman save --output /root/images.tar $(podman images -q | tr '\n' ' ') echo 1 | microshift-cleanup-data --all + crictl images podman load --input /root/images.tar crictl images From 96965a94fb6e268a7e2443e2e46bce446adc764a Mon Sep 17 00:00:00 2001 From: Patryk Matuszak <305846+pmtk@users.noreply.github.com> Date: Fri, 2 Jun 2023 13:06:02 +0200 Subject: [PATCH 6/6] Update greenboot-test.sh --- e2e/tests/assets/greenboot-test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/tests/assets/greenboot-test.sh b/e2e/tests/assets/greenboot-test.sh index b96f6bf84f..54b141bfdb 100644 --- a/e2e/tests/assets/greenboot-test.sh +++ b/e2e/tests/assets/greenboot-test.sh @@ -9,7 +9,7 @@ sudo dnf install -y --setopt=install_weak_deps=False podman whereis skopeo || true mapfile -t images < <(podman images -q) -podman save --multi-image-archive --output /root/images.tar "${images[@]}" +podman save --output /root/images.tar "${images[@]}" function check_greenboot_exit_status() { local expectedRC=$1