Skip to content

Commit

Permalink
tests: extend refresh hold spread test checks
Browse files Browse the repository at this point in the history
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
  • Loading branch information
MiguelPires committed Sep 1, 2022
1 parent 5131923 commit b1aacfc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/main/snap-refresh-hold/task.yaml
Expand Up @@ -2,6 +2,8 @@ summary: Check snap refresh hold and unhold

prepare: |
snap install test-snapd-tools
snap set system experimental.parallel-instances=true
snap install test-snapd-tools_instance
snap install --devmode jq
restore: |
Expand All @@ -12,6 +14,7 @@ restore: |
execute: |
reset() {
snap refresh --channel=latest/stable test-snapd-tools
snap refresh --channel=latest/stable test-snapd-tools_instance
snap refresh --unhold test-snapd-tools
snap refresh --unhold
}
Expand All @@ -35,10 +38,11 @@ execute: |
systemctl stop snapd.{service,socket}
"$TESTSTOOLS"/snapd-state change-snap-channel test-snapd-tools edge
"$TESTSTOOLS"/snapd-state change-snap-channel test-snapd-tools_instance edge
"$TESTSTOOLS"/snapd-state force-autorefresh
systemctl start snapd.{socket,service}
if retry -n 5 --quiet sh -c 'snap changes | tail -2 | grep "Done.*Auto-refresh"'; then
if retry -n 5 --quiet sh -c 'snap changes | tail -2 | grep "Done.*Auto-refresh snap "test-snapd-tools_instance""'; then
echo "expected 'snap refresh --hold' to prevent auto-refresh"
exit 1
fi
Expand All @@ -57,7 +61,8 @@ execute: |
echo "Held snaps don't refresh in general refreshes"
reset
snap refresh --hold=forever test-snapd-tools
snap refresh 2>&1 | MATCH "All snaps up to date."
snap switch --edge test-snapd-tools_instance
snap refresh 2>&1 | MATCH "test-snapd-tools_instance .* refreshed"
echo "Held snaps are refreshed in specific refreshes"
reset
Expand Down

0 comments on commit b1aacfc

Please sign in to comment.