Update TMT configuration

Resolves: RHEL-111712

Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
This commit is contained in:
Bryn M. Reeves 2025-11-04 19:07:53 +00:00
parent 8a28ce10d9
commit c7528ef1d5
8 changed files with 63 additions and 8 deletions

View File

@ -1,3 +1,4 @@
summary: Run snapm unit tests from dist-git sources
discover:
how: fmf
dist-git-source: true
@ -14,16 +15,18 @@ prepare:
- lvm2
- python3-boom
- python3-pytest
- boom-boot
- rpmdevtools
- name: Enable Stratisd
how: shell
script: |
systemctl enable --now stratisd
- name: Create boom OsProfile
how: shell
script: |
boom profile create --from-host --uname-pattern el10
- name: Enable CRB
how: shell
script: |
dnf install -y "dnf-command(config-manager)" ;
dnf config-manager --set-enabled crb || true
- name: Create boom OsProfile
how: shell
script: |
boom profile create --from-host

2
tests/help/main.fmf Normal file
View File

@ -0,0 +1,2 @@
summary: Test snapm --help output
test: ./test.sh

8
tests/help/test.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh -eux
echo $TMT_SOURCE_DIR
ls $TMT_SOURCE_DIR
tmp=$(mktemp)
snapm --help > "$tmp"
grep 'Snapshot Manager' "$tmp"
rm "$tmp"

View File

@ -1,8 +1,6 @@
summary: Run snapm upstream test suite
test: |
pytest -v --log-level=debug
path: snapm-0.4.3/
test: ./prepare-host-environment.sh; ./run-unit-tests.sh
require:
- python3-pytest
- python3-devel
duration: 25m
duration: 90m

View File

@ -0,0 +1,11 @@
#!/usr/bin/bash
# Prepare the host environment for running the snapm tests.
# This includes installing missing dependencies and tools.
set -euxo pipefail
# Move to the checked out git repo with the test plans
# this should be the root of the dist-git repo
cd "${TMT_TREE}"
sudo dnf builddep -y snapm.spec

View File

@ -0,0 +1,25 @@
#!/usr/bin/bash
# Execute snapm unit tests from a checked out dist-git repo
set -euxo pipefail
source /etc/os-release
# Move to the directory with sources
cd ${TMT_SOURCE_DIR}
# Extract the Source0 basename without extension
SRC_DIR=$(spectool --source 0 snapm.spec | sed 's/.\+\(snapm-[0-9.]\+\)\.tar\.gz/\1/')
# Move to the extracted sources directory (patches are applied by default)
cd "${SRC_DIR}"
# Configure snapm
cp -r etc/snapm/ /etc
cp systemd/*.service systemd/*.timer /usr/lib/systemd/system
cp systemd/tmpfiles.d/snapm.conf /usr/lib/tmpfiles.d
systemctl daemon-reload
systemd-tmpfiles --create /usr/lib/tmpfiles.d/snapm.conf
# Run tests
sudo pytest -v --log-level=debug tests/

2
tests/version/main.fmf Normal file
View File

@ -0,0 +1,2 @@
summary: Test snapm --version output
test: ./test.sh

6
tests/version/test.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh -eux
tmp=$(mktemp)
snapm --version > "$tmp"
grep '0.5.1' "$tmp"
rm "$tmp"