Skip to content

Commit

Permalink
t/m/snap-quota-memory: improve robustness of test on some distros (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
Meulengracht authored and ernestl committed Feb 18, 2024
1 parent 61ec0fd commit b3dfeaa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/main/snap-quota-memory/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,11 @@ execute: |
TIMESTAMP_AFTER=$(service_start_time snap.go-example-webserver.webserver.service)
test "$TIMESTAMP_AFTER" -eq "$TIMESTAMP_BEFORE"
# There is a limit to how many times (5) a service can be started within a 10-second timeframe, and we can, depending
# on timing, hit this limit because systemd tries to restart the service 3 times when it's being oomkilled by
# the memory quota. If it fails once, wait 10 seconds and try again
echo "But they can still be started manually"
snap start go-example-webserver.webserver
retry --wait 10 -n 2 sh -c 'snap start go-example-webserver.webserver'
retry --wait 1 -n 10 sh -c 'snap services go-example-webserver.webserver | MATCH "go-example-webserver.webserver\s+enabled\s+active"'
echo "Removing a snap ensures that the snap is not in the quota group anymore"
Expand Down

0 comments on commit b3dfeaa

Please sign in to comment.