From 07b376e02fd66b2d612ff48bb0f28977096ab4f5 Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Mon, 17 Jan 2022 16:52:28 +0000 Subject: [PATCH] test: run-test.sh now works inside a container The `run-test.sh` helper is meant to execute the tests as if it was CI but using a container. If it is detected that we are already running inside a container assume it is prepare so that we can exectue the tests directly and do so. --- run-tests.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/run-tests.sh b/run-tests.sh index a25f781..cbc5f0b 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -4,12 +4,21 @@ set -euo pipefail SHELLCHECK_SEVERITY=${SHELLCHECK_SEVERITY:-warning} run_test() { + if [ -f /.dockerenv ]; then + eval "$1" + return + fi + podman run --rm -it -v "$(pwd)":/github/workspace:z --env "GITHUB_WORKSPACE=/github/workspace" koji.test "$1" } -pushd test -podman build -t koji.test -f Dockerfile . -popd +if [ ! -f /.dockerenv ]; then + pushd test + podman build -t koji.test -f Dockerfile . + popd +else + echo "Container detected, direct mode." +fi SCRIPTS="$(git ls-files --exclude='*.sh' --ignored | xargs echo)"