Merge pull request #14823 from Luap99/debian-unit-tests

envVarValueResourceFieldRef: use int64 for value
This commit is contained in:
openshift-ci[bot]
2022-07-05 13:02:27 +00:00
committed by GitHub
5 changed files with 12 additions and 5 deletions

View File

@ -1,3 +1,6 @@
//go:build amd64 || arm64
// +build amd64 arm64
package machine
import (

View File

@ -1,3 +1,6 @@
//go:build (amd64 && !windows) || (arm64 && !windows)
// +build amd64,!windows arm64,!windows
package qemu
import (

View File

@ -1,3 +1,6 @@
//go:build (amd64 && !windows) || (arm64 && !windows)
// +build amd64,!windows arm64,!windows
package qemu
import (

View File

@ -810,8 +810,8 @@ func envVarValueResourceFieldRef(env v1.EnvVar, opts *CtrSpecGenOptions) (*strin
}
// k8s rounds up the result to the nearest integer
intValue := int(math.Ceil(value.AsApproximateFloat64() / divisor.AsApproximateFloat64()))
stringValue := strconv.Itoa(intValue)
intValue := int64(math.Ceil(value.AsApproximateFloat64() / divisor.AsApproximateFloat64()))
stringValue := strconv.FormatInt(intValue, 10)
return &stringValue, nil
}

View File

@ -2,7 +2,6 @@ package kube
import (
"encoding/json"
"fmt"
"math"
"runtime"
"strconv"
@ -777,8 +776,7 @@ func TestEnvVarValue(t *testing.T) {
if test.expected == nilString {
assert.Nil(t, result)
} else {
fmt.Println(*result, test.expected)
assert.Equal(t, &(test.expected), result)
assert.Equal(t, test.expected, *result)
}
})
}