[ 
https://issues.apache.org/jira/browse/YUNIKORN-2155?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Peter Bacsko resolved YUNIKORN-2155.
------------------------------------
    Resolution: Duplicate

Solved in YUNIKORN-2151.

> 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]

Reply via email to