fix flaking test: tainttoleration check
Signed-off-by: changzhen <changzhen5@huawei.com>
This commit is contained in:
parent
a7a944a1a5
commit
2719e0919b
|
@ -113,7 +113,7 @@ var _ = framework.SerialDescribe("failover testing", func() {
|
|||
}
|
||||
}
|
||||
|
||||
gomega.Expect(len(targetClusterNames) == minGroups).Should(gomega.BeTrue())
|
||||
gomega.Expect(len(targetClusterNames)).Should(gomega.Equal(minGroups))
|
||||
return true, nil
|
||||
})
|
||||
|
||||
|
|
|
@ -130,8 +130,8 @@ var _ = ginkgo.Describe("propagation with fieldSelector testing", func() {
|
|||
ginkgo.It("propagation with fieldSelector testing", func() {
|
||||
ginkgo.By("check whether deployment is scheduled to clusters which meeting the fieldSelector requirements", func() {
|
||||
targetClusterNames := framework.ExtractTargetClustersFrom(controlPlaneClient, deployment)
|
||||
gomega.Expect(len(targetClusterNames) == 1).Should(gomega.BeTrue())
|
||||
gomega.Expect(targetClusterNames[0] == desiredScheduleResult).Should(gomega.BeTrue())
|
||||
gomega.Expect(len(targetClusterNames)).Should(gomega.Equal(1))
|
||||
gomega.Expect(targetClusterNames[0]).Should(gomega.Equal(desiredScheduleResult))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -3,6 +3,7 @@ package e2e
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/onsi/ginkgo/v2"
|
||||
"github.com/onsi/gomega"
|
||||
|
@ -107,6 +108,11 @@ var _ = framework.SerialDescribe("propagation with taint and toleration testing"
|
|||
})
|
||||
|
||||
ginkgo.BeforeEach(func() {
|
||||
// wait a little while for the karmada-scheduler to sync the cluster changes
|
||||
// before deploying the workload.
|
||||
// Note: 1 second might be not enough, bug should fit for the most cases.
|
||||
time.Sleep(time.Second)
|
||||
|
||||
framework.CreatePropagationPolicy(karmadaClient, policy)
|
||||
framework.CreateDeployment(kubeClient, deployment)
|
||||
ginkgo.DeferCleanup(func() {
|
||||
|
@ -116,12 +122,11 @@ var _ = framework.SerialDescribe("propagation with taint and toleration testing"
|
|||
})
|
||||
|
||||
ginkgo.It("deployment with cluster tolerations testing", func() {
|
||||
|
||||
ginkgo.By(fmt.Sprintf("check if deployment(%s/%s) only scheduled to tolerated cluster(%s)", deploymentNamespace, deploymentName, tolerationValue), func() {
|
||||
gomega.Eventually(func(g gomega.Gomega) {
|
||||
targetClusterNames := framework.ExtractTargetClustersFrom(controlPlaneClient, deployment)
|
||||
g.Expect(len(targetClusterNames) == 1).Should(gomega.BeTrue())
|
||||
g.Expect(targetClusterNames[0] == tolerationValue).Should(gomega.BeTrue())
|
||||
g.Expect(len(targetClusterNames)).Should(gomega.Equal(1))
|
||||
g.Expect(targetClusterNames[0]).Should(gomega.Equal(tolerationValue))
|
||||
}, pollTimeout, pollInterval).Should(gomega.Succeed())
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue