You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@yunikorn.apache.org by "Peter Bacsko (Jira)" <ji...@apache.org> on 2023/11/15 08:25:00 UTC

[jira] [Commented] (YUNIKORN-2155) Eliminate long time.Sleep() calls from the application test code

    [ https://issues.apache.org/jira/browse/YUNIKORN-2155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17786228#comment-17786228 ] 

Peter Bacsko commented on YUNIKORN-2155:
----------------------------------------

[~yjzhangal] do you have time to look into this? You worked on the original code. 

> 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: issues-unsubscribe@yunikorn.apache.org
For additional commands, e-mail: issues-help@yunikorn.apache.org