Migrate blivet gating tests from STI to TMT

This commit is contained in:
Vojtech Trefny 2025-07-02 13:37:24 +02:00
parent ee58bf71f3
commit 49c7fb9de1
7 changed files with 38 additions and 87 deletions

View File

@ -3,4 +3,4 @@ product_versions:
- rhel-10 - rhel-10
decision_context: osci_compose_gate decision_context: osci_compose_gate
rules: rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} - !PassingTestCaseRule {test_case_name: osci.brew-build./plans/tests.functional}

37
plans/tests.fmf Normal file
View File

@ -0,0 +1,37 @@
summary: libblockdev gating tests
prepare:
how: install
package:
- python3
- python3-dbus
- libblockdev-plugins-all
- python3-yaml
- targetcli
- stratis-cli
- stratisd
discover:
how: shell
url: https://gitlab.com/redhat/centos-stream/rpms/python-blivet.git
ref: c10s
dist-git-source: true
dist-git-install-builddeps: true
tests:
- name: upstream test suite
test: |
set -x
if [ -z "$PKG_VER" ]; then
PKG_VER=`rpmspec -q --srpm --qf "%{version}" python-blivet.spec`
fi
if [ -z "$PKG_VER" ]; then
echo "Error: Unable to extract package version"
exit 1
fi
pushd $TMT_SOURCE_DIR/blivet-${PKG_VER}
blivet_path=$(find /usr/ -path */site-packages | tr '\n' ':')
PYTHONPATH=$blivet_path python3 tests/run_tests.py
execute:
- how: tmt

View File

@ -1,42 +0,0 @@
#!/usr/bin/python3
import argparse
import sys
import blivet
POOL_NAME = "blivet_test"
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--disks', default='')
args = parser.parse_args()
b = blivet.Blivet()
b.reset()
disks = list()
for disk_id in args.disks.split(','):
disk = b.devicetree.resolve_device(disk_id)
if not disk.is_disk:
sys.stderr.write("specified disk '%s' is not a disk\n" % disk_id)
sys.exit(1)
disks.append(disk)
b.initialize_disk(disk)
if len(disks) > 1:
container_raid_level = "raid1"
total_size = min(d.size for d in disks)
else:
container_raid_level = None
total_size = sum(d.size for d in disks)
lv1 = b.factory_device(size=total_size*0.8, disks=disks,
name="lv1", container_name=POOL_NAME,
fstype='xfs', device_type=blivet.devicefactory.DEVICE_TYPE_LVM)
lv2 = b.factory_device(disks=disks, name="lv2",
container_name=POOL_NAME, container_raid_level='raid1',
fstype='ext4', device_type=blivet.devicefactory.DEVICE_TYPE_LVM)
b.do_it()

View File

@ -1,8 +0,0 @@
---
standard-inventory-qcow2:
qemu:
m: 1G
drive:
- size: 10737418240
- size: 10737418240

View File

@ -1,25 +0,0 @@
---
# - hosts: localhost
- hosts: all
roles:
- role: standard-test-source
tags:
- always
- role: standard-test-basic
tags:
- atomic
- classic
required_packages:
- python3
- python3-dbus
- libblockdev-plugins-all
- python3-yaml
- targetcli
- stratis-cli
- stratisd
tests:
- unit-tests:
dir: .
run: ./unit_testing.sh

View File

@ -1,11 +0,0 @@
#!/bin/bash
# Bail out if anything goes wrong
set -e
# Get path to blivet
blivet_path=$(find /usr/ -path */site-packages | tr '\n' ':')
# Run upstream unit tests
cd ./source/
PYTHONPATH=$blivet_path python3 tests/run_tests.py