mirror of
https://github.com/containers/podman.git
synced 2025-06-20 17:13:43 +08:00
Merge pull request #14823 from Luap99/debian-unit-tests
envVarValueResourceFieldRef: use int64 for value
This commit is contained in:
@ -1,3 +1,6 @@
|
||||
//go:build amd64 || arm64
|
||||
// +build amd64 arm64
|
||||
|
||||
package machine
|
||||
|
||||
import (
|
||||
|
@ -1,3 +1,6 @@
|
||||
//go:build (amd64 && !windows) || (arm64 && !windows)
|
||||
// +build amd64,!windows arm64,!windows
|
||||
|
||||
package qemu
|
||||
|
||||
import (
|
||||
|
@ -1,3 +1,6 @@
|
||||
//go:build (amd64 && !windows) || (arm64 && !windows)
|
||||
// +build amd64,!windows arm64,!windows
|
||||
|
||||
package qemu
|
||||
|
||||
import (
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user