Skip to content

Commit 692933f

Browse files
committed
fix e2e namespace already exist issue
1 parent 3a1dde9 commit 692933f

5 files changed

Lines changed: 13 additions & 16 deletions

File tree

docs/demos/ArgoCD/manifests/guestbook-app.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ spec:
1111
source:
1212
path: docs/demos/ArgoCD/manifests/guestbook # manifest path
1313
repoURL: https://github.com/Azure/fleet.git # source repo
14-
targetRevision: argocd-demo # source branch
14+
targetRevision: master # source branch
1515
syncPolicy:
1616
automated:
1717
prune: true

test/e2e/enveloped_object_placement_test.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ var _ = Describe("Process objects with generate name", Ordered, func() {
342342
// Create the namespace with both name and generate name set.
343343
ns := appNamespace()
344344
ns.GenerateName = nsGenerateName
345-
Expect(hubClient.Create(ctx, &ns)).To(Succeed(), "Failed to create namespace %s", ns.Namespace)
345+
Expect(hubClient.Create(ctx, &ns)).To(Succeed(), "Failed to create namespace %s", ns.Name)
346346

347347
// Create an envelope config map.
348348
cm := &corev1.ConfigMap{
@@ -481,11 +481,8 @@ var _ = Describe("Process objects with generate name", Ordered, func() {
481481
})
482482

483483
AfterAll(func() {
484-
// Remove the CRP.
485-
cleanupCRP(crpName)
486-
487-
// Clean the placed resources.
488-
cleanWorkResourcesOnCluster(allMemberClusters[0])
484+
By(fmt.Sprintf("deleting placement %s and related resources", crpName))
485+
ensureCRPAndRelatedResourcesDeleted(crpName, allMemberClusters)
489486
})
490487
})
491488

@@ -638,7 +635,7 @@ func readEnvelopTestManifests() {
638635
// createWrappedResourcesForEnvelopTest creates some enveloped resources on the hub cluster for testing purposes.
639636
func createWrappedResourcesForEnvelopTest() {
640637
ns := appNamespace()
641-
Expect(hubClient.Create(ctx, &ns)).To(Succeed(), "Failed to create namespace %s", ns.Namespace)
638+
Expect(hubClient.Create(ctx, &ns)).To(Succeed(), "Failed to create namespace %s", ns.Name)
642639
// modify the configMap according to the namespace
643640
testConfigMap.Namespace = ns.Name
644641
Expect(hubClient.Create(ctx, &testConfigMap)).To(Succeed(), "Failed to create config map %s", testConfigMap.Name)

test/e2e/utils_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ func createWorkResource(name, namespace string) {
668668
// createWorkResources creates some resources on the hub cluster for testing purposes.
669669
func createWorkResources() {
670670
ns := appNamespace()
671-
Expect(hubClient.Create(ctx, &ns)).To(Succeed(), "Failed to create namespace %s", ns.Namespace)
671+
Expect(hubClient.Create(ctx, &ns)).To(Succeed(), "Failed to create namespace %s", ns.Name)
672672

673673
configMap := appConfigMap()
674674
Expect(hubClient.Create(ctx, &configMap)).To(Succeed(), "Failed to create config map %s", configMap.Name)
@@ -681,7 +681,7 @@ func cleanupWorkResources() {
681681

682682
func cleanWorkResourcesOnCluster(cluster *framework.Cluster) {
683683
ns := appNamespace()
684-
Expect(client.IgnoreNotFound(cluster.KubeClient.Delete(ctx, &ns))).To(Succeed(), "Failed to delete namespace %s", ns.Namespace)
684+
Expect(client.IgnoreNotFound(cluster.KubeClient.Delete(ctx, &ns))).To(Succeed(), "Failed to delete namespace %s", ns.Name)
685685

686686
workResourcesRemovedActual := workNamespaceRemovedFromClusterActual(cluster)
687687
Eventually(workResourcesRemovedActual, workloadEventuallyDuration, eventuallyInterval).Should(Succeed(), "Failed to remove work resources from %s cluster", cluster.ClusterName)

test/upgrade/before/scenarios_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ var _ = Describe("CRP with non-trackable resources, all available (before upgrad
7272
BeforeAll(func() {
7373
// Create the resources.
7474
ns := appNamespace(workNamespaceName, crpName)
75-
Expect(hubClient.Create(ctx, &ns)).To(Succeed(), "Failed to create namespace %s", ns.Namespace)
75+
Expect(hubClient.Create(ctx, &ns)).To(Succeed(), "Failed to create namespace %s", ns.Name)
7676

7777
// Job is currently untrackable in Fleet.
7878
job := batchv1.Job{
@@ -159,7 +159,7 @@ var _ = Describe("CRP with availability failure (before upgrade)", Ordered, func
159159
BeforeAll(func() {
160160
// Create the resources.
161161
ns := appNamespace(workNamespaceName, crpName)
162-
Expect(hubClient.Create(ctx, &ns)).To(Succeed(), "Failed to create namespace %s", ns.Namespace)
162+
Expect(hubClient.Create(ctx, &ns)).To(Succeed(), "Failed to create namespace %s", ns.Name)
163163

164164
// Use a Service of the LoadBalancer type as by default KinD environment does not support
165165
// this service type and such services will always be unavailable.
@@ -266,7 +266,7 @@ var _ = Describe("CRP with apply op failure (before upgrade)", Ordered, func() {
266266

267267
// Create the resources on the member cluster with a custom manager
268268
ns := appNamespace(workNamespaceName, crpName)
269-
Expect(memberCluster1EastProdClient.Create(ctx, &ns)).To(Succeed(), "Failed to create namespace %s", ns.Namespace)
269+
Expect(memberCluster1EastProdClient.Create(ctx, &ns)).To(Succeed(), "Failed to create namespace %s", ns.Name)
270270

271271
configMap := appConfigMap(workNamespaceName, appConfigMapName)
272272
configMap.Data = map[string]string{
@@ -368,7 +368,7 @@ var _ = Describe("CRP stuck in the rollout process (blocked by availability fail
368368
BeforeAll(func() {
369369
// Create the resources.
370370
ns := appNamespace(workNamespaceName, crpName)
371-
Expect(hubClient.Create(ctx, &ns)).To(Succeed(), "Failed to create namespace %s", ns.Namespace)
371+
Expect(hubClient.Create(ctx, &ns)).To(Succeed(), "Failed to create namespace %s", ns.Name)
372372

373373
// Use a Service of the ClusterIP type. KinD supports it and it will become available
374374
// once an IP has been assigned.
@@ -697,7 +697,7 @@ var _ = Describe("CRP stuck in the rollout process (long wait time)", Ordered, f
697697
BeforeAll(func() {
698698
// Create the resources.
699699
ns := appNamespace(workNamespaceName, crpName)
700-
Expect(hubClient.Create(ctx, &ns)).To(Succeed(), "Failed to create namespace %s", ns.Namespace)
700+
Expect(hubClient.Create(ctx, &ns)).To(Succeed(), "Failed to create namespace %s", ns.Name)
701701

702702
// Job is currently untrackable in Fleet.
703703
originalJob = &batchv1.Job{

test/upgrade/before/utils_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func checkIfAllMemberClustersHaveJoined() {
104104
// createWorkResources creates some resources on the hub cluster for testing purposes.
105105
func createWorkResources(workNamespaceName, appConfigMapName, crpName string) {
106106
ns := appNamespace(workNamespaceName, crpName)
107-
Expect(hubClient.Create(ctx, &ns)).To(Succeed(), "Failed to create namespace %s", ns.Namespace)
107+
Expect(hubClient.Create(ctx, &ns)).To(Succeed(), "Failed to create namespace %s", ns.Name)
108108

109109
configMap := appConfigMap(workNamespaceName, appConfigMapName)
110110
Expect(hubClient.Create(ctx, &configMap)).To(Succeed(), "Failed to create config map %s", configMap.Name)

0 commit comments

Comments
 (0)