Skip to content

Commit 16559fa

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

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)
@@ -86,6 +86,7 @@ var _ = Describe("GKE workload cluster creation", func() {
8686

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

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

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

143145
ApplyManagedClusterTemplateAndWait(ctx, ApplyManagedClusterTemplateAndWaitInput{
@@ -163,6 +165,7 @@ var _ = Describe("GKE workload cluster creation", func() {
163165

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

168171
ApplyManagedClusterTemplateAndWait(ctx, ApplyManagedClusterTemplateAndWaitInput{

0 commit comments

Comments
 (0)