pbacsko commented on code in PR #880:
URL: https://github.com/apache/yunikorn-core/pull/880#discussion_r1619185863


##########
pkg/common/resources/resources_test.go:
##########
@@ -1205,6 +1205,110 @@ func TestGetShares(t *testing.T) {
        }
 }
 
+func TestCompUsageRatio(t *testing.T) {
+       tests := []struct {
+               left     *Resource
+               right    *Resource
+               total    *Resource
+               expected int
+               message  string
+       }{
+               {
+                       left:     nil,
+                       right:    nil,
+                       total:    nil,
+                       expected: 0,
+                       message:  "nil resources",
+               },
+               {
+                       left:     NewResource(),
+                       right:    NewResource(),
+                       total:    nil,
+                       expected: 0,
+                       message:  "empty resource with total nil",
+               },
+               {
+                       left:     NewResource(),
+                       right:    NewResource(),
+                       total:    NewResource(),
+                       expected: 0,
+                       message:  "empty resources",
+               },
+               {
+                       left:     &Resource{Resources: 
map[string]Quantity{"zero": 0}},
+                       right:    &Resource{Resources: 
map[string]Quantity{"zero": 0}},

Review Comment:
   Is there a particular reason why you directly create the type instead of 
calling `NewResourceXXX()`?



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