Skip to content

Commit e5c846f

Browse files
committed
fix e2e
Signed-off-by: Britania Rodriguez Reyes <[email protected]>
1 parent 64235cc commit e5c846f

File tree

2 files changed

+25
-17
lines changed

2 files changed

+25
-17
lines changed

test/e2e/cluster_staged_updaterun_test.go

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,16 @@ var _ = Describe("test CRP rollout with staged update run", func() {
145145
validateAndApproveClusterApprovalRequests(updateRunNames[0], envCanary)
146146
})
147147

148-
It("Should rollout resources to member-cluster-1 first because of its name", func() {
149-
checkIfPlacedWorkResourcesOnMemberClustersInUpdateRun([]*framework.Cluster{allMemberClusters[0]})
148+
It("Should not rollout resources to prod stage until approved", func() {
149+
checkIfRemovedWorkResourcesFromMemberClustersConsistently([]*framework.Cluster{allMemberClusters[0], allMemberClusters[2]})
150150
})
151151

152-
It("Should rollout resources to all the members and complete the cluster staged update run successfully", func() {
152+
It("Should rollout resources to all the members after approval and complete the cluster staged update run successfully", func() {
153+
validateAndApproveClusterApprovalRequests(updateRunNames[0], envProd)
154+
155+
By("Should rollout resources to member-cluster-1 first because of its name")
156+
checkIfPlacedWorkResourcesOnMemberClustersInUpdateRun([]*framework.Cluster{allMemberClusters[0]})
157+
153158
csurSucceededActual := clusterStagedUpdateRunStatusSucceededActual(updateRunNames[0], resourceSnapshotIndex1st, policySnapshotIndex1st, len(allMemberClusters), defaultApplyStrategy, &strategy.Spec, [][]string{{allMemberClusterNames[1]}, {allMemberClusterNames[0], allMemberClusterNames[2]}}, nil, nil, nil)
154159
Eventually(csurSucceededActual, updateRunEventuallyDuration, eventuallyInterval).Should(Succeed(), "Failed to validate updateRun %s succeeded", updateRunNames[0])
155160
checkIfPlacedWorkResourcesOnMemberClustersInUpdateRun(allMemberClusters)
@@ -216,7 +221,11 @@ var _ = Describe("test CRP rollout with staged update run", func() {
216221
})
217222

218223
It("Should not rollout resources to prod stage until approved", func() {
219-
checkIfRemovedWorkResourcesFromMemberClustersConsistently([]*framework.Cluster{allMemberClusters[0], allMemberClusters[2]})
224+
By("Verify that the configmap is not updated on member-cluster-1 and member-cluster-3")
225+
for _, cluster := range []*framework.Cluster{allMemberClusters[0], allMemberClusters[2]} {
226+
configMapActual := configMapPlacedOnClusterActual(cluster, &oldConfigMap)
227+
Consistently(configMapActual, consistentlyDuration, consistentlyInterval).Should(Succeed(), "Failed to keep configmap %s data as expected", newConfigMap.Name)
228+
}
220229
})
221230

222231
It("Should rollout resources to all the members after approval and complete the cluster staged update run successfully", func() {
@@ -397,9 +406,6 @@ var _ = Describe("test CRP rollout with staged update run", func() {
397406
})
398407

399408
It("Should not rollout resources to prod stage until approved", func() {
400-
By("Verify that the new configmap is updated on member-cluster-2")
401-
configMapActual := configMapPlacedOnClusterActual(allMemberClusters[1], &newConfigMap)
402-
Eventually(configMapActual, eventuallyDuration, eventuallyInterval).Should(Succeed(), "Failed to update to the new configmap %s on cluster %s", newConfigMap.Name, allMemberClusterNames[1])
403409
By("Verify that the configmap is not updated on member-cluster-1 and member-cluster-3")
404410
for _, cluster := range []*framework.Cluster{allMemberClusters[0], allMemberClusters[2]} {
405411
configMapActual := configMapPlacedOnClusterActual(cluster, &oldConfigMap)
@@ -448,9 +454,6 @@ var _ = Describe("test CRP rollout with staged update run", func() {
448454
})
449455

450456
It("Should not rollback resources to prod stage until approved", func() {
451-
By("Verify that the configmap is rolled back on member-cluster-2")
452-
configMapActual := configMapPlacedOnClusterActual(allMemberClusters[1], &oldConfigMap)
453-
Eventually(configMapActual, eventuallyDuration, eventuallyInterval).Should(Succeed(), "Failed to rollback the configmap change on cluster %s", allMemberClusterNames[1])
454457
By("Verify that the configmap is not rolled back on member-cluster-1 and member-cluster-3")
455458
for _, cluster := range []*framework.Cluster{allMemberClusters[0], allMemberClusters[2]} {
456459
configMapActual := configMapPlacedOnClusterActual(cluster, &newConfigMap)

test/e2e/staged_updaterun_test.go

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,19 @@ var _ = Describe("test RP rollout with staged update run", Label("resourceplacem
210210

211211
validateAndApproveNamespacedApprovalRequests(updateRunNames[1], testNamespace, envCanary)
212212
})
213+
It("Should not rollout resources to prod stage until approved", func() {
214+
By("Verify that the configmap is not updated on member-cluster-1 and member-cluster-3")
215+
for _, cluster := range []*framework.Cluster{allMemberClusters[0], allMemberClusters[2]} {
216+
configMapActual := configMapPlacedOnClusterActual(cluster, &oldConfigMap)
217+
Consistently(configMapActual, consistentlyDuration, consistentlyInterval).Should(Succeed(), "Failed to keep configmap %s data as expected", newConfigMap.Name)
218+
}
219+
})
220+
221+
It("Should rollout resources to all the members after approval and complete the staged update run successfully", func() {
222+
validateAndApproveNamespacedApprovalRequests(updateRunNames[0], testNamespace, envProd)
213223

214-
It("Should rollout resources to member-cluster-1 and member-cluster-3 too and complete the staged update run successfully", func() {
224+
By("Should rollout resources to member-cluster-1 first because of its name")
225+
checkIfPlacedWorkResourcesOnMemberClustersInUpdateRun([]*framework.Cluster{allMemberClusters[0]})
215226
surSucceededActual := stagedUpdateRunStatusSucceededActual(updateRunNames[1], testNamespace, resourceSnapshotIndex2nd, policySnapshotIndex1st, len(allMemberClusters), defaultApplyStrategy, &strategy.Spec, [][]string{{allMemberClusterNames[1]}, {allMemberClusterNames[0], allMemberClusterNames[2]}}, nil, nil, nil)
216227
Eventually(surSucceededActual, updateRunEventuallyDuration, eventuallyInterval).Should(Succeed(), "Failed to validate updateRun %s/%s succeeded", testNamespace, updateRunNames[1])
217228
By("Verify that new the configmap is updated on all member clusters")
@@ -382,9 +393,6 @@ var _ = Describe("test RP rollout with staged update run", Label("resourceplacem
382393
})
383394

384395
It("Should not rollout resources to prod stage until approved", func() {
385-
By("Verify that the new configmap is updated on member-cluster-2")
386-
configMapActual := configMapPlacedOnClusterActual(allMemberClusters[1], &newConfigMap)
387-
Eventually(configMapActual, eventuallyDuration, eventuallyInterval).Should(Succeed(), "Failed to update to the new configmap %s on cluster %s", newConfigMap.Name, allMemberClusterNames[1])
388396
By("Verify that the configmap is not updated on member-cluster-1 and member-cluster-3")
389397
for _, cluster := range []*framework.Cluster{allMemberClusters[0], allMemberClusters[2]} {
390398
configMapActual := configMapPlacedOnClusterActual(cluster, &oldConfigMap)
@@ -433,9 +441,6 @@ var _ = Describe("test RP rollout with staged update run", Label("resourceplacem
433441
})
434442

435443
It("Should not rollback resources to prod stage until approved", func() {
436-
By("Verify that the configmap is rolled back on member-cluster-2")
437-
configMapActual := configMapPlacedOnClusterActual(allMemberClusters[1], &oldConfigMap)
438-
Eventually(configMapActual, eventuallyDuration, eventuallyInterval).Should(Succeed(), "Failed to rollback the configmap change on cluster %s", allMemberClusterNames[1])
439444
By("Verify that the configmap is not rolled back on member-cluster-1 and member-cluster-3")
440445
for _, cluster := range []*framework.Cluster{allMemberClusters[0], allMemberClusters[2]} {
441446
configMapActual := configMapPlacedOnClusterActual(cluster, &newConfigMap)

0 commit comments

Comments
 (0)