[
https://issues.apache.org/jira/browse/YUNIKORN-1403?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17736683#comment-17736683
]
Simon Blessenohl commented on YUNIKORN-1403:
--------------------------------------------
I pushed the corresponding changes to the
[MR|https://github.com/apache/yunikorn-core/pull/555].
The issue with the tests is that if ARM and x86-64 return different values,
then we cannot write a test that asserts that a specific value is returned.
Such a test will fail on one of the platforms. To solve this issue, we have to
assert that the return value is the ARM value or the x86 value, or we assert
that it's what some expression evaluates to, where the expression is evaluated
in the test and its value therefore depends on the platform on which the tests
run.
In any case, if the tests on the branch fail on your ARM, I'd then change the
tests to something like
{code:java}
ExpectedResult := func(capacity int64, used int64) int64 {
return int64(float64(used) *100 / float64(capacity))
}
tests := map[string]struct { capacity, used, expected *Resource }{
...
"positive overflow": {
capacity: NewResourceFromMap(map[string]Quantity{"memory": 10}),
used: NewResourceFromMap(map[string]Quantity{"memory": math.MaxInt64}),
expected: NewResourceFromMap(map[string]Quantity{"memory":
Quantity(ExpectedResult(10, math.MaxInt64))}),
},
...
} {code}
> CalculateAbsUsedCapacity: overflow unit tests
> ---------------------------------------------
>
> Key: YUNIKORN-1403
> URL: https://issues.apache.org/jira/browse/YUNIKORN-1403
> Project: Apache YuniKorn
> Issue Type: Improvement
> Components: core - common, test - unit
> Reporter: Wilfred Spiegelenburg
> Assignee: Simon Blessenohl
> Priority: Major
> Labels: newbie, pull-request-available
>
> CalculateAbsUsedCapacity is guarded against positive and negative overflow.
> The postive case is unit tested. The negative case is not unit tested.
> Need to add a test case for te negative side:
> {code}
> // protect against negative integer overflow
> if absResValue > 0 && div < 0 {
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]