diff --git a/scripts/runtests.sh b/scripts/runtests.sh index 8c844fbe5..43490a3ee 100755 --- a/scripts/runtests.sh +++ b/scripts/runtests.sh @@ -35,23 +35,27 @@ validate () { echo "password leaked into log file" exit 1 fi - opt= - [ $# -gt 1 ] && opt="$2" - if [ $opt = reset-only ]; then - python3 scripts/validate-yaml.py --no-root-mount "${cfgs[@]}" - else - python3 scripts/validate-yaml.py "${cfgs[@]}" - fi + case $testname in + autoinstall-reset-only) + python3 scripts/validate-yaml.py --no-root-mount "${cfgs[@]}" + ;; + answers-core) + ;; + *) + python3 scripts/validate-yaml.py "${cfgs[@]}" + ;; + esac if [ ! -e $tmpdir/subiquity-client-debug.log ] || [ ! -e $tmpdir/subiquity-server-debug.log ]; then echo "log file not created" exit 1 fi - if [ "$opt" = reset-only ]; then - return - fi - if [ $answers != examples/answers/core.yaml ]; then - python3 scripts/validate-autoinstall-user-data.py < $tmpdir/var/log/installer/autoinstall-user-data - fi + case $testname in + answers-core) + ;; + *) + python3 scripts/validate-autoinstall-user-data.py < $tmpdir/var/log/installer/autoinstall-user-data + ;; + esac netplan generate --root $tmpdir elif [ "${mode}" = "system_setup" ]; then setup_mode="$2" @@ -174,6 +178,7 @@ export SUBIQUITY_REPLAY_TIMESCALE=100 for answers in examples/answers/*.yaml; do if echo $answers|grep -vq system-setup; then + testname=answers-$(basename $answers .yaml) config=$(sed -n 's/^#machine-config: \(.*\)/\1/p' $answers || true) catalog=$(sed -n 's/^#source-catalog: \(.*\)/\1/p' $answers || true) dr_config=$(sed -n 's/^#dr-config: \(.*\)/\1/p' "$answers" || true) @@ -227,6 +232,7 @@ for answers in examples/answers/*.yaml; do clean done +testname=autoinstall-most-options LANG=C.UTF-8 timeout --foreground 60 \ python3 -m subiquity.cmd.tui \ --dry-run \ @@ -261,6 +267,7 @@ grep -q 'finish: subiquity/Install/install/postinstall/run_unattended_upgrades: $tmpdir/subiquity-server-debug.log clean +testname=autoinstall-simple LANG=C.UTF-8 timeout --foreground 60 \ python3 -m subiquity.cmd.tui \ --dry-run \ @@ -275,6 +282,7 @@ python3 scripts/check-yaml-fields.py "$tmpdir"/var/log/installer/autoinstall-use grep -q 'finish: subiquity/Install/install/postinstall/run_unattended_upgrades: SUCCESS: downloading and installing security updates' $tmpdir/subiquity-server-debug.log clean +testname=autoinstall-hybrid LANG=C.UTF-8 timeout --foreground 60 \ python3 -m subiquity.cmd.tui \ --dry-run \ @@ -288,6 +296,7 @@ LANG=C.UTF-8 timeout --foreground 60 \ validate clean +testname=autoinstall-reset-only LANG=C.UTF-8 timeout --foreground 60 \ python3 -m subiquity.cmd.tui \ --dry-run \ @@ -296,7 +305,7 @@ LANG=C.UTF-8 timeout --foreground 60 \ --autoinstall examples/autoinstall/reset-only.yaml \ --kernel-cmdline autoinstall \ --source-catalog examples/sources/install.yaml -validate install reset-only +validate install # The OOBE doesn't exist in WSL < 20.04 if [ "${RELEASE%.*}" -ge 20 ]; then