Skip to content

Commit f43c501

Browse files
authored
test(e2e): fix picking default kubeconfig accidentially (#117)
1 parent ebd8498 commit f43c501

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ test-e2e-controller: manifests generate update-test-crds fmt vet ## Run the e2e
121121
}
122122
go test ./test/e2e/ -v -ginkgo.v
123123

124+
E2E_KUBECONFIG ?= ""
124125
E2E_METAL_API_URL ?= "$(METALCTL_API_URL)"
125126
E2E_METAL_API_HMAC ?= "$(METALCTL_HMAC)"
126127
E2E_METAL_API_HMAC_AUTH_TYPE ?= "$(or $(METALCTL_HMAC_AUTH_TYPE),Metal-Admin)"
@@ -149,7 +150,8 @@ test-e2e: manifests generate fmt vet ginkgo kustomize
149150
$(KUSTOMIZE) build $(E2E_TEMPLATES)/upgrade --load-restrictor LoadRestrictionsNone > $(E2E_TEMPLATES)/cluster-template-upgrade.yaml
150151
$(KUSTOMIZE) build $(E2E_TEMPLATES)/upgrade-workerless --load-restrictor LoadRestrictionsNone > $(E2E_TEMPLATES)/cluster-template-upgrade-workerless.yaml
151152

152-
@METAL_API_URL=$(E2E_METAL_API_URL) \
153+
@KUBECONFIG=$(E2E_KUBECONFIG) \
154+
METAL_API_URL=$(E2E_METAL_API_URL) \
153155
METAL_API_HMAC=$(E2E_METAL_API_HMAC) \
154156
METAL_API_HMAC_AUTH_TYPE=$(E2E_METAL_API_HMAC_AUTH_TYPE) \
155157
METAL_PROJECT_ID=$(E2E_METAL_PROJECT_ID) \

test/e2e/frmwrk/shared_cluster.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ func (e2e *E2ECluster) GenerateAndApplyClusterTemplate(ctx context.Context) {
318318
Flavor: e2e.E2EContext.Environment.Flavor,
319319
LogFolder: path.Join(e2e.E2EContext.Environment.artifactsPath, "clusters", e2e.ClusterName),
320320
ClusterctlVariables: e2e.Variables(),
321+
KubeconfigPath: e2e.E2EContext.Environment.Bootstrap.GetKubeconfigPath(),
321322
})
322323

323324
By("Apply cluster template")

test/e2e/frmwrk/shared_context.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func (e2e *E2EContext) envOrVar(name string) string {
6666

6767
func withDefaultEnvironment() Option {
6868
return func(e2e *E2EContext) {
69-
e2e.Environment.kubeconfigPath = os.Getenv("E2E_KUBECONFIG")
69+
e2e.Environment.kubeconfigPath = os.Getenv("KUBECONFIG")
7070

7171
if p, ok := os.LookupEnv("ARTIFACTS"); ok {
7272
e2e.Environment.artifactsPath = p
@@ -166,8 +166,8 @@ func (ee *E2EContext) ProvideBootstrapCluster() {
166166
}
167167

168168
func (ee *E2EContext) provideExistingBootstrapClusterKubeconfig() string {
169-
Expect(ee.Environment.kubeconfigPath).ToNot(BeEmpty(), "E2E_KUBECONFIG must be set to use an existing bootstrap cluster")
170-
Expect(ee.Environment.kubeconfigPath).To(BeAnExistingFile(), "E2E_KUBECONFIG must point to an existing file")
169+
Expect(ee.Environment.kubeconfigPath).ToNot(BeEmpty(), "KUBECONFIG must be set to use an existing bootstrap cluster")
170+
Expect(ee.Environment.kubeconfigPath).To(BeAnExistingFile(), "KUBECONFIG must point to an existing file")
171171
return ee.Environment.kubeconfigPath
172172
}
173173

0 commit comments

Comments
 (0)