From b0cdec58260b4d99e2ac433e27f0223d78f5ad00 Mon Sep 17 00:00:00 2001 From: Yariv Rachmani Date: Wed, 29 Nov 2023 20:06:55 +0200 Subject: [PATCH] Adding tmt tier-0 test Tests are run by packit through tmt in testsing-farm Adding integration plan and tier-0 test verifying initoverlayfs setup Signed-off-by: Yariv Rachmani --- .fmf/version | 1 + .packit.yaml | 20 ++++++++++++ integration/plans/tier-0.fmf | 38 ++++++++++++++++++++++ integration/tests/boot-validation/main.fmf | 5 +++ integration/tests/boot-validation/test.sh | 36 ++++++++++++++++++++ 5 files changed, 100 insertions(+) create mode 100644 .fmf/version create mode 100644 .packit.yaml create mode 100644 integration/plans/tier-0.fmf create mode 100644 integration/tests/boot-validation/main.fmf create mode 100755 integration/tests/boot-validation/test.sh diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/.packit.yaml b/.packit.yaml new file mode 100644 index 0000000..830bcfd --- /dev/null +++ b/.packit.yaml @@ -0,0 +1,20 @@ +--- +# See the documentation for more information: +# https://packit.dev/docs/configuration/ + +specfile_path: rpm/initoverlayfs.spec +upstream_tag_template: v{version} + +srpm_build_deps: + - make + +jobs: + - job: tests + trigger: pull_request + identifier: integration-tiers + tmt_plan: /integration/plans/tier-0 + skip_build: true + targets: + targets: + - centos-stream-9-x86_64 + - fedora-39-x86_64 diff --git a/integration/plans/tier-0.fmf b/integration/plans/tier-0.fmf new file mode 100644 index 0000000..da4f9cf --- /dev/null +++ b/integration/plans/tier-0.fmf @@ -0,0 +1,38 @@ +summary: Tier 0 - initoverlayfs + +discover: + how: fmf + filter: tier:0 + +provision: + how: local + +adjust: + prepare+: + - name: Prepare c9s Repo + how: shell + order: 10 + script: | + dnf install -y epel-release + when: distro == centos-stream-9 + +prepare: + - name: Prepare Repos + how: shell + script: | + dnf copr enable -y @centos-automotive-sig/next + - name: Install rpms + how: install + package: initoverlayfs + + - name: Verify rpm + how: shell + script: | + echo $(rpm -qa | grep -i initoverlayfs) + +execute: + how: tmt + +report: + how: junit + diff --git a/integration/tests/boot-validation/main.fmf b/integration/tests/boot-validation/main.fmf new file mode 100644 index 0000000..434a63c --- /dev/null +++ b/integration/tests/boot-validation/main.fmf @@ -0,0 +1,5 @@ +summary: test verify install is working +test: ./test.sh +tier: 0 +framework: shell + diff --git a/integration/tests/boot-validation/test.sh b/integration/tests/boot-validation/test.sh new file mode 100755 index 0000000..e3760a5 --- /dev/null +++ b/integration/tests/boot-validation/test.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +if [ "${TMT_REBOOT_COUNT}" == "1" ];then + echo -n "machine is up" + exit 0 + #echo -n "Verifying initoverlayfs in /boot" +fi + +RPM_EXIST=$(rpm -qa | grep -i initoverlayfs) + +if [ -z "${RPM_EXIST}" ]; then + echo -n "initoverlayfs rpm is missing" + exit 127 +fi + +echo -n "Install initoverlayfs" +/usr/bin/initoverlayfs-install + +exit_code="$?" + +if [ "$exit_code" != "0" ]; then + echo -n "initoverlayfs-install completeted with $exit_code" + exit "$exit_code" +fi + +echo -n "Verifying initoverlayfs in /boot" +du -sh /boot/init* | grep initoverlayfs + +exit_code="$?" +if [ "$exit_code" != "0" ]; then + echo -n "initoverlayfs not found under /boot please check runnin machine" + exit "$exit_code" +fi + +/usr/local/bin/tmt-reboot +