From c9924b42f597dc79858db39b6e5391c737c69e02 Mon Sep 17 00:00:00 2001 From: Ramon Quitales Date: Mon, 11 Mar 2024 23:43:35 -0700 Subject: [PATCH] tests: always return a kubeconfig even if we do not create a cluster --- tests/clusters/create.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/clusters/create.go b/tests/clusters/create.go index f23566fee8..111121e16a 100644 --- a/tests/clusters/create.go +++ b/tests/clusters/create.go @@ -99,7 +99,12 @@ func (t *TestClusters) pickCluster() Cluster { // required for the kubectl command to target the right cluster that the test is running on. func (t *TestClusters) WrapProviderTestOptions(opts integration.ProgramTestOptions) (integration.ProgramTestOptions, string) { if t.clusters == nil { - return opts, "" + // Check if KUBECONFIG is set, if it is then use that for the tests. + kcfg := os.Getenv("KUBECONFIG") + if kcfg == "" { + kcfg = os.ExpandEnv("$HOME/.kube/config") + } + return opts, kcfg } cluster := t.pickCluster()