runtests support - first API test, has_bitlocker

This commit is contained in:
Dan Bungert 2021-08-09 10:16:18 -06:00
parent a688b37a6f
commit ffc4bbde0a
3 changed files with 32 additions and 2 deletions

View File

@ -26,7 +26,8 @@ install_deps: gitdeps
python3-yaml python3-coverage python3-dev pkg-config libnl-genl-3-dev \ python3-yaml python3-coverage python3-dev pkg-config libnl-genl-3-dev \
libnl-route-3-dev python3-attr python3-distutils-extra python3-requests \ libnl-route-3-dev python3-attr python3-distutils-extra python3-requests \
python3-requests-unixsocket python3-jsonschema python3-apport \ python3-requests-unixsocket python3-jsonschema python3-apport \
python3-bson xorriso isolinux python3-aiohttp probert cloud-init ssh-import-id python3-bson xorriso isolinux python3-aiohttp probert cloud-init ssh-import-id \
curl jq
i18n: i18n:
$(PYTHON) setup.py build_i18n $(PYTHON) setup.py build_i18n

View File

@ -11,7 +11,7 @@ ConditionPathExists=/dev/zfs
EOF EOF
cp -r /etc/systemd/system/zfs-mount.service.d/ /etc/systemd/system/zfs-share.service.d/ cp -r /etc/systemd/system/zfs-mount.service.d/ /etc/systemd/system/zfs-share.service.d/
systemctl daemon-reload systemctl daemon-reload
apt-get install -o APT::Get::Always-Include-Phased-Updates=true -y --no-install-recommends libnl-3-dev libnl-genl-3-dev libnl-route-3-dev libsystemd-dev python3-distutils-extra pkg-config python3.5 python3-pip git lsb-release python3-setuptools gcc python3-dev python3-wheel pep8 python3-pyflakes python3-bson make apt-get install -o APT::Get::Always-Include-Phased-Updates=true -y --no-install-recommends libnl-3-dev libnl-genl-3-dev libnl-route-3-dev libsystemd-dev python3-distutils-extra pkg-config python3.5 python3-pip git lsb-release python3-setuptools gcc python3-dev python3-wheel pep8 python3-pyflakes python3-bson make curl jq
pip3 install -r requirements.txt pip3 install -r requirements.txt
make gitdeps make gitdeps

View File

@ -2,6 +2,7 @@
set -eux set -eux
testschema=.subiquity/test-autoinstall-schema.json testschema=.subiquity/test-autoinstall-schema.json
export PYTHONPATH=$PWD:$PWD/probert:$PWD/curtin
validate () { validate () {
python3 scripts/validate-yaml.py .subiquity/subiquity-curtin-install.conf python3 scripts/validate-yaml.py .subiquity/subiquity-curtin-install.conf
@ -22,8 +23,23 @@ clean () {
rm -f "$testschema" rm -f "$testschema"
rm -rf .subiquity/run/ rm -rf .subiquity/run/
rm -rf .subiquity/etc/cloud/cloud.cfg.d/99-installer.cfg rm -rf .subiquity/etc/cloud/cloud.cfg.d/99-installer.cfg
jobslist="$(jobs -p)"
if [ -n "$jobslist" ] ; then
kill $jobslist
fi
} }
scurl () {
curl --unix-socket .subiquity/socket $*
}
error () {
set +x # show PASS/FAIL as the last line of output
echo 'Runtests FAILURE'
}
trap error ERR
trap clean EXIT
tty=$(tty) || tty=/dev/console tty=$(tty) || tty=/dev/console
export SUBIQUITY_REPLAY_TIMESCALE=100 export SUBIQUITY_REPLAY_TIMESCALE=100
@ -71,5 +87,18 @@ timeout --foreground 60 sh -c "LANG=C.UTF-8 python3 -m subiquity.cmd.tui --autoi
validate validate
grep -q 'finish: subiquity/Install/install/postinstall/run_unattended_upgrades: SUCCESS: downloading and installing security updates' .subiquity/subiquity-server-debug.log grep -q 'finish: subiquity/Install/install/postinstall/run_unattended_upgrades: SUCCESS: downloading and installing security updates' .subiquity/subiquity-server-debug.log
timeout --foreground 60 sh -c "LANG=C.UTF-8 python3 -m subiquity.cmd.tui --autoinstall examples/autoinstall.yaml \
--dry-run --machine-config examples/existing-partitions.json --bootloader bios \
--kernel-cmdline 'autoinstall'"
timeout 30 sh -c "LANG=C.UTF-8 python3 -m subiquity.cmd.server --dry-run --bootloader uefi --machine-config examples/win10.json" &
while ! scurl a/meta/status >& /dev/null ; do
sleep .5
done
scurl a/storage/has_bitlocker | jq -M '. [0].partitions[2]' | grep -q BitLocker
python3 -m subiquity.cmd.schema > "$testschema" python3 -m subiquity.cmd.schema > "$testschema"
scripts/schema-cmp.py "autoinstall-schema.json" "$testschema" scripts/schema-cmp.py "autoinstall-schema.json" "$testschema"
set +x # show PASS/FAIL as the last line of output
echo 'Runtests all PASSED'