From eabec01e3891ef1fa1f705036511989957fa1436 Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Wed, 31 Jul 2024 12:49:42 +0200 Subject: [PATCH] Fix gating tests Greatly reworked tmt gating tests, added missing dependencies and made the test run more resilient to interruptions. Resolves: RHEL-35571 --- plans/env.yaml | 2 +- plans/udisks2.fmf | 60 +++++++++++++++------------- tests/ignore_tests.yml | 88 ------------------------------------------ udisks2.spec | 14 ++++--- 4 files changed, 43 insertions(+), 121 deletions(-) delete mode 100644 tests/ignore_tests.yml diff --git a/plans/env.yaml b/plans/env.yaml index ffdfbe1..3fffcf4 100644 --- a/plans/env.yaml +++ b/plans/env.yaml @@ -1,2 +1,2 @@ --- - version: '2.10.1' + xversion: '2.10.1' diff --git a/plans/udisks2.fmf b/plans/udisks2.fmf index d4cdf08..741099a 100644 --- a/plans/udisks2.fmf +++ b/plans/udisks2.fmf @@ -1,10 +1,11 @@ -summary: udisks2 testing +summary: udisks2 gating tests environment-file: - plans/env.yaml prepare: how: install package: + - rpm-build - dbus-daemon - python3-blivet - python3-bytesize @@ -23,6 +24,7 @@ prepare: - udisks2-lsm - udisks2-lvm2 - nvme-cli + - nvmetcli discover: how: shell @@ -32,34 +34,38 @@ discover: dist-git-install-builddeps: true tests: - name: regression tests - test: > + test: | set -x - systemctl restart libstoragemgmt.service; - systemctl restart iscsi-init.service; - systemctl restart udisks2.service; - if [ -z "$version" ];then - #version=$(grep -E "Version" $TMT_SOURCE_DIR/udisks2.spec | head -1 |sed 's/Version: //'); - echo "don't defind the version" + if [ -z "$PKG_VER" ]; then + PKG_VER=`rpmspec -q --srpm --qf "%{version}" udisks2.spec` + fi + if [ -z "$PKG_VER" ]; then + echo "Error: Unable to extract package version" exit 1 - fi; - pushd $TMT_SOURCE_DIR/udisks-${version}; - /usr/bin/udisksctl dump; - pushd $TMT_SOURCE_DIR/udisks-${version}/src/tests/; - find -name '*.py' -or -name integration-test | while read i; do sed -e 's/time\\.sleep(/time.sleep(5*/' -i $i; done; - popd; - pushd $TMT_SOURCE_DIR/udisks-${version}/src/tests/dbus-tests/; - echo "UDISKS_MODULES_ENABLED = { 'lvm2', 'iscsi', 'lsm' }" > config_h.py; - echo "PACKAGE_SYSCONF_DIR = '/etc/'" >> config_h.py; - popd; - targetcli clearconfig confirm=True; - python3 src/tests/dbus-tests/run_tests.py --system; - targetcli clearconfig confirm=True; - pushd $TMT_SOURCE_DIR/udisks-${version}/src/tests/; - python3 ./integration-test --log-file=integration-tests.log 2>&1; - popd; - cat src/tests/integration-tests.log; - cat flight_record.log; - cat journaldump.log; + fi + pushd "$TMT_SOURCE_DIR/udisks-$PKG_VER" + find -path './src/tests/*.py' -or -path './src/tests/integration-test' | while read i; do sed -e 's/time\\.sleep(/time.sleep(5*/' -i "$i"; done + echo "UDISKS_MODULES_ENABLED = { 'lvm2', 'iscsi', 'lsm' }" > src/tests/dbus-tests/config_h.py + echo "PACKAGE_SYSCONF_DIR = '/etc/'" >> src/tests/dbus-tests/config_h.py + sed -i src/tests/dbus-tests/udiskstestcase.py -e "s!flight_record.log!$TMT_TEST_DATA/flight_record.log!" + sed -i src/tests/dbus-tests/run_tests.py -e "s!journaldump.log!$TMT_TEST_DATA/journaldump.log!" + + # prepare system services + systemctl restart libstoragemgmt.service + systemctl restart iscsi-init.service + systemctl restart udisks2.service + udisksctl dump &> "$TMT_TEST_DATA/pre-udisksctl_dump.log" + + # d-bus test + targetcli clearconfig confirm=True + python3 src/tests/dbus-tests/run_tests.py --system + targetcli clearconfig confirm=True + + # integration test + pushd src/tests + python3 ./integration-test --log-file="$TMT_TEST_DATA/integration-tests.log" 2>&1 + popd + execute: - how: tmt adjust: diff --git a/tests/ignore_tests.yml b/tests/ignore_tests.yml deleted file mode 100644 index 18721f6..0000000 --- a/tests/ignore_tests.yml +++ /dev/null @@ -1,88 +0,0 @@ ---- -- hosts: localhost - roles: - - role: standard-test-source # Fetch source tarball and unpack it into the test environment - tags: - - always - - - role: standard-test-basic - tags: - - classic - - required_packages: # Install test dependencies - - dbus-daemon - - python3-blivet - - python3-bytesize - - python3-systemd - - targetcli - - smartmontools - - rsync - - xfsprogs - - dosfstools - - e2fsprogs - - cryptsetup - - python3-six - # - kmod-kvdo # not available in rhel-9.0.0-beta - - sqlite - - libstoragemgmt - - python3-libstoragemgmt - - udisks2-iscsi - - udisks2-lsm - - udisks2-lvm2 - - tests: - - start-lsmd: - dir: . - run: "systemctl start libstoragemgmt.service; systemctl status libstoragemgmt.service; exit 0" - - start-iscsi: - dir: . - run: "systemctl start iscsi-init.service; systemctl status iscsi-init.service; exit 0" - - udisksctl-dump: - dir: . - run: "/usr/bin/udisksctl dump" - - - increase-timeouts: - dir: ./source/src/tests/ - run: "find -name '*.py' -or -name integration-test | while read i; do sed -e 's/time\\.sleep(/time.sleep(5*/' -i $i; done" - - define-test-modules: - dir: ./source/src/tests/dbus-tests/ - run: "echo \"UDISKS_MODULES_ENABLED = { 'lvm2', 'iscsi', 'lsm' }\" > config_h.py" - - - define-test-var: - dir: ./source/src/tests/dbus-tests/ - run: "echo \"PACKAGE_SYSCONF_DIR = '/etc'\" >> config_h.py" - - - dbus-tests-start: - dir: . - run: "targetcli clearconfig confirm=True" - - dbus-tests-disable-vdo: - dir: ./source/src/tests/dbus-tests/ - run: "sed -i test_10_basic.py -e 's/find_executable(\"vdo\")/find_executable(\"vdo-disabled\")/'" - - dbus-tests: - dir: ./source/ - run: "python3 src/tests/dbus-tests/run_tests.py --system" - - - - integration-tests-start: - dir: . - run: "targetcli clearconfig confirm=True" - - integration-tests: - dir: ./source/src/tests/ - run: "python3 ./integration-test --log-file=integration-tests.log 2>&1" - - - - dump-integration-tests-log: - dir: ./source/src/tests/ - run: "cat integration-tests.log" - - dump-flight_record: - dir: ./source/ - run: "cat flight_record.log" - - dump-journal-dbus_tests: - dir: ./source/ - run: "cat journaldump.log" - - dump-journal-system: - dir: . - run: "journalctl --all --no-pager" - - dump-dmesg: - dir: . - run: "dmesg" diff --git a/udisks2.spec b/udisks2.spec index c105cf3..32c4d9c 100644 --- a/udisks2.spec +++ b/udisks2.spec @@ -24,7 +24,7 @@ Name: udisks2 Summary: Disk Manager Version: 2.10.90 -Release: 1.git%{git_hash}%{?dist} +Release: 2.git%{git_hash}%{?dist} License: GPL-2.0-or-later URL: https://github.com/storaged-project/udisks Source0: https://github.com/storaged-project/udisks/releases/download/udisks-%{version}/udisks-%{version}.git%{git_hash}.tar.bz2 @@ -123,7 +123,7 @@ access to the udisksd daemon. %package -n %{name}-iscsi Summary: Module for iSCSI -Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: lib%{name}%{?_isa} = %{version}-%{release} License: LGPL-2.0-or-later Requires: iscsi-initiator-utils BuildRequires: iscsi-initiator-utils-devel @@ -135,7 +135,7 @@ This package contains module for iSCSI configuration. %package -n %{name}-lvm2 Summary: Module for LVM2 -Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: lib%{name}%{?_isa} = %{version}-%{release} License: LGPL-2.0-or-later Requires: lvm2 Requires: libblockdev-lvm >= %{libblockdev_version} @@ -160,7 +160,7 @@ a dynamic library, which provides access to the udisksd daemon. %if 0%{?with_btrfs} %package -n %{name}-btrfs Summary: Module for BTRFS -Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: lib%{name}%{?_isa} = %{version}-%{release} License: LGPL-2.0-or-later Requires: libblockdev-btrfs >= %{libblockdev_version} BuildRequires: libblockdev-btrfs-devel >= %{libblockdev_version} @@ -174,7 +174,7 @@ This package contains module for BTRFS configuration. %if 0%{?with_lsm} %package -n %{name}-lsm Summary: Module for LSM -Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: lib%{name}%{?_isa} = %{version}-%{release} License: LGPL-2.0-or-later Requires: libstoragemgmt BuildRequires: libstoragemgmt-devel @@ -332,6 +332,10 @@ fi %endif %changelog +* Wed Jul 31 2024 Tomas Bzatek - 2.10.90-2.gitdb54112e +- Fix Requires: for modules +- Fix gating tests + * Thu Jul 25 2024 Tomas Bzatek - 2.10.90-1.gitdb54112e - Rebase to git snapshot as of 2024-07-25