mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 18:00:08 +00:00
fixing k8s.io/kubernetes/pkg/kubelet/cm/memorymanager unit tests on Windows
Signed-off-by: Mark Rossetti <marosset@microsoft.com>
This commit is contained in:
parent
fbdf8905ea
commit
569eb41f23
@ -21,6 +21,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
goruntime "runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@ -1896,6 +1897,13 @@ func TestRemoveContainer(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getPolicyNameForOs() policyType {
|
||||||
|
if goruntime.GOOS == "windows" {
|
||||||
|
return policyTypeBestEffort
|
||||||
|
}
|
||||||
|
return policyTypeStatic
|
||||||
|
}
|
||||||
|
|
||||||
func TestNewManager(t *testing.T) {
|
func TestNewManager(t *testing.T) {
|
||||||
machineInfo := returnMachineInfo()
|
machineInfo := returnMachineInfo()
|
||||||
expectedReserved := systemReservedMemory{
|
expectedReserved := systemReservedMemory{
|
||||||
@ -1909,7 +1917,7 @@ func TestNewManager(t *testing.T) {
|
|||||||
testCases := []testMemoryManager{
|
testCases := []testMemoryManager{
|
||||||
{
|
{
|
||||||
description: "Successful creation of Memory Manager instance",
|
description: "Successful creation of Memory Manager instance",
|
||||||
policyName: policyTypeStatic,
|
policyName: getPolicyNameForOs(),
|
||||||
machineInfo: machineInfo,
|
machineInfo: machineInfo,
|
||||||
nodeAllocatableReservation: v1.ResourceList{v1.ResourceMemory: *resource.NewQuantity(2*gb, resource.BinarySI)},
|
nodeAllocatableReservation: v1.ResourceList{v1.ResourceMemory: *resource.NewQuantity(2*gb, resource.BinarySI)},
|
||||||
systemReservedMemory: []kubeletconfig.MemoryReservation{
|
systemReservedMemory: []kubeletconfig.MemoryReservation{
|
||||||
@ -1928,7 +1936,7 @@ func TestNewManager(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "Should return an error when systemReservedMemory (configured with kubelet flag) does not comply with Node Allocatable feature values",
|
description: "Should return an error when systemReservedMemory (configured with kubelet flag) does not comply with Node Allocatable feature values",
|
||||||
policyName: policyTypeStatic,
|
policyName: getPolicyNameForOs(),
|
||||||
machineInfo: machineInfo,
|
machineInfo: machineInfo,
|
||||||
nodeAllocatableReservation: v1.ResourceList{v1.ResourceMemory: *resource.NewQuantity(2*gb, resource.BinarySI)},
|
nodeAllocatableReservation: v1.ResourceList{v1.ResourceMemory: *resource.NewQuantity(2*gb, resource.BinarySI)},
|
||||||
systemReservedMemory: []kubeletconfig.MemoryReservation{
|
systemReservedMemory: []kubeletconfig.MemoryReservation{
|
||||||
@ -1951,7 +1959,7 @@ func TestNewManager(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "Should return an error when memory reserved for system is empty (systemReservedMemory)",
|
description: "Should return an error when memory reserved for system is empty (systemReservedMemory)",
|
||||||
policyName: policyTypeStatic,
|
policyName: getPolicyNameForOs(),
|
||||||
machineInfo: machineInfo,
|
machineInfo: machineInfo,
|
||||||
nodeAllocatableReservation: v1.ResourceList{},
|
nodeAllocatableReservation: v1.ResourceList{},
|
||||||
systemReservedMemory: []kubeletconfig.MemoryReservation{},
|
systemReservedMemory: []kubeletconfig.MemoryReservation{},
|
||||||
|
Loading…
Reference in New Issue
Block a user