Skip to content

Commit 1d89427

Browse files
authored
Merge pull request #4883 from camilamacedo86/fix-e2e-cleanup
🐛 fix go/v4 e2e tests: skip kind node creation if it exist already
2 parents 365ab32 + ddb8316 commit 1d89427

File tree

7 files changed

+49
-7
lines changed

7 files changed

+49
-7
lines changed

docs/book/src/cronjob-tutorial/testdata/project/Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,13 @@ setup-test-e2e: ## Set up a Kind cluster for e2e tests if it does not exist
7777
echo "Kind is not installed. Please install Kind manually."; \
7878
exit 1; \
7979
}
80-
$(KIND) create cluster --name $(KIND_CLUSTER)
80+
@case "$$($(KIND) get clusters)" in \
81+
*"$(KIND_CLUSTER)"*) \
82+
echo "Kind cluster '$(KIND_CLUSTER)' already exists. Skipping creation." ;; \
83+
*) \
84+
echo "Creating Kind cluster '$(KIND_CLUSTER)'..."; \
85+
$(KIND) create cluster --name $(KIND_CLUSTER) ;; \
86+
esac
8187

8288
.PHONY: test-e2e
8389
test-e2e: setup-test-e2e manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.

docs/book/src/getting-started/testdata/project/Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,13 @@ setup-test-e2e: ## Set up a Kind cluster for e2e tests if it does not exist
7373
echo "Kind is not installed. Please install Kind manually."; \
7474
exit 1; \
7575
}
76-
$(KIND) create cluster --name $(KIND_CLUSTER)
76+
@case "$$($(KIND) get clusters)" in \
77+
*"$(KIND_CLUSTER)"*) \
78+
echo "Kind cluster '$(KIND_CLUSTER)' already exists. Skipping creation." ;; \
79+
*) \
80+
echo "Creating Kind cluster '$(KIND_CLUSTER)'..."; \
81+
$(KIND) create cluster --name $(KIND_CLUSTER) ;; \
82+
esac
7783

7884
.PHONY: test-e2e
7985
test-e2e: setup-test-e2e manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.

docs/book/src/multiversion-tutorial/testdata/project/Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,13 @@ setup-test-e2e: ## Set up a Kind cluster for e2e tests if it does not exist
7777
echo "Kind is not installed. Please install Kind manually."; \
7878
exit 1; \
7979
}
80-
$(KIND) create cluster --name $(KIND_CLUSTER)
80+
@case "$$($(KIND) get clusters)" in \
81+
*"$(KIND_CLUSTER)"*) \
82+
echo "Kind cluster '$(KIND_CLUSTER)' already exists. Skipping creation." ;; \
83+
*) \
84+
echo "Creating Kind cluster '$(KIND_CLUSTER)'..."; \
85+
$(KIND) create cluster --name $(KIND_CLUSTER) ;; \
86+
esac
8187

8288
.PHONY: test-e2e
8389
test-e2e: setup-test-e2e manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.

pkg/plugins/golang/v4/scaffolds/internal/templates/makefile.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,13 @@ setup-test-e2e: ## Set up a Kind cluster for e2e tests if it does not exist
152152
echo "Kind is not installed. Please install Kind manually."; \
153153
exit 1; \
154154
}
155-
$(KIND) create cluster --name $(KIND_CLUSTER)
155+
@case "$$($(KIND) get clusters)" in \
156+
*"$(KIND_CLUSTER)"*) \
157+
echo "Kind cluster '$(KIND_CLUSTER)' already exists. Skipping creation." ;; \
158+
*) \
159+
echo "Creating Kind cluster '$(KIND_CLUSTER)'..."; \
160+
$(KIND) create cluster --name $(KIND_CLUSTER) ;; \
161+
esac
156162
157163
.PHONY: test-e2e
158164
test-e2e: setup-test-e2e manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.

testdata/project-v4-multigroup/Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,13 @@ setup-test-e2e: ## Set up a Kind cluster for e2e tests if it does not exist
7373
echo "Kind is not installed. Please install Kind manually."; \
7474
exit 1; \
7575
}
76-
$(KIND) create cluster --name $(KIND_CLUSTER)
76+
@case "$$($(KIND) get clusters)" in \
77+
*"$(KIND_CLUSTER)"*) \
78+
echo "Kind cluster '$(KIND_CLUSTER)' already exists. Skipping creation." ;; \
79+
*) \
80+
echo "Creating Kind cluster '$(KIND_CLUSTER)'..."; \
81+
$(KIND) create cluster --name $(KIND_CLUSTER) ;; \
82+
esac
7783

7884
.PHONY: test-e2e
7985
test-e2e: setup-test-e2e manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.

testdata/project-v4-with-plugins/Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,13 @@ setup-test-e2e: ## Set up a Kind cluster for e2e tests if it does not exist
7373
echo "Kind is not installed. Please install Kind manually."; \
7474
exit 1; \
7575
}
76-
$(KIND) create cluster --name $(KIND_CLUSTER)
76+
@case "$$($(KIND) get clusters)" in \
77+
*"$(KIND_CLUSTER)"*) \
78+
echo "Kind cluster '$(KIND_CLUSTER)' already exists. Skipping creation." ;; \
79+
*) \
80+
echo "Creating Kind cluster '$(KIND_CLUSTER)'..."; \
81+
$(KIND) create cluster --name $(KIND_CLUSTER) ;; \
82+
esac
7783

7884
.PHONY: test-e2e
7985
test-e2e: setup-test-e2e manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.

testdata/project-v4/Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,13 @@ setup-test-e2e: ## Set up a Kind cluster for e2e tests if it does not exist
7373
echo "Kind is not installed. Please install Kind manually."; \
7474
exit 1; \
7575
}
76-
$(KIND) create cluster --name $(KIND_CLUSTER)
76+
@case "$$($(KIND) get clusters)" in \
77+
*"$(KIND_CLUSTER)"*) \
78+
echo "Kind cluster '$(KIND_CLUSTER)' already exists. Skipping creation." ;; \
79+
*) \
80+
echo "Creating Kind cluster '$(KIND_CLUSTER)'..."; \
81+
$(KIND) create cluster --name $(KIND_CLUSTER) ;; \
82+
esac
7783

7884
.PHONY: test-e2e
7985
test-e2e: setup-test-e2e manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.

0 commit comments

Comments
 (0)