Rework how are unit test run
Running unit tests from sources was failing with: ./tmt-test-wrapper.sh-default-0-default-0: line 1: cd: too many arguments Copy over the approach from osbuild repository. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
parent
dd02361615
commit
f30bda80fa
@ -2,5 +2,6 @@ summary: Run unit tests from source
|
|||||||
discover:
|
discover:
|
||||||
how: fmf
|
how: fmf
|
||||||
dist-git-source: true
|
dist-git-source: true
|
||||||
|
filter: tag:unit-test
|
||||||
execute:
|
execute:
|
||||||
how: tmt
|
how: tmt
|
||||||
|
4
tests/unit-tests/main.fmf
Normal file
4
tests/unit-tests/main.fmf
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
summary: Run osbuild-composer unit tests from dist-git sources
|
||||||
|
tag: unit-test
|
||||||
|
duration: 1h
|
||||||
|
test: ./run-unit-tests.sh
|
24
tests/unit-tests/run-unit-tests.sh
Executable file
24
tests/unit-tests/run-unit-tests.sh
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/bash
|
||||||
|
|
||||||
|
set -euxo pipefail
|
||||||
|
|
||||||
|
source /etc/os-release
|
||||||
|
|
||||||
|
# Move to the checked out git repo with the test plans
|
||||||
|
# this should be the root of the dist-git repo
|
||||||
|
cd "${TMT_TREE}"
|
||||||
|
|
||||||
|
# install all test dependencies
|
||||||
|
sudo dnf install -y rpmdevtools
|
||||||
|
sudo dnf builddep -y osbuild-composer.spec
|
||||||
|
|
||||||
|
# Move to the directory with sources
|
||||||
|
cd "${TMT_SOURCE_DIR}"
|
||||||
|
|
||||||
|
# Extract the Source0 basename without extension
|
||||||
|
SRC_DIR=$(spectool --source 0 osbuild-composer.spec | sed 's/.\+\(osbuild-composer-[0-9]\+\)\.tar\.gz/\1/')
|
||||||
|
|
||||||
|
# Move to the extracted sources directory (patches are applied by default)
|
||||||
|
cd "${SRC_DIR}"
|
||||||
|
|
||||||
|
GOFLAGS="-mod=vendor -tags=exclude_graphdriver_btrfs" go test ./...
|
@ -1,5 +0,0 @@
|
|||||||
summary: Run unit tests
|
|
||||||
require:
|
|
||||||
- golang
|
|
||||||
test: cd ../osbuild-composer-*/ && sudo dnf builddep -y osbuild-composer.spec && GOFLAGS="-mod=vendor -tags=exclude_graphdriver_btrfs" go test ./...
|
|
||||||
duration: 1h
|
|
Loading…
Reference in New Issue
Block a user