Skip to content

Commit 3d1b4c5

Browse files
committed
Add TMT gating test and workflow for bootupd
Add TMT testing infrastructure including core smoke test with GitHub workflow integration.
1 parent dc7461c commit 3d1b4c5

File tree

5 files changed

+93
-0
lines changed

5 files changed

+93
-0
lines changed

.fmf/version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1

.github/workflows/tmt-tests.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: TMT Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
inputs:
12+
plan_filter:
13+
description: |
14+
Test plan filter name, ie: tag:smoke.
15+
If provided, only tests matching this filter will be run, otherwise all tests will be run.
16+
required: false
17+
default: ''
18+
19+
jobs:
20+
tmt-tests:
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
27+
- name: Install dependencies
28+
run: |
29+
set -x -e -o pipefail
30+
sudo apt-get update
31+
sudo apt-get install -y podman libblkid-dev rsync
32+
pip install --user tmt
33+
34+
- name: Run TMT tests
35+
run: |
36+
set -x -e -o pipefail
37+
if [ "$ACT" = "true" ]; then
38+
echo "Running locally using ACT"
39+
TMT_PROVISION_OPTS="--how local --feeling-safe"
40+
else
41+
TMT_PROVISION_OPTS="--how container"
42+
fi
43+
if [ -n "${{ github.event.inputs.plan_filter }}" ]; then
44+
PLAN_FILTER_PARAM="plan --filter '${{ github.event.inputs.plan_filter }}'"
45+
fi
46+
eval "tmt run --all --debug -vvvv provision $TMT_PROVISION_OPTS $PLAN_FILTER_PARAM"

tests/core/core.fmf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
summary: check bootupd package installation
2+
tag:
3+
- smoke
4+
test: |
5+
set -x -e -o pipefail
6+
rpm -q bootupd

tests/tmt/plans/main.fmf

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# This prepare is used to control when bootupd is installed using
2+
# the distribution package or when it is built from source in the test environment
3+
prepare:
4+
- name: Set BOOTUPD_BIN_DIR when built from source
5+
when: use_built_from_src is defined and use_built_from_src == true
6+
how: shell
7+
script: |
8+
set -x -e -o pipefail
9+
echo "Preparing the test environment"
10+
BOOTUPD_BIN_NAME="bootupd"
11+
PARENT_DIR=$(dirname "${TMT_TREE}")
12+
BOOTUPD_BIN_FULL_PATH=$(find "${PARENT_DIR}" -type f -name "${BOOTUPD_BIN_NAME}")
13+
if [ -z "${BOOTUPD_BIN_FULL_PATH}" ]; then
14+
echo "bootupd file not found."
15+
exit 1
16+
elif [ "$(echo "${BOOTUPD_BIN_FULL_PATH}" | wc -l)" -gt 1 ]; then
17+
echo "error: found multiple 'bootupd' binaries:" >&2
18+
echo "${BOOTUPD_BIN_FULL_PATH}" >&2
19+
exit 1
20+
fi
21+
BOOTUPD_BIN_DIR=$(dirname "${BOOTUPD_BIN_FULL_PATH}")
22+
echo "BOOTUPD_BIN_DIR=${BOOTUPD_BIN_DIR}" > /tmp/bootupd_bin_dir
23+
- name: Install bootupd package
24+
when: use_built_from_src is not defined or use_built_from_src == false
25+
how: install
26+
package: bootupd
27+
- name: Set BOOTUPD_BIN_DIR when installed package
28+
when: use_built_from_src is not defined or use_built_from_src == false
29+
how: shell
30+
script: |
31+
set -x -e -o pipefail
32+
echo "BOOTUPD_BIN_DIR=/usr/libexec" > /tmp/bootupd_bin_dir

tests/tmt/plans/smoke.fmf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
summary: Basic smoke test
2+
tag:
3+
- smoke
4+
discover:
5+
how: fmf
6+
filter: "tag: smoke"
7+
execute:
8+
how: tmt

0 commit comments

Comments
 (0)