Port dirinstall gating test from RHEL (sti -> tmt).

This pull request enables tests in the Fedora CI using `tmt` which
also allows to easily execute and debug tests from your laptop:

Run tests directly on your localhost:

    sudo dnf install -y tmt
    tmt run --all provision --how local

Run tests in a virtual machine:

    sudo dnf install -y tmt-provision-virtual
    tmt run

Check the documentation to learn more about the tool:
https://docs.fedoraproject.org/en-US/ci/tmt/
This commit is contained in:
Radek Vykydal 2021-09-02 15:56:59 +02:00
parent 9199e20cef
commit 37897686ef
6 changed files with 93 additions and 0 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

18
plans/dirinstall.fmf Normal file
View File

@ -0,0 +1,18 @@
summary: Integration test - dirinstall on regular system
provision:
standard-inventory-qcow2:
qemu:
m: 2G
prepare:
how: install
package:
- anaconda
# gnome-kiosk is required for "vnc" mode
- gnome-kiosk
execute:
script:
- ANACONDA_UI_MODE=text plans/dirinstall.sh
- plans/show_logs.sh
- ANACONDA_UI_MODE=vnc plans/dirinstall.sh
- plans/show_logs.sh
- journalctl -a

37
plans/dirinstall.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/sh -eux
# Prepare test work directory
WORK_DIR=$(mktemp -d /var/tmp/dirinstall.XXXXXX)
# Create kickstart
KICKSTART_PATH=${WORK_DIR}/ks.cfg
source plans/repositories
TEST_KICKSTART=plans/ks.dirinstall.cfg
# Dump URLs of installation repositories found in local repositories whose names are configured in 'repositories' file
echo "url --metalink=$(dnf repoinfo $BASE_REPO | grep ^Repo-metalink | cut -d: -f2- | sed 's/^ *//')" > ${KICKSTART_PATH}
for repo in $REPOS; do
echo "repo --name=$repo --metalink=$(dnf repoinfo $repo | grep ^Repo-metalink | cut -d: -f2- | sed 's/^ *//')" >> ${KICKSTART_PATH}
done
cat ${TEST_KICKSTART} >> ${KICKSTART_PATH}
# Log the kickstart
cat ${KICKSTART_PATH}
# Run dirinstall
INSTALL_DIR=${WORK_DIR}/install_dir
mkdir ${INSTALL_DIR}
anaconda --dirinstall ${INSTALL_DIR} --kickstart ${KICKSTART_PATH} --${ANACONDA_UI_MODE} --noninteractive 2>&1
# Remove test work directory
rm -rf ${WORK_DIR}

12
plans/ks.dirinstall.cfg Normal file
View File

@ -0,0 +1,12 @@
# The repository configuration (url, repo) needs to be added here.
# It varies by the product and version we are running on / testing
lang en_US.UTF-8
keyboard --vckeymap=us --xlayouts='us'
rootpw --plaintext redhat
timezone --utc Europe/Prague
shutdown
%packages
%end

4
plans/repositories Normal file
View File

@ -0,0 +1,4 @@
# Names of local repositories whose urls will be used for installation
# Repositories for "Fedora X" release:
BASE_REPO="fedora"
REPOS="fedora-modular"

21
plans/show_logs.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/sh -x
ls /tmp
LOG_DIR=/tmp
cd ${LOG_DIR}
KS_SCRIPT_LOGS=$(ls ks-script-*.log)
cd -
ANACONDA_LOGS="anaconda.log storage.log packaging.log program.log dbus.log dnf.librepo.log ${KS_SCRIPT_LOGS}"
for log in ${ANACONDA_LOGS} ; do
LOG_PATH=${LOG_DIR}/${log}
if [ -f ${LOG_PATH} ]; then
echo "----------------------- Dumping log file $LOG_PATH:"
cat $LOG_PATH
# clear for the following test
rm $LOG_PATH
fi
done