2018-02-28 00:42:47 +00:00
|
|
|
#!/bin/bash
|
2018-06-14 23:43:06 +00:00
|
|
|
set -eux
|
2020-04-29 02:50:39 +00:00
|
|
|
|
2021-08-09 16:16:18 +00:00
|
|
|
export PYTHONPATH=$PWD:$PWD/probert:$PWD/curtin
|
2021-03-03 18:25:23 +00:00
|
|
|
|
2021-09-09 09:48:16 +00:00
|
|
|
RELEASE=$(lsb_release -rs)
|
|
|
|
|
2022-03-18 17:32:09 +00:00
|
|
|
tmpdir=$(mktemp -d)
|
2022-09-28 16:02:04 +00:00
|
|
|
subiquity_pid=""
|
2022-03-18 17:32:09 +00:00
|
|
|
|
2020-04-29 02:50:39 +00:00
|
|
|
validate () {
|
2021-08-31 10:10:25 +00:00
|
|
|
mode="install"
|
|
|
|
[ $# -gt 0 ] && mode="$1"
|
|
|
|
|
2022-03-18 17:32:09 +00:00
|
|
|
if [ -d $tmpdir/var/crash -a -n "$(ls -A $tmpdir/var/crash)" ] ; then
|
|
|
|
echo "error: subiquity crashed"
|
2021-10-12 22:22:10 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-03-18 17:32:09 +00:00
|
|
|
if [ -s $tmpdir/server-stderr ]; then
|
|
|
|
echo "error: unexpected output on stderr"
|
|
|
|
cat $tmpdir/server-stderr
|
2022-03-08 10:20:30 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-09-20 22:42:47 +00:00
|
|
|
if [ "${mode}" = "install" ]; then
|
2022-11-11 01:43:54 +00:00
|
|
|
cfgs=()
|
2022-11-03 09:59:57 +00:00
|
|
|
for stage in partitioning formatting; do
|
|
|
|
cfg="$tmpdir"/var/log/installer/curtin-install/subiquity-$stage.conf
|
2022-11-11 01:43:54 +00:00
|
|
|
if [ -e "$cfg" ]; then
|
|
|
|
cfgs+=("$cfg")
|
2022-11-03 09:59:57 +00:00
|
|
|
fi
|
|
|
|
done
|
2023-06-28 00:21:09 +00:00
|
|
|
if grep passw0rd $tmpdir/subiquity-client-debug.log $tmpdir/subiquity-server-debug.log | grep -v "Loaded answers" | grep -v "answers_action"; then
|
|
|
|
echo "password leaked into log file"
|
|
|
|
exit 1
|
|
|
|
fi
|
2023-08-02 22:02:36 +00:00
|
|
|
case $testname in
|
|
|
|
autoinstall-reset-only)
|
|
|
|
python3 scripts/validate-yaml.py --no-root-mount "${cfgs[@]}"
|
|
|
|
;;
|
|
|
|
answers-core)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
python3 scripts/validate-yaml.py "${cfgs[@]}"
|
|
|
|
;;
|
|
|
|
esac
|
2022-03-18 17:32:09 +00:00
|
|
|
if [ ! -e $tmpdir/subiquity-client-debug.log ] || [ ! -e $tmpdir/subiquity-server-debug.log ]; then
|
2021-08-31 10:10:25 +00:00
|
|
|
echo "log file not created"
|
|
|
|
exit 1
|
|
|
|
fi
|
2023-08-02 22:02:36 +00:00
|
|
|
case $testname in
|
|
|
|
answers-core)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
python3 scripts/validate-autoinstall-user-data.py < $tmpdir/var/log/installer/autoinstall-user-data
|
2023-09-07 09:31:53 +00:00
|
|
|
# After the lunar release and the introduction of mirror testing, it
|
|
|
|
# came to our attention that new Ubuntu installations have the security
|
|
|
|
# repository configured with the primary mirror URL (i.e.,
|
|
|
|
# http://<cc>.archive.ubuntu.com/ubuntu) instead of
|
|
|
|
# http://security.ubuntu.com/ubuntu. Let's ensure we instruct curtin
|
|
|
|
# not to do that.
|
|
|
|
# If we run an autoinstall that customizes the security section as part
|
|
|
|
# of the test-suite, we will need to adapt this test.
|
|
|
|
python3 scripts/check-yaml-fields.py $tmpdir/var/log/installer/subiquity-curtin-apt.conf \
|
|
|
|
apt.security[0].uri='"http://security.ubuntu.com/ubuntu/"' \
|
|
|
|
apt.security[0].arches='["amd64", "i386"]' \
|
|
|
|
apt.security[1].uri='"http://ports.ubuntu.com/ubuntu-ports"'
|
2023-08-02 22:02:36 +00:00
|
|
|
;;
|
|
|
|
esac
|
2022-03-18 17:32:09 +00:00
|
|
|
netplan generate --root $tmpdir
|
2021-08-31 10:10:25 +00:00
|
|
|
elif [ "${mode}" = "system_setup" ]; then
|
2021-10-06 15:00:06 +00:00
|
|
|
setup_mode="$2"
|
2022-03-18 17:32:09 +00:00
|
|
|
launcher_cmds="$tmpdir/run/launcher-command"
|
2021-10-06 15:00:06 +00:00
|
|
|
echo "system setup validation for $setup_mode"
|
2021-12-14 15:04:38 +00:00
|
|
|
echo "checking ${launcher_cmds}"
|
|
|
|
if [ ! -f ${launcher_cmds} ]; then
|
|
|
|
echo "Expected launcher commands to be written to the file."
|
|
|
|
exit 1
|
|
|
|
elif [ -z "$(grep action ${launcher_cmds})" ] && [ "${setup_mode}" != "autoinstall-no-shutdown" ]; then
|
|
|
|
echo "Expected action to be set in launcher commands."
|
|
|
|
exit 1
|
|
|
|
elif [ -z "$(grep defaultUid ${launcher_cmds})" ] && [ "${setup_mode}" != "answers-reconf" ]; then
|
|
|
|
echo "Expected defaultUid to be set in launcher commands."
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
cat ${launcher_cmds}
|
|
|
|
fi
|
2021-10-15 08:29:35 +00:00
|
|
|
expected_status="reboot"
|
|
|
|
if [ "${setup_mode}" = "autoinstall-full" ]; then
|
|
|
|
expected_status="shutdown"
|
|
|
|
elif [ "${setup_mode}" = "autoinstall-no-shutdown" ]; then
|
2021-12-14 15:04:38 +00:00
|
|
|
expected_status=""
|
2021-10-15 08:29:35 +00:00
|
|
|
fi
|
2021-12-14 15:04:38 +00:00
|
|
|
result_status="$(cat ${launcher_cmds} | grep action | cut -d = -f 2)"
|
2021-10-15 08:29:35 +00:00
|
|
|
if [ "${result_status}" != "${expected_status}" ]; then
|
2021-12-14 15:04:38 +00:00
|
|
|
echo "incorrect ${launcher_cmds}: expect ${expected_status}, got ${result_status}"
|
2021-10-15 08:29:35 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2021-10-15 16:50:06 +00:00
|
|
|
echo "checking generated config"
|
2022-03-18 17:32:09 +00:00
|
|
|
[ -d "$tmpdir/etc/" ] || (echo "etc/ dir not created for config"; exit 1)
|
2021-10-15 08:29:35 +00:00
|
|
|
if [ "${setup_mode}" = "autoinstall-no-shutdown" ]; then
|
|
|
|
setup_mode="autoinstall"
|
|
|
|
fi
|
2021-10-06 15:00:06 +00:00
|
|
|
[ -d "system_setup/tests/golden/${setup_mode}" ] || (echo "tests/golden not found in system_setup"; exit 1)
|
|
|
|
for file in system_setup/tests/golden/${setup_mode}/*.conf; do
|
|
|
|
filename=$(basename ${file})
|
2022-03-18 17:32:09 +00:00
|
|
|
conf_filepath="$tmpdir/etc/${filename}"
|
2021-12-14 15:04:38 +00:00
|
|
|
diff -NBup "${file}" "${conf_filepath}" || exit 1
|
2021-10-06 15:00:06 +00:00
|
|
|
done
|
2021-10-15 16:50:06 +00:00
|
|
|
if [ "${setup_mode}" != "answers-reconf" ]; then
|
|
|
|
echo "checking user created"
|
2022-03-18 17:32:09 +00:00
|
|
|
[ -d "$tmpdir/home/" ] || (echo "home/ dir not created for the environment"; exit 1)
|
|
|
|
[ -d "$tmpdir/home/ubuntu" ] || (echo "home folder not created for the user"; exit 1)
|
|
|
|
if grep -v ubuntu $tmpdir/etc/passwd ; then
|
2021-10-15 16:50:06 +00:00
|
|
|
echo "user definition not included in etc/passwd"
|
|
|
|
exit 1
|
|
|
|
fi
|
2022-03-18 17:32:09 +00:00
|
|
|
if grep -v Ubuntu $tmpdir/etc/passwd ; then
|
2021-10-15 16:50:06 +00:00
|
|
|
echo "username not added in etc/passwd"
|
|
|
|
exit 1
|
|
|
|
fi
|
2022-03-18 17:32:09 +00:00
|
|
|
if grep -v ubuntu $tmpdir/etc/shadow ; then
|
2021-10-15 16:50:06 +00:00
|
|
|
echo "user definition not included in etc/shadow"
|
|
|
|
exit 1
|
|
|
|
fi
|
2022-03-18 17:32:09 +00:00
|
|
|
if ! grep -q sudo $tmpdir/etc/group ; then
|
2021-10-15 16:50:06 +00:00
|
|
|
echo "expected group sudo not included in etc/group"
|
|
|
|
exit 1
|
|
|
|
fi
|
2022-03-18 17:32:09 +00:00
|
|
|
if ! (grep sudo $tmpdir/etc/group | grep -q ubuntu) ; then
|
2021-10-15 16:50:06 +00:00
|
|
|
echo "user not assigned with the expected group sudo"
|
|
|
|
exit 1
|
|
|
|
fi
|
2022-01-06 10:59:30 +00:00
|
|
|
# Extract value of the LANG variable from etc/default/locale (with or without quotes)
|
2022-03-18 17:32:09 +00:00
|
|
|
lang="$(grep -Eo 'LANG=([^.@ _]+)' $tmpdir/etc/default/locale | cut -d= -f 2- | cut -d\" -f 2-)"
|
2022-03-22 22:00:12 +00:00
|
|
|
if ! ls $tmpdir/var/cache/apt/archives/*.log | grep --fixed-strings --quiet -- "$lang"; then
|
2021-11-22 15:16:01 +00:00
|
|
|
echo "expected $lang language packs in directory var/cache/apt/archives/"
|
2021-11-09 21:10:44 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2022-03-22 22:00:12 +00:00
|
|
|
for f in $tmpdir/var/cache/apt/archives/*.log ; do
|
2022-11-01 10:34:00 +00:00
|
|
|
if ! [ -s $f ]; then
|
2022-03-22 22:00:12 +00:00
|
|
|
echo "apt failed for package $f"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
2022-03-18 17:32:09 +00:00
|
|
|
if [ -z "$( diff -Nup $tmpdir/etc/locale.gen $tmpdir/etc/locale.gen.test)" ] ; then
|
2021-11-09 21:10:44 +00:00
|
|
|
echo "expected changes in etc/locale.gen"
|
|
|
|
exit 1
|
|
|
|
fi
|
2021-10-15 16:50:06 +00:00
|
|
|
fi
|
2021-08-31 10:10:25 +00:00
|
|
|
else
|
|
|
|
echo "W: Unknown validation mode: ${mode}"
|
2019-02-20 14:09:28 +00:00
|
|
|
fi
|
2020-04-29 02:50:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
clean () {
|
2022-03-18 17:32:09 +00:00
|
|
|
[ -d "$tmpdir" ] && rm -fr $tmpdir
|
|
|
|
tmpdir=$(mktemp -d)
|
2020-04-29 02:50:39 +00:00
|
|
|
}
|
|
|
|
|
2022-03-21 16:48:36 +00:00
|
|
|
on_exit () {
|
|
|
|
ec=$?
|
2022-09-28 16:02:04 +00:00
|
|
|
set +xe # show PASS/FAIL in the last lines of output
|
2022-03-21 16:48:36 +00:00
|
|
|
if [[ $ec = 0 ]] ; then
|
|
|
|
echo 'Runtests all PASSED'
|
|
|
|
else
|
|
|
|
echo 'Runtests FAILURE'
|
|
|
|
echo "Output from the last run is at $tmpdir"
|
2023-07-20 23:37:36 +00:00
|
|
|
if [ -n "${GITHUB_ACTIONS:-}" -a -d $tmpdir/var/crash -a -n "$(ls -A $tmpdir/var/crash)" ] ; then
|
|
|
|
for file in $tmpdir/var/crash/*.crash; do
|
|
|
|
echo "--- Start crash file $file ---"
|
|
|
|
cat $file
|
|
|
|
echo "--- End crash file $file ---"
|
|
|
|
done
|
|
|
|
fi
|
2022-03-21 16:48:36 +00:00
|
|
|
fi
|
2022-09-28 16:02:04 +00:00
|
|
|
|
|
|
|
if [ -n "$subiquity_pid" ] ; then
|
|
|
|
kill "$subiquity_pid"
|
|
|
|
fi
|
|
|
|
|
2022-03-21 16:48:36 +00:00
|
|
|
exit $ec
|
2021-08-09 16:16:18 +00:00
|
|
|
}
|
|
|
|
|
2022-03-21 16:48:36 +00:00
|
|
|
trap on_exit EXIT
|
2021-02-17 21:34:56 +00:00
|
|
|
tty=$(tty) || tty=/dev/console
|
|
|
|
|
2020-04-29 02:50:39 +00:00
|
|
|
export SUBIQUITY_REPLAY_TIMESCALE=100
|
2022-09-28 16:02:04 +00:00
|
|
|
|
2023-07-11 00:18:38 +00:00
|
|
|
for answers in examples/answers/*.yaml; do
|
2021-08-31 10:10:25 +00:00
|
|
|
if echo $answers|grep -vq system-setup; then
|
2023-08-02 22:02:36 +00:00
|
|
|
testname=answers-$(basename $answers .yaml)
|
2021-08-31 10:10:25 +00:00
|
|
|
config=$(sed -n 's/^#machine-config: \(.*\)/\1/p' $answers || true)
|
2022-11-01 10:34:00 +00:00
|
|
|
catalog=$(sed -n 's/^#source-catalog: \(.*\)/\1/p' $answers || true)
|
2022-11-24 16:31:17 +00:00
|
|
|
dr_config=$(sed -n 's/^#dr-config: \(.*\)/\1/p' "$answers" || true)
|
2021-08-31 10:10:25 +00:00
|
|
|
if [ -z "$config" ]; then
|
2023-07-11 00:18:38 +00:00
|
|
|
config=examples/machines/simple.json
|
2021-08-31 10:10:25 +00:00
|
|
|
fi
|
2022-11-01 10:34:00 +00:00
|
|
|
if [ -z "$catalog" ]; then
|
2023-07-11 10:46:19 +00:00
|
|
|
catalog=examples/sources/install.yaml
|
2022-11-01 10:34:00 +00:00
|
|
|
fi
|
2021-08-31 10:10:25 +00:00
|
|
|
serial=$(sed -n 's/^#serial/x/p' $answers || true)
|
2022-04-19 12:27:11 +00:00
|
|
|
opts=()
|
2021-08-31 10:10:25 +00:00
|
|
|
if [ -n "$serial" ]; then
|
2022-04-19 12:27:11 +00:00
|
|
|
opts+=(--serial)
|
2021-08-31 10:10:25 +00:00
|
|
|
fi
|
2022-11-24 16:31:17 +00:00
|
|
|
if [ -n "$dr_config" ]; then
|
|
|
|
opts+=(--dry-run-config "$dr_config")
|
|
|
|
fi
|
2021-08-31 10:10:25 +00:00
|
|
|
# The --foreground is important to avoid subiquity getting SIGTTOU-ed.
|
2022-04-19 12:27:11 +00:00
|
|
|
LANG=C.UTF-8 timeout --foreground 60 \
|
|
|
|
python3 -m subiquity.cmd.tui < "$tty" \
|
|
|
|
--dry-run \
|
|
|
|
--output-base "$tmpdir" \
|
2022-04-22 09:41:25 +00:00
|
|
|
--answers "$answers" \
|
|
|
|
"${opts[@]}" \
|
|
|
|
--machine-config "$config" \
|
|
|
|
--bootloader uefi \
|
2022-04-19 12:50:52 +00:00
|
|
|
--snaps-from-examples \
|
2022-11-01 10:34:00 +00:00
|
|
|
--source-catalog $catalog
|
2022-11-01 12:53:39 +00:00
|
|
|
validate install
|
2023-07-19 03:15:23 +00:00
|
|
|
if [ $answers != examples/answers/core.yaml ]; then
|
|
|
|
grep -q 'finish: subiquity/Install/install/postinstall/run_unattended_upgrades: SUCCESS: downloading and installing security updates' $tmpdir/subiquity-server-debug.log
|
|
|
|
fi
|
2021-08-31 10:10:25 +00:00
|
|
|
else
|
2021-09-09 09:48:16 +00:00
|
|
|
# The OOBE doesn't exist in WSL < 20.04
|
|
|
|
if [ "${RELEASE%.*}" -ge 20 ]; then
|
2021-10-06 15:00:06 +00:00
|
|
|
# check if it is reconf
|
|
|
|
reconf_settings="false"
|
|
|
|
validate_subtype="answers"
|
|
|
|
if echo $answers|grep -q reconf; then
|
|
|
|
reconf_settings="true"
|
|
|
|
validate_subtype="answers-reconf"
|
|
|
|
fi
|
2022-04-19 12:27:11 +00:00
|
|
|
DRYRUN_RECONFIG="$reconf_settings" LANG=C.UTF-8 timeout --foreground 60 \
|
|
|
|
python3 -m system_setup.cmd.tui < "$tty" \
|
2022-04-22 09:41:25 +00:00
|
|
|
--dry-run \
|
2022-04-19 12:27:11 +00:00
|
|
|
--answers "$answers" \
|
2022-04-22 09:41:25 +00:00
|
|
|
--output-base "$tmpdir"
|
2021-10-06 15:00:06 +00:00
|
|
|
validate "system_setup" "$validate_subtype"
|
2021-09-09 09:48:16 +00:00
|
|
|
fi
|
2021-05-04 00:38:19 +00:00
|
|
|
fi
|
2022-03-18 17:32:09 +00:00
|
|
|
clean
|
2018-06-14 23:43:06 +00:00
|
|
|
done
|
2020-04-29 02:50:39 +00:00
|
|
|
|
2023-08-02 22:02:36 +00:00
|
|
|
testname=autoinstall-most-options
|
2022-04-19 12:27:11 +00:00
|
|
|
LANG=C.UTF-8 timeout --foreground 60 \
|
|
|
|
python3 -m subiquity.cmd.tui \
|
|
|
|
--dry-run \
|
2022-04-22 09:41:25 +00:00
|
|
|
--output-base "$tmpdir" \
|
2023-07-11 00:18:38 +00:00
|
|
|
--machine-config examples/machines/existing-partitions.json \
|
2022-04-19 12:27:11 +00:00
|
|
|
--bootloader bios \
|
2023-07-11 10:46:19 +00:00
|
|
|
--autoinstall examples/autoinstall/most-options.yaml \
|
|
|
|
--dry-run-config examples/dry-run-configs/apt-local-mirror.yaml \
|
2022-04-19 12:27:11 +00:00
|
|
|
--kernel-cmdline autoinstall \
|
2023-07-11 10:46:19 +00:00
|
|
|
--source-catalog examples/sources/install.yaml
|
2020-04-29 02:50:39 +00:00
|
|
|
validate
|
2022-03-18 17:32:09 +00:00
|
|
|
python3 scripts/check-yaml-fields.py $tmpdir/var/log/installer/subiquity-curtin-apt.conf \
|
2022-01-05 15:54:11 +00:00
|
|
|
apt.disable_components='[non-free, restricted]' \
|
|
|
|
apt.preferences[0].pin-priority=200 \
|
|
|
|
apt.preferences[0].pin='"origin *ubuntu.com*"' \
|
|
|
|
apt.preferences[1].package='"python-*"' \
|
2023-02-16 10:10:44 +00:00
|
|
|
apt.preferences[1].pin-priority=-1 \
|
|
|
|
apt.debconf_selections.subiquity='"eek"'
|
2022-07-13 09:03:17 +00:00
|
|
|
python3 scripts/check-yaml-fields.py "$tmpdir"/var/log/installer/curtin-install/subiquity-curthooks.conf \
|
2021-04-05 21:16:55 +00:00
|
|
|
storage.config[-1].options='"errors=remount-ro"'
|
2022-03-18 17:32:09 +00:00
|
|
|
python3 scripts/check-yaml-fields.py <(python3 scripts/check-yaml-fields.py $tmpdir/etc/cloud/cloud.cfg.d/99-installer.cfg datasource.None.userdata_raw) \
|
2021-06-08 22:54:29 +00:00
|
|
|
locale='"en_GB.UTF-8"' \
|
2021-07-15 13:30:22 +00:00
|
|
|
timezone='"Pacific/Guam"' \
|
2022-01-05 14:53:19 +00:00
|
|
|
ubuntu_advantage.token='"C1NWcZTHLteJXGVMM6YhvHDpGrhyy7"' \
|
2021-06-08 22:54:29 +00:00
|
|
|
'snap.commands=[snap install --channel=3.2/stable etcd]'
|
2020-10-12 01:23:50 +00:00
|
|
|
grep -q 'finish: subiquity/Install/install/postinstall/install_package1: SUCCESS: installing package1' \
|
2022-03-18 17:32:09 +00:00
|
|
|
$tmpdir/subiquity-server-debug.log
|
2020-10-12 01:23:50 +00:00
|
|
|
grep -q 'finish: subiquity/Install/install/postinstall/install_package2: SUCCESS: installing package2' \
|
2022-03-18 17:32:09 +00:00
|
|
|
$tmpdir/subiquity-server-debug.log
|
|
|
|
grep -q 'switching subiquity to edge' $tmpdir/subiquity-server-debug.log
|
2021-06-28 23:11:49 +00:00
|
|
|
grep -q 'finish: subiquity/Install/install/postinstall/run_unattended_upgrades: SUCCESS: downloading and installing all updates' \
|
2022-03-18 17:32:09 +00:00
|
|
|
$tmpdir/subiquity-server-debug.log
|
2020-04-19 09:44:09 +00:00
|
|
|
|
2020-04-29 02:50:39 +00:00
|
|
|
clean
|
2023-08-02 22:02:36 +00:00
|
|
|
testname=autoinstall-simple
|
2022-04-19 12:27:11 +00:00
|
|
|
LANG=C.UTF-8 timeout --foreground 60 \
|
|
|
|
python3 -m subiquity.cmd.tui \
|
|
|
|
--dry-run \
|
2022-04-22 09:41:25 +00:00
|
|
|
--output-base "$tmpdir" \
|
2023-07-11 00:18:38 +00:00
|
|
|
--machine-config examples/machines/simple.json \
|
2023-07-11 10:46:19 +00:00
|
|
|
--autoinstall examples/autoinstall/user-data.yaml \
|
2022-08-03 09:54:06 +00:00
|
|
|
--kernel-cmdline autoinstall \
|
2023-07-11 10:46:19 +00:00
|
|
|
--source-catalog examples/sources/install.yaml
|
2020-04-29 02:50:39 +00:00
|
|
|
validate
|
2022-08-03 09:54:06 +00:00
|
|
|
python3 scripts/check-yaml-fields.py "$tmpdir"/var/log/installer/autoinstall-user-data \
|
|
|
|
'autoinstall.source.id="ubuntu-server-minimal"'
|
2022-03-18 17:32:09 +00:00
|
|
|
grep -q 'finish: subiquity/Install/install/postinstall/run_unattended_upgrades: SUCCESS: downloading and installing security updates' $tmpdir/subiquity-server-debug.log
|
2021-03-03 18:25:23 +00:00
|
|
|
|
2023-07-20 04:58:10 +00:00
|
|
|
clean
|
2023-08-02 22:02:36 +00:00
|
|
|
testname=autoinstall-hybrid
|
2023-07-20 04:58:10 +00:00
|
|
|
LANG=C.UTF-8 timeout --foreground 60 \
|
|
|
|
python3 -m subiquity.cmd.tui \
|
|
|
|
--dry-run \
|
|
|
|
--output-base "$tmpdir" \
|
|
|
|
--machine-config examples/machines/simple.json \
|
|
|
|
--autoinstall examples/autoinstall/hybrid.yaml \
|
|
|
|
--dry-run-config examples/dry-run-configs/tpm.yaml \
|
|
|
|
--bootloader uefi \
|
|
|
|
--kernel-cmdline autoinstall \
|
|
|
|
--source-catalog examples/sources/tpm.yaml
|
|
|
|
validate
|
|
|
|
|
2023-06-28 00:21:09 +00:00
|
|
|
clean
|
2023-08-02 22:02:36 +00:00
|
|
|
testname=autoinstall-reset-only
|
2023-06-28 00:21:09 +00:00
|
|
|
LANG=C.UTF-8 timeout --foreground 60 \
|
|
|
|
python3 -m subiquity.cmd.tui \
|
|
|
|
--dry-run \
|
|
|
|
--output-base "$tmpdir" \
|
2023-07-11 00:18:38 +00:00
|
|
|
--machine-config examples/machines/simple.json \
|
2023-07-11 10:46:19 +00:00
|
|
|
--autoinstall examples/autoinstall/reset-only.yaml \
|
2023-06-28 00:21:09 +00:00
|
|
|
--kernel-cmdline autoinstall \
|
2023-07-11 10:46:19 +00:00
|
|
|
--source-catalog examples/sources/install.yaml
|
2023-08-02 22:02:36 +00:00
|
|
|
validate install
|
2023-06-28 00:21:09 +00:00
|
|
|
|
2021-09-09 09:48:16 +00:00
|
|
|
# The OOBE doesn't exist in WSL < 20.04
|
|
|
|
if [ "${RELEASE%.*}" -ge 20 ]; then
|
2022-06-07 16:41:27 +00:00
|
|
|
# Test TCP connectivity (system_setup only)
|
|
|
|
clean
|
|
|
|
port=50321
|
2022-06-16 19:43:44 +00:00
|
|
|
LANG=C.UTF-8 python3 -m system_setup.cmd.server --dry-run --tcp-port=$port &
|
2022-06-07 16:41:27 +00:00
|
|
|
subiquity_pid=$!
|
2023-02-06 23:39:06 +00:00
|
|
|
next_time=10
|
2022-06-07 16:41:27 +00:00
|
|
|
until [ $next_time -eq 0 ] || [ ! -z "$(ss -Hlt sport = $port)" ]; do
|
|
|
|
sleep $(( next_time-- ))
|
|
|
|
done
|
|
|
|
if [ $next_time -eq 0 ]; then
|
|
|
|
echo "Timeout reached before Subiquity TCP socket started listening"
|
|
|
|
exit 1
|
|
|
|
fi
|
2022-08-23 15:49:48 +00:00
|
|
|
|
|
|
|
scripts/test-system-setup-loopback-only.py --port "$port" --debug
|
|
|
|
|
2022-06-07 16:41:27 +00:00
|
|
|
# Test system_setup autoinstall.
|
2021-10-15 08:29:35 +00:00
|
|
|
for mode in "" "-full" "-no-shutdown"; do
|
|
|
|
clean
|
2022-04-19 12:27:11 +00:00
|
|
|
LANG=C.UTF-8 timeout --foreground 60 \
|
|
|
|
python3 -m system_setup.cmd.tui \
|
2022-04-22 09:41:25 +00:00
|
|
|
--dry-run \
|
2022-04-19 12:27:11 +00:00
|
|
|
--output-base "$tmpdir" \
|
2023-07-11 10:46:19 +00:00
|
|
|
--autoinstall "examples/autoinstall/system-setup${mode}.yaml"
|
2021-10-15 08:29:35 +00:00
|
|
|
validate "system_setup" "autoinstall${mode}"
|
|
|
|
done
|
2021-10-08 12:21:16 +00:00
|
|
|
|
2022-03-18 17:32:09 +00:00
|
|
|
python3 -m system_setup.cmd.schema > $tmpdir/test-schema.json
|
|
|
|
diff -u "autoinstall-system-setup-schema.json" $tmpdir/test-schema.json
|
2021-09-09 09:48:16 +00:00
|
|
|
fi
|
2021-09-08 15:54:34 +00:00
|
|
|
|
2022-03-18 17:32:09 +00:00
|
|
|
python3 -m subiquity.cmd.schema > $tmpdir/test-schema.json
|
|
|
|
diff -u "autoinstall-schema.json" $tmpdir/test-schema.json
|
2021-09-08 15:54:34 +00:00
|
|
|
|
2022-03-18 17:32:09 +00:00
|
|
|
clean
|