mirror of
https://github.com/containers/podman.git
synced 2025-06-21 17:38:12 +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
|
package machine
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
//go:build (amd64 && !windows) || (arm64 && !windows)
|
||||||
|
// +build amd64,!windows arm64,!windows
|
||||||
|
|
||||||
package qemu
|
package qemu
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
//go:build (amd64 && !windows) || (arm64 && !windows)
|
||||||
|
// +build amd64,!windows arm64,!windows
|
||||||
|
|
||||||
package qemu
|
package qemu
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -810,8 +810,8 @@ func envVarValueResourceFieldRef(env v1.EnvVar, opts *CtrSpecGenOptions) (*strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// k8s rounds up the result to the nearest integer
|
// k8s rounds up the result to the nearest integer
|
||||||
intValue := int(math.Ceil(value.AsApproximateFloat64() / divisor.AsApproximateFloat64()))
|
intValue := int64(math.Ceil(value.AsApproximateFloat64() / divisor.AsApproximateFloat64()))
|
||||||
stringValue := strconv.Itoa(intValue)
|
stringValue := strconv.FormatInt(intValue, 10)
|
||||||
|
|
||||||
return &stringValue, nil
|
return &stringValue, nil
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package kube
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
|
||||||
"math"
|
"math"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -777,8 +776,7 @@ func TestEnvVarValue(t *testing.T) {
|
|||||||
if test.expected == nilString {
|
if test.expected == nilString {
|
||||||
assert.Nil(t, result)
|
assert.Nil(t, result)
|
||||||
} else {
|
} 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