Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions test/e2e/suites/base/failover_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/rand"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/klog/v2"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"

Expand Down Expand Up @@ -469,8 +470,8 @@ var _ = ginkgo.Describe("application failover testing", func() {
},
},
})
framework.CreateOverridePolicy(karmadaClient, overridePolicy)
beginTime = time.Now()
framework.CreateOverridePolicy(karmadaClient, overridePolicy)
})
defer framework.RemoveOverridePolicy(karmadaClient, policyNamespace, policyName)

Expand All @@ -488,8 +489,10 @@ var _ = ginkgo.Describe("application failover testing", func() {

ginkgo.By("check whether application failover with purgeMode gracefully when the GracePeriodSeconds is reach out", func() {
framework.WaitDeploymentDisappearOnClusters(disabledClusters, deploymentNamespace, deploymentName)
evictionTime := time.Now()
gomega.Expect(evictionTime.Sub(beginTime) > time.Duration(gracePeriodSeconds+tolerationSeconds)*time.Second).Should(gomega.BeTrue())
evictionTimeCost := time.Since(beginTime)
expectTimeCost := time.Second * time.Duration(gracePeriodSeconds+tolerationSeconds)
klog.Infof("application failover time cost: actual: %s, expect: %s", evictionTimeCost.String(), expectTimeCost.String())
gomega.Expect(evictionTimeCost >= expectTimeCost).Should(gomega.BeTrue())
})
})
})
Expand Down