Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions e2e/tests/0040-reboot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,22 @@ set -x

SCRIPT_PATH="$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")"

RETRIES=5
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
Expand Down
15 changes: 14 additions & 1 deletion e2e/tests/assets/greenboot-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,32 @@ IFS=$'\n\t'
PS4='+ $(date "+%T.%N")\011 '
set -x

sudo dnf install -y --setopt=install_weak_deps=False podman
whereis skopeo || true

mapfile -t images < <(podman images -q)
podman save --output /root/images.tar "${images[@]}"

function check_greenboot_exit_status() {
local expectedRC=$1
local cleanup=$2

if [ "${cleanup}" -ne 0 ]; then
crictl images

echo 1 | microshift-cleanup-data --all

crictl images
podman load --input /root/images.tar
crictl images

systemctl enable --now microshift || true
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 "${check_script}"; then
currentRC=0
fi

Expand Down