This is an automated email from the ASF dual-hosted git repository.
yuteng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-core.git
The following commit(s) were added to refs/heads/master by this push:
new 713e55ed [YUNIKORN-2644] Improve FitInScore funtion's test coverage
(#874)
713e55ed is described below
commit 713e55ed97cfed2e2b61d0534e417a5c4608b77f
Author: SP12893678 <[email protected]>
AuthorDate: Tue May 28 19:58:48 2024 +0800
[YUNIKORN-2644] Improve FitInScore funtion's test coverage (#874)
---
pkg/common/resources/resources_test.go | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/pkg/common/resources/resources_test.go
b/pkg/common/resources/resources_test.go
index 00076d54..a24d0f8a 100644
--- a/pkg/common/resources/resources_test.go
+++ b/pkg/common/resources/resources_test.go
@@ -1538,6 +1538,34 @@ func TestFitInScore(t *testing.T) {
expected: 0.0,
errorMessage: "FitInScore on resource with one quantity
failed",
},
+ {
+ message: "Resource with one quantity of negative
value",
+ receiver:
NewResourceFromMap(map[string]Quantity{"first": -10}),
+ fit:
NewResourceFromMap(map[string]Quantity{"first": 10}),
+ expected: 1,
+ errorMessage: "FitInScore on resource with one quantity
of negative value failed",
+ },
+ {
+ message: "Resource with multi quantity of negative
value",
+ receiver:
NewResourceFromMap(map[string]Quantity{"first": -10, "second": -5}),
+ fit:
NewResourceFromMap(map[string]Quantity{"first": 10, "second": 10}),
+ expected: 2,
+ errorMessage: "FitInScore on resource with multi
quantity of negative value failed",
+ },
+ {
+ message: "Fit quantity more than resource",
+ receiver:
NewResourceFromMap(map[string]Quantity{"first": 10}),
+ fit:
NewResourceFromMap(map[string]Quantity{"first": 20}),
+ expected: 0.5,
+ errorMessage: "FitInScore on fit quantity more than
resource failed",
+ },
+ {
+ message: "Multi fit quantity more than resource",
+ receiver:
NewResourceFromMap(map[string]Quantity{"first": 10, "second": 10}),
+ fit:
NewResourceFromMap(map[string]Quantity{"first": 20, "second": 20}),
+ expected: 1,
+ errorMessage: "FitInScore on multi fit quantity more
than resource failed",
+ },
}
for _, tc := range testCases {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]