From 811319730b42469970bb280444e7e9fea5ce8be7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hozza?= Date: Tue, 28 Mar 2023 10:47:33 +0200 Subject: [PATCH] Bootstrap CI tests from internal RHEL dist-git branch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves: rhbz#2174845 Signed-off-by: Tomáš Hozza --- .fmf/version | 1 + plans/integration-tests.fmf | 8 ++++++++ plans/unit-tests.fmf | 6 ++++++ tests/scripts/run_tests.sh | 19 +++++++++++++++++++ tests/unit.fmf | 5 +++++ 5 files changed, 39 insertions(+) create mode 100644 .fmf/version create mode 100644 plans/integration-tests.fmf create mode 100644 plans/unit-tests.fmf create mode 100755 tests/scripts/run_tests.sh create mode 100644 tests/unit.fmf 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/plans/integration-tests.fmf b/plans/integration-tests.fmf new file mode 100644 index 0000000..47416b5 --- /dev/null +++ b/plans/integration-tests.fmf @@ -0,0 +1,8 @@ +summary: Run integration tests +prepare: + how: install + package: + - osbuild-composer-tests +execute: + script: ./tests/scripts/run_tests.sh ./tests/ + duration: 24h diff --git a/plans/unit-tests.fmf b/plans/unit-tests.fmf new file mode 100644 index 0000000..7fc52d4 --- /dev/null +++ b/plans/unit-tests.fmf @@ -0,0 +1,6 @@ +summary: Run unit tests from source +discover: + how: fmf + dist-git-source: true +execute: + how: tmt diff --git a/tests/scripts/run_tests.sh b/tests/scripts/run_tests.sh new file mode 100755 index 0000000..3ee1018 --- /dev/null +++ b/tests/scripts/run_tests.sh @@ -0,0 +1,19 @@ +#!/bin/bash +set -euxo pipefail + +TOPDIR=$1 + +# Print some information about the machine +df -h +free -h +rpm -qa +find /etc/yum.repos.d -type f -print -exec cat {} \; + +# Run only basic smoke tests. +# Our test-suite is currently very thorough and it builds a lot of images. +# On some runs, TFT was able to build one image for 25 minutes. Our test +# suite builds more than 25 images which means that the full test-suite +# can run for more than 10 hours. That's just too slow and since we are also +# able to run downstream tests on our much faster upstream infrastructure. +# I think that it's enough to do just smoke tests here. +/usr/libexec/tests/osbuild-composer/base_tests.sh || cat /var/lib/osbuild-composer/jobs/* diff --git a/tests/unit.fmf b/tests/unit.fmf new file mode 100644 index 0000000..8181435 --- /dev/null +++ b/tests/unit.fmf @@ -0,0 +1,5 @@ +summary: Run unit tests +require: + - golang +test: cd ../osbuild-composer-*/ && sudo dnf builddep -y osbuild-composer.spec && GOFLAGS=-mod=vendor go test ./... +duration: 1h