Migrate lvm2 gating tests from STI to TMT - RHELMISC-9586

This commit is contained in:
Filip Suba 2025-03-26 08:08:03 +01:00
parent 250afac13f
commit 17da88b5b1
5 changed files with 122 additions and 1 deletions

View File

@ -3,7 +3,7 @@ product_versions:
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}
- !PassingTestCaseRule {test_case_name: osci.brew-build./plans/gating.functional}
# TODO: This is not automated yet and it's not easy to run, so we agreed
# with QE we will not run these for 8.1
#- !PassingTestCaseRule {test_case_name: manual.sst_platform_storage.lvm2.manual-sts-tier1}

32
plans/gating.fmf Normal file
View File

@ -0,0 +1,32 @@
summary: LVM2 gating tests
discover:
how: fmf
execute:
how: tmt
provision:
hardware:
memory: ">= 3 GB"
virtualization:
is-supported: true
prepare:
- name: install pacakges
how: install
package:
- python3-libselinux
- sed
- tar
- util-linux
- psmisc # killall is required by testsuite
- nmap-ncat # nc required by lvmpolld tests (or socat)
- binutils # strings is required by some tests
- strace
- vim-common # xxd required by some tests
- mdadm
- vdo
- kmod-kvdo
- lvm2
- lvm2-testsuite
- lvm2-lockd
- lvm2-dbusd
- device-mapper-event
- cryptsetup

7
tests/gating/main.fmf Normal file
View File

@ -0,0 +1,7 @@
summary: LVM2 gating test
description: LVM2 gating test
component:
- lvm2
test: ./main.sh
duration: 4h
enabled: true

82
tests/gating/main.sh Executable file
View File

@ -0,0 +1,82 @@
#!/bin/bash -x
TESTSUITE_OUT_FILE="lvm2-testsuite.out"
IGNORE_FAILURES=(
"lvconvert-thin.sh"
"lvcreate-cache.sh"
"lvcreate-thin-big.sh"
"lvconvert-cache-abort.sh"
"lvconvert-mirror.sh"
"dmeventd-restart.sh"
"nomda-restoremissing.sh"
"api/dbus"
"open-file-limit.sh"
"shell/integrity"
"writecache-blocksize"
"system_id.sh"
"shell/lvconvert-repair-policy.sh"
"shell/lvconvert-repair-thin.sh"
"shell/thin-foreign-dmeventd.sh"
"shell/lvresize-fs-crypt.sh"
)
SKIP_TESTS=(
"api/dbustest.sh"
"read-ahead.sh"
"shell/inconsistent-metadata.sh"
"lvconvert-cache-abort.sh"
"shell/000-basic.sh"
"shell/fsadm-crypt.sh"
"lvconvert-raid-reshape.sh"
"shell/lvconvert-raid-takeover.sh"
"shell/lvm-on-md.sh"
"shell/thin-flags.sh"
"shell/inconsistent-metadata.sh"
"shell/vgchange-many.sh"
)
skip_tests_regex="$(printf "%s|" "${SKIP_TESTS[@]}")"
skip_tests_regex="${skip_tests_regex%|}" # Remove trailing pipe
ignore_failures_pattern="$(printf "%s|" "${IGNORE_FAILURES[@]}")"
ignore_failures_pattern="${ignore_failures_pattern%|}" # Remove trailing pipe
free
df
lsblk
systemctl stop lvm2-lvmpolld.service
systemctl stop lvm2-lvmpolld.socket
systemctl stop lvm2-monitor.service
systemctl stop dm-event.socket
systemctl stop dm-event.service
systemctl stop lvm2-pvscan@.service
systemctl mask lvm2-pvscan@.service
sed -i 's/monitoring *= *.*/monitoring = 0/' /etc/lvm/lvm.conf
cd /usr/share/lvm2-testsuite || exit 1
lvm2_tests="$(find . -name "*.sh" | sed 's/^\.\///' | grep -vE "($skip_tests_regex)" | sort)"
echo "$lvm2_tests"
cd - || exit 1
cd /usr/share/lvm2-testsuite/lib || exit 1
flavours="$(ls -1 flavour-udev-* | grep -v "lvmlockd-dlm\|lvmlockd-sanlock" | grep "vanilla" | sed 's/^flavour-//')"
echo "$flavours"
cd - || exit 1
# Run testsuite in RAM disk:
mkdir -p /dev/shm/lvm2-slave
export LVM_TEST_DIR=/dev/shm/lvm2-slave
mount -o remount,dev /dev/shm
for test_script in $lvm2_tests; do
lvm2-testsuite --batch --flavours "$flavours" --only "$test_script" 2>&1 | tee -a "$TESTSUITE_OUT_FILE"
RESULT="${PIPESTATUS[0]}"
if [[ $RESULT -ne 0 ]]; then
tmt-file-submit -l "${flavours}:${test_script//\//_}.txt"
fi
done
tmt-file-submit -l "$TESTSUITE_OUT_FILE"
! grep -v "\(passed\|skipped\|warnings\|running 1 tests\)" "$TESTSUITE_OUT_FILE" | grep -Ev "(${ignore_failures_pattern})" | grep -v "^[[:space:]]*$"
exit $?