tests: Move to tmt tests and expand the functional tests

This moves to using the same tests that we use on c10s, and switches to
the tmt framework for testing.

Resolves: RHEL-82287
This commit is contained in:
Brian C. Lane 2024-07-31 13:31:49 -07:00
parent c7a6229e8a
commit e22f801b0b
6 changed files with 38 additions and 26 deletions

8
plans/test-parted.fmf Normal file
View File

@ -0,0 +1,8 @@
summary: Run a basic parted test
prepare:
how: install
package:
- parted
- jq
execute:
script: ./tests/scripts/run_tests.sh

View File

@ -1,5 +0,0 @@
---
standard-inventory-qcow2:
qemu:
m: 4G

30
tests/scripts/run_tests.sh Executable file
View File

@ -0,0 +1,30 @@
#!/usr/bin/bash
set -eux
DISK=/var/tmp/parted-disk.img
# Make a temporary disk image to use for tests
fallocate -l 100MiB $DISK
# Make a disklabel and a couple of partitions
parted -s $DISK mklabel gpt
parted -s $DISK mkpart vfat 1MiB 10MiB
parted -s $DISK mkpart ext4 10MiB 50MiB
parted -s $DISK mkpart ext4 50MiB 75MiB
parted -s $DISK set 1 boot
parted -s $DISK set 3 linux-home
# Check p1 for ESP UUID c12a7328-f81f-11d2-ba4b-00a0c93ec93b
P1_TYPE=$(parted -s $DISK --json u MiB p | jq -r '.disk.partitions[0]."type-uuid"')
[ "$P1_TYPE" == "c12a7328-f81f-11d2-ba4b-00a0c93ec93b" ] || exit 1
# Check p2 for linux data type 0fc63daf-8483-4772-8e79-3d69d8477de4
P2_TYPE=$(parted -s $DISK --json u MiB p | jq -r '.disk.partitions[1]."type-uuid"')
[ "$P2_TYPE" == "0fc63daf-8483-4772-8e79-3d69d8477de4" ] || exit 1
# Check p3 for linux home type 933ac7e1-2eb4-4f13-b844-0e14e2aef915
P3_TYPE=$(parted -s $DISK --json u MiB p | jq -r '.disk.partitions[2]."type-uuid"')
[ "$P3_TYPE" == "933ac7e1-2eb4-4f13-b844-0e14e2aef915" ] || exit 1
echo "PASS"
exit 0

View File

@ -1,8 +0,0 @@
#!/bin/sh
set -eux
# make a small disk image
fallocate -l 100M ./disk.img
parted -s ./disk.img mklabel gpt
parted -s ./disk.img 'mkpart root 1MiB 100%'
parted -m -s ./disk.img u s p

View File

@ -1,13 +0,0 @@
---
# Run a simple parted test
- hosts: localhost
roles:
- role: standard-test-basic
tags:
- classic
required_packages:
- parted
tests:
- simple:
run: ./run_tests.sh