From 4e82675b94c6b0a2ebf30cd898c2641340cd9864 Mon Sep 17 00:00:00 2001 From: Sergiy Kulanov Date: Wed, 8 Dec 2021 08:50:35 +0200 Subject: [PATCH] [EPMDEDP-7391]: test: Add fake kubeconfig to fix unit tests Some tests require kubeconfig to be defined Signed-off-by: Sergiy Kulanov Change-Id: I05b8e212c55cb75a87cd60156aa315b78206fa48 --- Makefile | 2 +- hack/kubecfg-stub.yaml | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 hack/kubecfg-stub.yaml diff --git a/Makefile b/Makefile index e21d2ab..e97fabd 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ help: ## Display this help # Run tests test: fmt vet - go test ./... -coverprofile=coverage.out `go list ./...` + KUBECONFIG=${CURRENT_DIR}/hack/kubecfg-stub.yaml go test ./... -coverprofile=coverage.out `go list ./...` fmt: ## Run go fmt go fmt ./... diff --git a/hack/kubecfg-stub.yaml b/hack/kubecfg-stub.yaml new file mode 100644 index 0000000..43a2679 --- /dev/null +++ b/hack/kubecfg-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