Skip to content

Commit 90603e5

Browse files
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.
1 parent 546cb6a commit 90603e5

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

tests/core/snapd-maintenance-msg/task.yaml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,27 @@ execute: |
3333
echo "Restoring the snapd snap"
3434
snap revert snapd
3535
36+
# refresh the core20 base
37+
current_channel=$(snap info core20 | awk '/^tracking:/{print $2}')
38+
current_track="${current_channel%/*}"
39+
current_risk="${current_channel##*/}"
40+
41+
stable_channel="${current_track}/stable"
42+
if [ "$current_risk" = "stable" ]; then
43+
refresh_channel="${current_track}/edge"
44+
else
45+
refresh_channel="$stable_channel"
46+
fi
47+
48+
current_revision=$(snap info core20 | awk -v ch="${current_channel}:" '$1 == ch { print $3 }')
49+
refresh_revision=$(snap info core20 | awk -v ch="${refresh_channel}:" '$1 == ch { print $3 }')
50+
if [ "$current_revision" = "$refresh_revision" ]; then
51+
echo "core20 current channel (${current_channel}) and refresh channel (${refresh_channel}) are on the same revision (${refresh_revision}); skipping reboot maintenance check"
52+
exit 0
53+
fi
54+
3655
echo "Testing maintenance message for system reboots"
37-
snap refresh core20 --channel=stable --amend &
56+
snap refresh core20 --channel="$refresh_channel" --amend &
3857
retry -n 20 --wait 0.5 sh -c 'snap debug api '/v2/changes?select=all' | gojq ".maintenance" | MATCH "system is restarting"'
3958
wait
4059

0 commit comments

Comments
 (0)