tests: Move to tmt tests and switch to a functional test
Instead of repeating the build unit testing, this tests the installed parted with a simple disk image partitioning scheme to verify basic functionality. Resolves: RHEL-50915
This commit is contained in:
parent
c6d44484e4
commit
6a06241fc0
8
plans/test-parted.fmf
Normal file
8
plans/test-parted.fmf
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
summary: Run a basic parted test
|
||||||
|
prepare:
|
||||||
|
how: install
|
||||||
|
package:
|
||||||
|
- parted
|
||||||
|
- jq
|
||||||
|
execute:
|
||||||
|
script: ./tests/scripts/run_tests.sh
|
@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
standard-inventory-qcow2:
|
|
||||||
qemu:
|
|
||||||
m: 4G
|
|
30
tests/scripts/run_tests.sh
Executable file
30
tests/scripts/run_tests.sh
Executable 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
|
@ -1,29 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
set -eux
|
|
||||||
|
|
||||||
: ${1?"Usage: $0 TESTSDIR"}
|
|
||||||
|
|
||||||
TESTSDIR="$1"
|
|
||||||
SOURCEDIR="${TESTSDIR}/source/"
|
|
||||||
PACKAGE=parted
|
|
||||||
|
|
||||||
cd "${TESTSDIR}"
|
|
||||||
if [ ! -e ${PACKAGE}.spec ]; then
|
|
||||||
echo "Missing ${PACKAGE}.spec"
|
|
||||||
pwd
|
|
||||||
ls
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# This runs from the ./tests/ directory
|
|
||||||
# Install the dependencies from the spec which MUST be copied over by tests.yml
|
|
||||||
dnf -y build-dep ${PACKAGE}.spec
|
|
||||||
|
|
||||||
# Flattened sources from standard-role-sources
|
|
||||||
cd "${SOURCEDIR}" || exit
|
|
||||||
|
|
||||||
# Rebuild the package in place, also runs the %check
|
|
||||||
# skip %prep, it was already run on the source before it was copied over
|
|
||||||
rpmbuild --noprep --nodeps -bb --build-in-place "${TESTSDIR}/${PACKAGE}.spec"
|
|
||||||
RET=$?
|
|
||||||
exit ${RET}
|
|
@ -1,14 +0,0 @@
|
|||||||
---
|
|
||||||
- hosts: localhost
|
|
||||||
tags:
|
|
||||||
- classic
|
|
||||||
roles:
|
|
||||||
- role: standard-test-source
|
|
||||||
required_packages:
|
|
||||||
- dnf
|
|
||||||
- rpm-build
|
|
||||||
- git
|
|
||||||
- role: standard-test-basic
|
|
||||||
tests:
|
|
||||||
- simple:
|
|
||||||
run: "./run_tests.sh {{ tenv_workdir }}"
|
|
Loading…
Reference in New Issue
Block a user