pbacsko commented on code in PR #883:
URL: https://github.com/apache/yunikorn-core/pull/883#discussion_r1624406891
##########
pkg/scheduler/ugm/queue_tracker_test.go:
##########
@@ -318,6 +318,49 @@ func TestNewQueueTracker(t *testing.T) {
assert.Assert(t, resources.IsZero(parent.resourceUsage))
}
+func TestSetLimit(t *testing.T) {
+ manager := GetUserManager()
+ defer manager.ClearConfigLimits()
+ limit := resources.NewResourceFromMap(map[string]resources.Quantity{
+ "mem": 10,
+ "vcore": 10})
+ manager.userWildCardLimitsConfig = map[string]*LimitConfig{
+ path1: {
+ maxApplications: 3,
+ maxResources: limit.Clone(),
+ },
+ }
+ root := newRootQueueTracker(user)
+
+ // create tracker hierarchy
+ root.setLimit(strings.Split(queuePath1, configs.DOT), limit.Clone(), 3,
true, user, true)
+
+ // check settings
+ parentQ := root.childQueueTrackers["parent"]
+ assert.Assert(t, parentQ.maxResources == nil)
+ assert.Equal(t, uint64(0), parentQ.maxRunningApps)
+ childQ := parentQ.childQueueTrackers["child1"]
+ assert.Assert(t, parentQ.maxResources == nil)
+ assert.Equal(t, uint64(0), parentQ.maxRunningApps)
+ assert.Assert(t, resources.Equals(limit, childQ.maxResources))
+
+ // check if settings are overridden
+ newLimit := resources.NewResourceFromMap(map[string]resources.Quantity{
+ "mem": 20,
+ "vcore": 20})
+ root.setLimit(strings.Split(queuePath1, configs.DOT), newLimit.Clone(),
3, false, user, true) // override
+ assert.Assert(t, resources.Equals(newLimit, childQ.maxResources))
+ newLimit2 := resources.NewResourceFromMap(map[string]resources.Quantity{
+ "mem": 30,
+ "vcore": 30})
+ root.setLimit(strings.Split(queuePath1, configs.DOT),
newLimit2.Clone(), 3, true, user, true) // no override
+ assert.Assert(t, resources.Equals(newLimit, childQ.maxResources))
+ root.setLimit(strings.Split(queuePath1, configs.DOT),
newLimit2.Clone(), 3, true, user, false) // override -> changes
qt.doWildCardCheck
+ assert.Assert(t, resources.Equals(newLimit2, childQ.maxResources))
+ root.setLimit(strings.Split(queuePath1, configs.DOT),
newLimit2.Clone(), 3, false, user, false) // no override
+ assert.Assert(t, resources.Equals(newLimit2, childQ.maxResources))
Review Comment:
@manirajv06 please check this test logic, I'm not 100% sure that I
understand what's going on inside the `QueueTracker`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]