Skip to content

Commit 2236702

Browse files
authored
Merge pull request #597 from jgehrcke/jp/make-bats-working-in-more-envs
tests: inject KUBECONFIG, tweak gitignore, fix mkdir
2 parents 124734f + 17287a8 commit 2236702

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
.idea
77
[._]*.sw[a-p]
88
coverage.out
9+
tests-out

tests/bats/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ include $(CURDIR)/common.mk
1818

1919
BATS_IMAGE = batstests:$(GIT_COMMIT_SHORT)
2020

21+
KUBECONFIG ?= $(HOME)/.kube/config
2122
TEST_CHART_REPO ?= "oci://ghcr.io/nvidia/k8s-dra-driver-gpu"
2223
TEST_CHART_VERSION ?= $(VERSION_GHCR_CHART)
2324
TEST_CHART_LASTSTABLE_REPO ?= "oci://ghcr.io/nvidia/k8s-dra-driver-gpu"
@@ -42,15 +43,14 @@ image:
4243
# cmdline args).
4344
.PHONY: tests
4445
tests: image
45-
mkdir -p tests-out
46+
mkdir -p tests-out && \
4647
export _RUNDIR=$(shell mktemp -p tests-out -d -t bats-tests-$$(date +%s)-XXXXX) && \
47-
echo "output directory: $${_RUNDIR}" && \
4848
time docker run \
4949
-it \
5050
-v /tmp:/tmp \
5151
-v $(CURDIR):/cwd \
52-
-v ~/.kube/config:/kubeconfig \
53-
--env KUBECONFIG=/kubeconfig \
52+
-v $(HOME)/.kube/:$(HOME)/.kube \
53+
--env KUBECONFIG=$(KUBECONFIG) \
5454
--env TEST_CHART_REPO=$(TEST_CHART_REPO) \
5555
--env TEST_CHART_VERSION=$(TEST_CHART_VERSION) \
5656
--env TEST_CHART_LASTSTABLE_REPO=$(TEST_CHART_LASTSTABLE_REPO) \

0 commit comments

Comments
 (0)