From 90603e540fee167007f5908505e2db65bac99270 Mon Sep 17 00:00:00 2001 From: Sergio Cazzolato Date: Fri, 31 Jul 2026 13:45:40 -0300 Subject: [PATCH] tests: fix snapd-maintenance-msg test for beta validation This test needs to be updated in order to refresh to a different channel when running beta validation (core20 channel is stable). In the ci the core20 channel is edge. --- tests/core/snapd-maintenance-msg/task.yaml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tests/core/snapd-maintenance-msg/task.yaml b/tests/core/snapd-maintenance-msg/task.yaml index 18dba16cd93..97465e2c6db 100644 --- a/tests/core/snapd-maintenance-msg/task.yaml +++ b/tests/core/snapd-maintenance-msg/task.yaml @@ -33,8 +33,27 @@ execute: | echo "Restoring the snapd snap" snap revert snapd + # refresh the core20 base + current_channel=$(snap info core20 | awk '/^tracking:/{print $2}') + current_track="${current_channel%/*}" + current_risk="${current_channel##*/}" + + stable_channel="${current_track}/stable" + if [ "$current_risk" = "stable" ]; then + refresh_channel="${current_track}/edge" + else + refresh_channel="$stable_channel" + fi + + current_revision=$(snap info core20 | awk -v ch="${current_channel}:" '$1 == ch { print $3 }') + refresh_revision=$(snap info core20 | awk -v ch="${refresh_channel}:" '$1 == ch { print $3 }') + if [ "$current_revision" = "$refresh_revision" ]; then + echo "core20 current channel (${current_channel}) and refresh channel (${refresh_channel}) are on the same revision (${refresh_revision}); skipping reboot maintenance check" + exit 0 + fi + echo "Testing maintenance message for system reboots" - snap refresh core20 --channel=stable --amend & + snap refresh core20 --channel="$refresh_channel" --amend & retry -n 20 --wait 0.5 sh -c 'snap debug api '/v2/changes?select=all' | gojq ".maintenance" | MATCH "system is restarting"' wait