Skip to content

Commit fe198d0

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

9 files changed

Lines changed: 20 additions & 23 deletions

File tree

docs/demos/ArgoCD/fleet-argocd-integration.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ spec:
129129
source:
130130
path: docs/demos/ArgoCD/manifests/guestbook
131131
repoURL: https://github.com/Azure/fleet.git
132-
targetRevision: master
132+
targetRevision: main
133133
syncPolicy:
134134
automated:
135135
prune: true
@@ -548,7 +548,7 @@ guestbook guestbook-app Synced Healthy
548548
kubectl get cm -n guestbook test-config -o yaml
549549
apiVersion: v1
550550
data:
551-
branch: master
551+
branch: main
552552
cluster: member1 # <- member1 exclusive
553553
kind: ConfigMap
554554
metadata:
@@ -565,7 +565,7 @@ guestbook guestbook-app Synced Healthy
565565
kubectl get cm -n guestbook test-config -o yaml
566566
apiVersion: v1
567567
data:
568-
branch: master
568+
branch: main
569569
cluster: member2 # <- member2 exclusive
570570
kind: ConfigMap
571571
metadata:
@@ -582,7 +582,7 @@ guestbook guestbook-app Synced Healthy
582582
kubectl get cm -n guestbook test-config -o yaml
583583
apiVersion: v1
584584
data:
585-
branch: master
585+
branch: main
586586
cluster: member3 # <- member3 exclusive
587587
kind: ConfigMap
588588
metadata:

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: main # source branch
1515
syncPolicy:
1616
automated:
1717
prune: true

docs/demos/ArgoCD/manifests/guestbook/member1/test-configmap.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ kind: ConfigMap
33
metadata:
44
name: test-config
55
data:
6-
branch: master
6+
branch: main
77
cluster: member1

docs/demos/ArgoCD/manifests/guestbook/member2/test-configmap.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ kind: ConfigMap
33
metadata:
44
name: test-config
55
data:
6-
branch: master
6+
branch: main
77
cluster: member2

docs/demos/ArgoCD/manifests/guestbook/member3/test-configmap.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ kind: ConfigMap
33
metadata:
44
name: test-config
55
data:
6-
branch: master
6+
branch: main
77
cluster: member3

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)