Skip to content

Commit 9a97f00

Browse files
committed
Makefile: add bats target, recursive make for now
Signed-off-by: Dr. Jan-Philip Gehrcke <[email protected]>
1 parent f7394c6 commit 9a97f00

File tree

1 file changed

+3
-49
lines changed

1 file changed

+3
-49
lines changed

Makefile

Lines changed: 3 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -221,53 +221,7 @@ PHONY: .shell
221221
--user $$(id -u):$$(id -g) \
222222
$(BUILDIMAGE)
223223

224-
BATS_IMAGE = batstests:$(GIT_COMMIT_SHORT)
224+
.PHONY: bats
225+
bats:
226+
make -f tests/bats/Makefile bats-tests
225227

226-
.PHONY: bats-image
227-
bats-image:
228-
docker buildx build . -t $(BATS_IMAGE) -f ci-tests.Dockerfile
229-
230-
TEST_CHART_REPO ?= "oci://ghcr.io/nvidia/k8s-dra-driver-gpu"
231-
TEST_CHART_VERSION ?= $(VERSION_GHCR_CHART)
232-
TEST_CHART_LASTSTABLE_REPO ?= "oci://ghcr.io/nvidia/k8s-dra-driver-gpu"
233-
TEST_CHART_LASTSTABLE_VERSION ?= "25.3.2-7020737a-chart"
234-
235-
# Currently consumed in upgrade test via
236-
# kubectl apply -f <URL> (can be a branch, tag, or commit)
237-
TEST_CRD_UPGRADE_TARGET_GIT_REF ?= $(GIT_COMMIT_SHORT)
238-
239-
# Warning: destructive against currently configured k8s cluster.
240-
#
241-
# Explicit invocation of 'cleanup-from-previous-run.sh' (could also be done as
242-
# suite/file 'setup' in bats, but we'd lose output on success). During dev, you
243-
# may want to add --show-output-of-passing-tests (and read bats docs for other
244-
# cmdline args).
245-
.PHONY: bats-tests
246-
bats-tests: bats-image
247-
mkdir -p tests-out
248-
export _RUNDIR=$(shell mktemp -p tests-out -d -t bats-tests-$$(date +%s)-XXXXX) && \
249-
echo "output directory: $${_RUNDIR}" && \
250-
time docker run \
251-
-it \
252-
-v /tmp:/tmp \
253-
-v $(shell pwd):/cwd \
254-
-v ~/.kube/config:/kubeconfig \
255-
--env KUBECONFIG=/kubeconfig \
256-
--env TEST_CHART_REPO=$(TEST_CHART_REPO) \
257-
--env TEST_CHART_VERSION=$(TEST_CHART_VERSION) \
258-
--env TEST_CHART_LASTSTABLE_REPO=$(TEST_CHART_LASTSTABLE_REPO) \
259-
--env TEST_CHART_LASTSTABLE_VERSION=$(TEST_CHART_LASTSTABLE_VERSION) \
260-
--env TEST_CRD_UPGRADE_TARGET_GIT_REF=$(TEST_CRD_UPGRADE_TARGET_GIT_REF) \
261-
-u $(shell id -u ${USER}):$(shell id -g ${USER}) \
262-
--entrypoint "/bin/bash"\
263-
$(BATS_IMAGE) \
264-
-c "cd /cwd; \
265-
echo 'Running k8s cluster cleanup (invasive)... '; \
266-
bash tests/cleanup-from-previous-run.sh &> $${_RUNDIR}/cleanup.outerr || \
267-
(echo 'Cleanup failed:'; cat $${_RUNDIR}/cleanup.outerr); \
268-
TMPDIR=/cwd/$${_RUNDIR} bats \
269-
--print-output-on-failure \
270-
--no-tempdir-cleanup \
271-
--timing \
272-
tests/tests.bats \
273-
"

0 commit comments

Comments
 (0)