[
https://issues.apache.org/jira/browse/YUNIKORN-2155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17786398#comment-17786398
]
Peter Bacsko commented on YUNIKORN-2155:
----------------------------------------
[~zhuqi] could you also look at TestFinishedTime? If that sleep is not needed,
then it's just an extra line to remove. Then we can close this as Duplicate or
something.
> Eliminate long time.Sleep() calls from the application test code
> ----------------------------------------------------------------
>
> Key: YUNIKORN-2155
> URL: https://issues.apache.org/jira/browse/YUNIKORN-2155
> Project: Apache YuniKorn
> Issue Type: Bug
> Components: core - common, test - unit
> Reporter: Peter Bacsko
> Priority: Major
>
> {{TestResourceUsageAggregation()}} calls {{time.Sleep(3 * time.Second)}}
> three times. It means this test case sleeps for 9 seconds in total.
> Short sleeps can be acceptable (like the ones in {{{}TestStateTimeOut{}}}),
> but this is a lot. We need a different approach here.
> I recommend using a function variable like {{currentTime}} (type {{func()
> time.Time}}) which by default calls {{time.Now()}} inside
> {{TrackedResource.AggregateTrackedResource()}}. However, tests can change
> this to return an arbitrary {{time.Time}}. The original reference of
> {{currentTime()}} is restored in a defer call.
> {{TestFinishedTime}} also uses {{time.Sleep()}} which seems unnecessary.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]