Skip to content

Commit

Permalink
add time cost fix for a ut
Browse files Browse the repository at this point in the history
Signed-off-by: AiRanthem <zhongtianyun.zty@alibaba-inc.com>
  • Loading branch information
AiRanthem committed Oct 9, 2024
1 parent 74bfd40 commit 8689eef
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
})
Expand Down

0 comments on commit 8689eef

Please sign in to comment.