From 8f02cd65c3751c994a48c4f9bfd308fe9b445385 Mon Sep 17 00:00:00 2001 From: Sergiy Kulanov Date: Thu, 12 Oct 2023 19:03:15 +0300 Subject: [PATCH] test: Add fake kubeconfig Signed-off-by: Sergiy Kulanov --- Makefile | 3 ++- hack/kubeconfig-stub.yaml | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 hack/kubeconfig-stub.yaml diff --git a/Makefile b/Makefile index c27c150..577fb37 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ GOTEST=$(GOCMD) test GOLINT=golangci-lint run GOFMT=$(GOCMD) fmt GOVET=$(GOCMD) vet +CURRENT_DIR=$(shell pwd) # Binary name BINARY_NAME=tkn-graph @@ -24,7 +25,7 @@ build: ## build the binary # Test targets .PHONY: test test: ## run tests - $(GOTEST) -v -coverprofile=coverage.out ./... + KUBECONFIG=${CURRENT_DIR}/hack/kubeconfig-stub.yaml $(GOTEST) -v -coverprofile=coverage.out ./... # Lint targets .PHONY: lint diff --git a/hack/kubeconfig-stub.yaml b/hack/kubeconfig-stub.yaml new file mode 100644 index 0000000..2afbc57 --- /dev/null +++ b/hack/kubeconfig-stub.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Config +clusters: + - cluster: + server: https://1.2.3.4 + name: mock +contexts: + - context: + cluster: mock + namespace: default + name: mock-ctx +current-context: mock-ctx