Run WSL tests on 20.04+

The behaviour of python regarding asynchronous packages changed between
18.04 and 20.04+. OOBE is only supported on 20.04 and higher and there
is no point in making the WSL specific code compatible with ealier
releases than 20.04

Co-authored-by: Didier Roche <didrocks@ubuntu.com>
This commit is contained in:
Jean-Baptiste Lallement 2021-09-09 11:48:16 +02:00 committed by Didier Roche
parent 44b0b66531
commit 4a2f2af268
1 changed files with 18 additions and 9 deletions

View File

@ -4,6 +4,8 @@ set -eux
testschema=.subiquity/test-autoinstall-schema.json
export PYTHONPATH=$PWD:$PWD/probert:$PWD/curtin
RELEASE=$(lsb_release -rs)
validate () {
mode="install"
[ $# -gt 0 ] && mode="$1"
@ -70,8 +72,11 @@ for answers in examples/answers*.yaml; do
validate
grep -q 'finish: subiquity/Install/install/postinstall/run_unattended_upgrades: SUCCESS: downloading and installing security updates' .subiquity/subiquity-server-debug.log
else
timeout --foreground 60 sh -c "LANG=C.UTF-8 python3 -m system_setup.cmd.tui --answers $answers --dry-run " < $tty
validate "system_setup"
# The OOBE doesn't exist in WSL < 20.04
if [ "${RELEASE%.*}" -ge 20 ]; then
timeout --foreground 60 sh -c "LANG=C.UTF-8 python3 -m system_setup.cmd.tui --answers $answers --dry-run " < $tty
validate "system_setup"
fi
fi
done
@ -107,17 +112,21 @@ while ! scurl a/meta/status >& /dev/null ; do
done
scurl a/storage/has_bitlocker | jq -M '. [0].partitions[2]' | grep -q BitLocker
# NOTE:
# This test doesnt do much ATM but it will be useful when we have more complex scenarios to test with the server and client code.
# Like generating a wsl.conf file and comparing it to the oracle.
clean
timeout --foreground 60 sh -c "LANG=C.UTF-8 python3 -m system_setup.cmd.tui --autoinstall examples/autoinstall-system-setup.yaml --dry-run"
# The OOBE doesn't exist in WSL < 20.04
if [ "${RELEASE%.*}" -ge 20 ]; then
# NOTE:
# This test doesnt do much ATM but it will be useful when we have more complex scenarios to test with the server and client code.
# Like generating a wsl.conf file and comparing it to the oracle.
clean
timeout --foreground 60 sh -c "LANG=C.UTF-8 python3 -m system_setup.cmd.tui --autoinstall examples/autoinstall-system-setup.yaml --dry-run"
python3 -m system_setup.cmd.schema > "$testschema"
scripts/schema-cmp.py "autoinstall-system-setup-schema.json" "$testschema" --ignore-tz
fi
python3 -m subiquity.cmd.schema > "$testschema"
scripts/schema-cmp.py "autoinstall-schema.json" "$testschema"
python3 -m system_setup.cmd.schema > "$testschema"
scripts/schema-cmp.py "autoinstall-system-setup-schema.json" "$testschema" --ignore-tz
set +x # show PASS/FAIL as the last line of output
echo 'Runtests all PASSED'