From 8689eef4f2698ad00388fd14687b4224ed4adc83 Mon Sep 17 00:00:00 2001 From: AiRanthem Date: Tue, 8 Oct 2024 19:05:57 +0800 Subject: [PATCH] add time cost fix for a ut Signed-off-by: AiRanthem --- .../workloadspread/workloadspread_controller_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/controller/workloadspread/workloadspread_controller_test.go b/pkg/controller/workloadspread/workloadspread_controller_test.go index 0798ff9217..de3670459e 100644 --- a/pkg/controller/workloadspread/workloadspread_controller_test.go +++ b/pkg/controller/workloadspread/workloadspread_controller_test.go @@ -1781,8 +1781,11 @@ func TestDelayReconcile(t *testing.T) { durationStore = requeueduration.DurationStore{} nsn := types.NamespacedName{Namespace: workloadSpread.Namespace, Name: workloadSpread.Name} + start := time.Now() result, _ := reconciler.Reconcile(context.TODO(), reconcile.Request{NamespacedName: nsn}) - if (cs.expectRequeueAfter - result.RequeueAfter) > 1*time.Second { + cost := time.Now().Sub(start) + t.Logf("time cost %f seconds", cost.Seconds()) + if cs.expectRequeueAfter-result.RequeueAfter > 1*time.Second+cost { t.Fatalf("requeue key failed") } })