PoiBlackTea commented on code in PR #1107:
URL: https://github.com/apache/yunikorn-core/pull/1107#discussion_r3675200376


##########
pkg/scheduler/objects/queue_test.go:
##########
@@ -3590,6 +3590,18 @@ func TestQueue_setPreemptionTime(t *testing.T) {
                {"max lowered again", 
resources.NewResourceFromMap(map[string]resources.Quantity{"test": 100}), 
map[string]string{"test": "10"}, 
resources.NewResourceFromMap(map[string]resources.Quantity{"test": 110}), 10, 
10, true, false},
                {"max lowered again but usage is lesser than newer max", 
resources.NewResourceFromMap(map[string]resources.Quantity{"test": 100}), 
map[string]string{"test": "10"}, 
resources.NewResourceFromMap(map[string]resources.Quantity{"test": 5}), 10, 10, 
true, true},
                {"max lowered again 2nd", 
resources.NewResourceFromMap(map[string]resources.Quantity{"test": 100}), 
map[string]string{"test": "10"}, nil, 10, 5, true, true},
+               {"res type in max not in usage - usage below max", 
resources.NewResourceFromMap(map[string]resources.Quantity{"vcore": 100000, 
"memory": 1000}), map[string]string{"vcore": "100", "memory": "1000"}, 
resources.NewResourceFromMap(map[string]resources.Quantity{"vcore": 50000}), 0, 
10, false, false},
+               {"res type in max not in usage - usage exceeds max", 
resources.NewResourceFromMap(map[string]resources.Quantity{"vcore": 100000, 
"memory": 1000}), map[string]string{"vcore": "100", "memory": "1000"}, 
resources.NewResourceFromMap(map[string]resources.Quantity{"vcore": 150000}), 
0, 10, false, true},
+               {"res type in usage not in max - usage below max", 
resources.NewResourceFromMap(map[string]resources.Quantity{"vcore": 100000}), 
map[string]string{"vcore": "100"}, 
resources.NewResourceFromMap(map[string]resources.Quantity{"vcore": 50000, 
"memory": 500}), 0, 10, false, false},
+               {"res type in usage not in max - usage exceeds max", 
resources.NewResourceFromMap(map[string]resources.Quantity{"vcore": 100000}), 
map[string]string{"vcore": "100"}, 
resources.NewResourceFromMap(map[string]resources.Quantity{"vcore": 150000, 
"memory": 500}), 0, 10, false, true},
+               {"disjoint res types between max and usage", 
resources.NewResourceFromMap(map[string]resources.Quantity{"gpu": 2}), 
map[string]string{"gpu": "2"}, 
resources.NewResourceFromMap(map[string]resources.Quantity{"vcore": 50000, 
"memory": 500}), 0, 10, false, false},
+               {"multi res types - one exceeds, one below", 
resources.NewResourceFromMap(map[string]resources.Quantity{"vcore": 100000, 
"memory": 1000}), map[string]string{"vcore": "100", "memory": "1000"}, 
resources.NewResourceFromMap(map[string]resources.Quantity{"vcore": 50000, 
"memory": 1500}), 0, 10, false, true},
+               {"multi res types - quota lowered for one type", 
resources.NewResourceFromMap(map[string]resources.Quantity{"vcore": 100000, 
"memory": 1000}), map[string]string{"vcore": "50", "memory": "1000"}, 
resources.NewResourceFromMap(map[string]resources.Quantity{"vcore": 80000, 
"memory": 500}), 10, 10, false, true},
+               {"multi res types - disjoint oldMax and max res", 
resources.NewResourceFromMap(map[string]resources.Quantity{"vcore": 100000, 
"memory": 1000}), map[string]string{"gpu": "2"}, 
resources.NewResourceFromMap(map[string]resources.Quantity{"vcore": 50000, 
"memory": 500}), 10, 10, false, false},
+               {"multi res types - oldMax strictly greater than max across 
types", resources.NewResourceFromMap(map[string]resources.Quantity{"vcore": 
100000, "memory": 2000}), map[string]string{"vcore": "50", "memory": "1000"}, 
resources.NewResourceFromMap(map[string]resources.Quantity{"vcore": 80000, 
"memory": 1500}), 10, 10, false, true},
+               {"multi res types - max removed update with start time reset", 
resources.NewResourceFromMap(map[string]resources.Quantity{"vcore": 100000, 
"memory": 1000}), nil, 
resources.NewResourceFromMap(map[string]resources.Quantity{"vcore": 150000, 
"memory": 1500}), 10, 10, true, true},

Review Comment:
   Sure. Testing maxRes removal with realistic resource types is indeed cleaner 
and sufficient, so I've removed the legacy 'max removed update' case.



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

Reply via email to