From f5c93b963ed64cd31f24820bdf71e1e7e751486d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Zaroda?= Date: Sun, 21 Jan 2024 21:18:53 +0100 Subject: [PATCH] Added option to filter functional tests when running them from the "make" command. --- Makefile | 5 ++++- tests/bin/functional-tests.sh | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 942ea62..588bbf1 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,9 @@ ifndef VERSION override VERSION = local-build endif +# Filter functional tests. Set this variable to regex matching the names of tests you want to run. +FFILTER = + ROOT = $(shell pwd -P) CORE_PATH = ${ROOT}/core @@ -71,7 +74,7 @@ test-functional: exit 1; \ fi; \ done - docker exec -t ${TEST_CONTAINER_NAME} /bin/bash -c "DRAKY_SOURCE_PATH=${TEST_CONTAINER_DRAKY_SOURCE_PATH} ${TEST_CONTAINER_DRAKY_SOURCE_PATH}/tests/bin/functional-tests.sh" + docker exec -t ${TEST_CONTAINER_NAME} /bin/bash -c "TEST_FILTER='${FFILTER}' DRAKY_SOURCE_PATH=${TEST_CONTAINER_DRAKY_SOURCE_PATH} ${TEST_CONTAINER_DRAKY_SOURCE_PATH}/tests/bin/functional-tests.sh" test-lint: docker run \ diff --git a/tests/bin/functional-tests.sh b/tests/bin/functional-tests.sh index ae2c2d3..0373454 100755 --- a/tests/bin/functional-tests.sh +++ b/tests/bin/functional-tests.sh @@ -12,4 +12,10 @@ DRAKY_TEST_IMAGE_PATH=$(find "${DRAKY_SOURCE_PATH}" -name '*.image.tar') docker load --input "${DRAKY_TEST_IMAGE_PATH}" cd "$CWD/../functional" || exit 1 -bats . + +ARGS=() +if [ -n "${TEST_FILTER}" ]; then + ARGS=(-f "${TEST_FILTER}") +fi + +bats "${ARGS[@]}" .