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 32 33 34 35 36 37 38
|
summary: Ensure exit code for retryable error works
details: |
In snapd, the retryable errors are the ones that can be retried later, and
snapd uses a different exit code for retryable errors.
This test forces an error installing 2 times the same snap and checks the
exit code for the the retryable error is 10.
# autopkgtest is sometimes super slow and this test is timing dependent
backends: [-autopkgtest]
execute: |
echo "Install a snap which takes some time to be installed"
snap pack test-snapd-sleep-install
snap install --dangerous test-snapd-sleep-install_*.snap &
echo "And try to install it again which results in a change conflict error"
while true; do
snap changes
if snap changes | grep "Doing.*Install"; then
if snap install --dangerous test-snapd-sleep-install_*.snap; then
echo "snap install should return a change-conflict: test broken"
exit 1
else
errCode=$?
if [ $errCode != 10 ]; then
echo "go unexpected err code $errCode (expecting 10)"
exit 1
fi
fi
break
fi
sleep 0.1
done
# Ensure background processes are finished
wait
|