1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
summary: Check that `snap wait` works
details: |
The wait command waits until a configuration becomes true.
This test verifies the `snap wait` command works for seeding
(seed.loaded) and for an arbitrary configuration.
kill-timeout: 10m
prepare: |
"$TESTSTOOLS"/snaps-state install-local basic-hooks
execute: |
echo "Ensure snap wait for seeding works"
snap wait system seed.loaded
echo "Ensure snap wait for arbitrary stuff works"
# set to a false value
snap set basic-hooks foo=0
# keep track
start=$(date +%s)
# ensure we wait 3s before the false value becomes true
( (sleep 3; snap set basic-hooks foo=1)& )
snap wait basic-hooks foo
end=$(date +%s)
# ensure we waited
if [ $((end-start)) -lt 2 ]; then
echo "snap wait returned too early"
exit 1
fi
|