Skip to content

Commit 0234fd2

Browse files
committed
test: use unique gke cluster name to prevent collisions
Signed-off-by: Carlos Salas <[email protected]>
1 parent d0de097 commit 0234fd2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

test/e2e/e2e_gke_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ var _ = Describe("GKE workload cluster creation", func() {
4545
namespace *corev1.Namespace
4646
cancelWatches context.CancelFunc
4747
result *ApplyManagedClusterTemplateAndWaitResult
48-
clusterName string
48+
clusterNamePrefix string
4949
clusterctlLogFolder string
5050
)
5151

@@ -57,7 +57,7 @@ var _ = Describe("GKE workload cluster creation", func() {
5757

5858
Expect(e2eConfig.Variables).To(HaveKey(KubernetesVersion))
5959

60-
clusterName = fmt.Sprintf("capg-e2e-%s", util.RandomString(6))
60+
clusterNamePrefix = fmt.Sprintf("capg-e2e-gke-%s", util.RandomString(6))
6161

6262
// Setup a Namespace where to host objects for this spec and create a watcher for the namespace events.
6363
namespace, cancelWatches = setupSpecNamespace(ctx, specName, bootstrapClusterProxy, artifactFolder)
@@ -85,6 +85,7 @@ var _ = Describe("GKE workload cluster creation", func() {
8585

8686
Context("Creating a GKE cluster without autopilot", func() {
8787
It("Should create a cluster with 1 machine pool and scale", func() {
88+
clusterName := fmt.Sprintf("%s-single", clusterNamePrefix)
8889
By("Initializes with 1 machine pool")
8990

9091
minPoolSize, ok := e2eConfig.Variables["GKE_MACHINE_POOL_MIN"]
@@ -137,6 +138,7 @@ var _ = Describe("GKE workload cluster creation", func() {
137138

138139
Context("Creating a GKE cluster with autopilot", func() {
139140
It("Should create a cluster with 1 machine pool and scale", func() {
141+
clusterName := fmt.Sprintf("%s-autopilot", clusterNamePrefix)
140142
By("Initializes with 1 machine pool")
141143

142144
ApplyManagedClusterTemplateAndWait(ctx, ApplyManagedClusterTemplateAndWaitInput{
@@ -162,6 +164,7 @@ var _ = Describe("GKE workload cluster creation", func() {
162164

163165
Context("Creating a GKE cluster with custom subnet", func() {
164166
It("Should create a cluster with 3 machine pool and custom subnet", func() {
167+
clusterName := fmt.Sprintf("%s-custom-subnet", clusterNamePrefix)
165168
By("Initializes with 3 machine pool")
166169

167170
ApplyManagedClusterTemplateAndWait(ctx, ApplyManagedClusterTemplateAndWaitInput{

0 commit comments

Comments
 (0)