Copy the "tests" directory from CS9

The directory was not imported when creating the C8S branch.

Related: rhbz#2142550
This commit is contained in:
Vojtech Trefny 2023-05-17 08:52:11 +02:00
parent 8b863a9b50
commit 884f44b1c2
5 changed files with 85 additions and 0 deletions

1
tests/.fmf/version Normal file
View File

@ -0,0 +1 @@
1

42
tests/lvm_factory.py Normal file
View File

@ -0,0 +1,42 @@
#!/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()

8
tests/provision.fmf Normal file
View File

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

23
tests/tests.yml Normal file
View File

@ -0,0 +1,23 @@
---
# - 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
tests:
- unit-tests:
dir: .
run: ./unit_testing.sh

11
tests/unit_testing.sh Normal file
View File

@ -0,0 +1,11 @@
#!/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