@@ -30,6 +30,7 @@ import (
3030 "k8s.io/apimachinery/pkg/types"
3131 "k8s.io/apimachinery/pkg/util/rand"
3232 "k8s.io/apimachinery/pkg/util/wait"
33+ "k8s.io/klog/v2"
3334 "k8s.io/utils/ptr"
3435 "sigs.k8s.io/controller-runtime/pkg/client"
3536
@@ -469,8 +470,8 @@ var _ = ginkgo.Describe("application failover testing", func() {
469470 },
470471 },
471472 })
472- framework .CreateOverridePolicy (karmadaClient , overridePolicy )
473473 beginTime = time .Now ()
474+ framework .CreateOverridePolicy (karmadaClient , overridePolicy )
474475 })
475476 defer framework .RemoveOverridePolicy (karmadaClient , policyNamespace , policyName )
476477
@@ -488,8 +489,10 @@ var _ = ginkgo.Describe("application failover testing", func() {
488489
489490 ginkgo .By ("check whether application failover with purgeMode gracefully when the GracePeriodSeconds is reach out" , func () {
490491 framework .WaitDeploymentDisappearOnClusters (disabledClusters , deploymentNamespace , deploymentName )
491- evictionTime := time .Now ()
492- gomega .Expect (evictionTime .Sub (beginTime ) > time .Duration (gracePeriodSeconds + tolerationSeconds )* time .Second ).Should (gomega .BeTrue ())
492+ evictionTimeCost := time .Since (beginTime )
493+ expectTimeCost := time .Second * time .Duration (gracePeriodSeconds + tolerationSeconds )
494+ klog .Infof ("application failover time cost: actual: %s, expect: %s" , evictionTimeCost .String (), expectTimeCost .String ())
495+ gomega .Expect (evictionTimeCost >= expectTimeCost ).Should (gomega .BeTrue ())
493496 })
494497 })
495498 })
0 commit comments