Skip to content

Commit

Permalink
tests: Validate autorestart logic
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Graber <[email protected]>
  • Loading branch information
stgraber committed Aug 31, 2024
1 parent 6ee6842 commit 9b19e91
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/suites/basic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -668,4 +668,22 @@ test_basic_usage() {
incus delete -f c1 c2 c3
remaining_instances="$(incus list --format csv)"
[ -z "${remaining_instances}" ]

# Test autorestart mechanism
incus launch testimage c1 -c boot.autorestart=true

for i in $(seq 10); do
PID=$(incus info c1 | awk '/^PID/ {print $2}')
kill -9 "${PID}"
sleep 3
done

[ "$(incus list -cs -fcsv c1)" = "RUNNING" ] || false

PID=$(incus info c1 | awk '/^PID/ {print $2}')
kill -9 "${PID}"
sleep 3

[ "$(incus list -cs -fcsv c1)" = "STOPPED" ] || false
incus delete -f c1
}

0 comments on commit 9b19e91

Please sign in to comment.