From 3d1b4c5ccd72806ce94fc59177bcd60ca4f34658 Mon Sep 17 00:00:00 2001 From: Aashish Radhakrishnan Date: Thu, 10 Jul 2025 17:20:24 -0400 Subject: [PATCH 1/5] Add TMT gating test and workflow for bootupd Add TMT testing infrastructure including core smoke test with GitHub workflow integration. --- .fmf/version | 1 + .github/workflows/tmt-tests.yml | 46 +++++++++++++++++++++++++++++++++ tests/core/core.fmf | 6 +++++ tests/tmt/plans/main.fmf | 32 +++++++++++++++++++++++ tests/tmt/plans/smoke.fmf | 8 ++++++ 5 files changed, 93 insertions(+) create mode 100644 .fmf/version create mode 100644 .github/workflows/tmt-tests.yml create mode 100644 tests/core/core.fmf create mode 100644 tests/tmt/plans/main.fmf create mode 100644 tests/tmt/plans/smoke.fmf diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/.github/workflows/tmt-tests.yml b/.github/workflows/tmt-tests.yml new file mode 100644 index 00000000..7289de0c --- /dev/null +++ b/.github/workflows/tmt-tests.yml @@ -0,0 +1,46 @@ +name: TMT Tests + +on: + push: + branches: + - main + pull_request: + branches: + - main + workflow_dispatch: + inputs: + plan_filter: + description: | + Test plan filter name, ie: tag:smoke. + If provided, only tests matching this filter will be run, otherwise all tests will be run. + required: false + default: '' + +jobs: + tmt-tests: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install dependencies + run: | + set -x -e -o pipefail + sudo apt-get update + sudo apt-get install -y podman libblkid-dev rsync + pip install --user tmt + + - name: Run TMT tests + run: | + set -x -e -o pipefail + if [ "$ACT" = "true" ]; then + echo "Running locally using ACT" + TMT_PROVISION_OPTS="--how local --feeling-safe" + else + TMT_PROVISION_OPTS="--how container" + fi + if [ -n "${{ github.event.inputs.plan_filter }}" ]; then + PLAN_FILTER_PARAM="plan --filter '${{ github.event.inputs.plan_filter }}'" + fi + eval "tmt run --all --debug -vvvv provision $TMT_PROVISION_OPTS $PLAN_FILTER_PARAM" diff --git a/tests/core/core.fmf b/tests/core/core.fmf new file mode 100644 index 00000000..0aef8bfc --- /dev/null +++ b/tests/core/core.fmf @@ -0,0 +1,6 @@ +summary: check bootupd package installation +tag: + - smoke +test: | + set -x -e -o pipefail + rpm -q bootupd diff --git a/tests/tmt/plans/main.fmf b/tests/tmt/plans/main.fmf new file mode 100644 index 00000000..4582ae2b --- /dev/null +++ b/tests/tmt/plans/main.fmf @@ -0,0 +1,32 @@ +# This prepare is used to control when bootupd is installed using +# the distribution package or when it is built from source in the test environment +prepare: + - name: Set BOOTUPD_BIN_DIR when built from source + when: use_built_from_src is defined and use_built_from_src == true + how: shell + script: | + set -x -e -o pipefail + echo "Preparing the test environment" + BOOTUPD_BIN_NAME="bootupd" + PARENT_DIR=$(dirname "${TMT_TREE}") + BOOTUPD_BIN_FULL_PATH=$(find "${PARENT_DIR}" -type f -name "${BOOTUPD_BIN_NAME}") + if [ -z "${BOOTUPD_BIN_FULL_PATH}" ]; then + echo "bootupd file not found." + exit 1 + elif [ "$(echo "${BOOTUPD_BIN_FULL_PATH}" | wc -l)" -gt 1 ]; then + echo "error: found multiple 'bootupd' binaries:" >&2 + echo "${BOOTUPD_BIN_FULL_PATH}" >&2 + exit 1 + fi + BOOTUPD_BIN_DIR=$(dirname "${BOOTUPD_BIN_FULL_PATH}") + echo "BOOTUPD_BIN_DIR=${BOOTUPD_BIN_DIR}" > /tmp/bootupd_bin_dir + - name: Install bootupd package + when: use_built_from_src is not defined or use_built_from_src == false + how: install + package: bootupd + - name: Set BOOTUPD_BIN_DIR when installed package + when: use_built_from_src is not defined or use_built_from_src == false + how: shell + script: | + set -x -e -o pipefail + echo "BOOTUPD_BIN_DIR=/usr/libexec" > /tmp/bootupd_bin_dir diff --git a/tests/tmt/plans/smoke.fmf b/tests/tmt/plans/smoke.fmf new file mode 100644 index 00000000..d86f03fd --- /dev/null +++ b/tests/tmt/plans/smoke.fmf @@ -0,0 +1,8 @@ +summary: Basic smoke test +tag: + - smoke +discover: + how: fmf + filter: "tag: smoke" +execute: + how: tmt From b18b56b22d39a2d521b0b3d9394afe157bbb5c6d Mon Sep 17 00:00:00 2001 From: Aashish Radhakrishnan Date: Wed, 30 Jul 2025 14:57:20 -0400 Subject: [PATCH 2/5] Add new test to bootupd --- .github/workflows/tmt-tests.yml | 4 ++++ gating.yaml | 7 +++++++ tests/core/core.fmf | 30 ++++++++++++++++++++++++++++-- 3 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 gating.yaml diff --git a/.github/workflows/tmt-tests.yml b/.github/workflows/tmt-tests.yml index 7289de0c..d3a4b620 100644 --- a/.github/workflows/tmt-tests.yml +++ b/.github/workflows/tmt-tests.yml @@ -15,6 +15,10 @@ on: If provided, only tests matching this filter will be run, otherwise all tests will be run. required: false default: '' + use_built_from_src: + description: 'Built bootupd from source instead of install distro package' + required: false + default: 'true' jobs: tmt-tests: diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 00000000..4efd7b31 --- /dev/null +++ b/gating.yaml @@ -0,0 +1,7 @@ +--- !Policy +product_versions: + - rhel-10 +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.gating} \ No newline at end of file diff --git a/tests/core/core.fmf b/tests/core/core.fmf index 0aef8bfc..93441811 100644 --- a/tests/core/core.fmf +++ b/tests/core/core.fmf @@ -1,6 +1,32 @@ -summary: check bootupd package installation +summary: check bootupd package installation and basic functionality tag: - smoke test: | set -x -e -o pipefail - rpm -q bootupd + + # Check if bootupctl is available + if ! command -v bootupctl &> /dev/null; then + echo "bootupctl command not found" + exit 1 + fi + + # Get architecture + arch="$(uname --machine)" + + # Run bootupctl status and check output + output=$(bootupctl status | tr -d '\r') + + if [[ "${arch}" == "x86_64" ]]; then + expected_components='Available components: BIOS EFI' + else + # Assume aarch64 for now + expected_components='Available components: EFI' + fi + + if [ "${expected_components}" != "${output}" ]; then + echo "Expected: ${expected_components}" + echo "Got: ${output}" + exit 1 + fi + + echo "bootupd package and bootupctl status test passed" From 22353d02f3bb03ee5bc5acd4eb3d9bb31cba671e Mon Sep 17 00:00:00 2001 From: Aashish Radhakrishnan Date: Wed, 30 Jul 2025 15:00:55 -0400 Subject: [PATCH 3/5] Correct indentation --- tests/core/core.fmf | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/core/core.fmf b/tests/core/core.fmf index 93441811..7198a3d1 100644 --- a/tests/core/core.fmf +++ b/tests/core/core.fmf @@ -3,30 +3,30 @@ tag: - smoke test: | set -x -e -o pipefail - - # Check if bootupctl is available + + # Check if bootupctl is available if ! command -v bootupctl &> /dev/null; then echo "bootupctl command not found" exit 1 fi - + # Get architecture arch="$(uname --machine)" - + # Run bootupctl status and check output output=$(bootupctl status | tr -d '\r') - + if [[ "${arch}" == "x86_64" ]]; then expected_components='Available components: BIOS EFI' else - # Assume aarch64 for now + # Assume aarch64 for now expected_components='Available components: EFI' fi - + if [ "${expected_components}" != "${output}" ]; then echo "Expected: ${expected_components}" echo "Got: ${output}" exit 1 fi - + echo "bootupd package and bootupctl status test passed" From 499d39a7991016b9e71f4e5e8588ffec80839bdd Mon Sep 17 00:00:00 2001 From: Aashish Radhakrishnan Date: Wed, 30 Jul 2025 15:03:49 -0400 Subject: [PATCH 4/5] Add new line at end of gating.yaml --- gating.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gating.yaml b/gating.yaml index 4efd7b31..88e23c2a 100644 --- a/gating.yaml +++ b/gating.yaml @@ -4,4 +4,4 @@ product_versions: decision_context: osci_compose_gate rules: - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} - - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.gating} \ No newline at end of file + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.gating} From 0760dcb8c917cd721f6f97943d21463f0392b599 Mon Sep 17 00:00:00 2001 From: Aashish Radhakrishnan Date: Wed, 30 Jul 2025 15:22:48 -0400 Subject: [PATCH 5/5] Remove gating.yaml --- gating.yaml | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 gating.yaml diff --git a/gating.yaml b/gating.yaml deleted file mode 100644 index 88e23c2a..00000000 --- a/gating.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- !Policy -product_versions: - - rhel-10 -decision_context: osci_compose_gate -rules: - - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} - - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.gating}