Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Arvind Thirumurugan committed Jan 3, 2025
1 parent 2dac72f commit 27b7d37
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions test/e2e/taint_toleration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,16 @@ var _ = FDescribe("placing resources using a cluster resource placement with no

var _ = FDescribe("picking N clusters with affinities and topology spread constraints, taint clusters, create cluster resource placement with toleration for one cluster", Serial, Ordered, func() {
crpName := fmt.Sprintf(crpNameTemplate, GinkgoParallelProcess())
var taintClusters []*framework.Cluster
var taintClusterNames, tolerateClusterNames []string
var taintClusters, tolerateClusters, unSelectedClusters []*framework.Cluster
var taintClusterNames, tolerateClusterNames, unSelectedClusterNames []string

BeforeAll(func() {
taintClusters = []*framework.Cluster{memberCluster1EastProd, memberCluster2EastCanary}
tolerateClusters = []*framework.Cluster{memberCluster1EastProd}
unSelectedClusters = []*framework.Cluster{memberCluster2EastCanary}
taintClusterNames = buildClusterNames(taintClusters)
tolerateClusterNames = []string{memberCluster1EastProdName}
tolerateClusterNames = buildClusterNames(tolerateClusters)
unSelectedClusterNames = buildClusterNames(unSelectedClusters)

// Create the resources.
createWorkResources()
Expand Down Expand Up @@ -278,20 +281,18 @@ var _ = FDescribe("picking N clusters with affinities and topology spread constr

It("should update cluster resource placement status as expected", func() {
// we choose two clusters using a label.
statusUpdatedActual := crpStatusUpdatedActual(workResourceIdentifiers(), tolerateClusterNames, []string{memberCluster2EastCanaryName}, "0")
statusUpdatedActual := crpStatusUpdatedActual(workResourceIdentifiers(), tolerateClusterNames, unSelectedClusterNames, "0")
Eventually(statusUpdatedActual, eventuallyDuration, eventuallyInterval).Should(Succeed(), "Failed to update cluster resource placement status as expected")
})

It("should place resources on the selected clusters with tolerated taint", func() {
targetClusters := []*framework.Cluster{memberCluster1EastProd}
for _, cluster := range targetClusters {
for _, cluster := range tolerateClusters {
resourcePlacedActual := workNamespaceAndConfigMapPlacedOnClusterActual(cluster)
Eventually(resourcePlacedActual, eventuallyDuration, eventuallyInterval).Should(Succeed(), "Failed to place resources on the selected clusters")
}
})

It("should ensure no resources exist on member clusters with untolerated taint", func() {
unSelectedClusters := []*framework.Cluster{memberCluster2EastCanary}
for _, cluster := range unSelectedClusters {
resourceRemovedActual := workNamespaceRemovedFromClusterActual(cluster)
Eventually(resourceRemovedActual, eventuallyDuration, eventuallyInterval).Should(Succeed(), "Failed to check if resources doesn't exist on member cluster")
Expand All @@ -301,7 +302,7 @@ var _ = FDescribe("picking N clusters with affinities and topology spread constr
AfterAll(func() {
// Remove taint from member cluster 1, 2.
removeTaintsFromMemberClusters(taintClusterNames)
ensureCRPAndRelatedResourcesDeleted(crpName, []*framework.Cluster{memberCluster1EastProd})
ensureCRPAndRelatedResourcesDeleted(crpName, tolerateClusters)
})
})

Expand Down

0 comments on commit 27b7d37

Please sign in to comment.