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:23:00 UTC
[jira] [Created] (YUNIKORN-2155) Eliminate long time.Sleep() calls from the application test code
Peter Bacsko created YUNIKORN-2155:
--------------------------------------
Summary: 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
{{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()}} 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