mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #130125 from marosset/windows-unit-tests-kubelet-eviction-fixes
fixing k8s.io/kubernetes/pkg/kubelet/eviction unit tests on Windows
This commit is contained in:
commit
83b696c720
@ -19,6 +19,7 @@ package eviction
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
goruntime "runtime"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@ -189,6 +190,7 @@ func makeMemoryStats(nodeAvailableBytes string, podStats map[*v1.Pod]statsapi.Po
|
||||
WorkingSetBytes: &WorkingSetBytes,
|
||||
},
|
||||
SystemContainers: []statsapi.ContainerStats{
|
||||
// Used for memory signal observations on linux
|
||||
{
|
||||
Name: statsapi.SystemContainerPods,
|
||||
Memory: &statsapi.MemoryStats{
|
||||
@ -196,6 +198,14 @@ func makeMemoryStats(nodeAvailableBytes string, podStats map[*v1.Pod]statsapi.Po
|
||||
WorkingSetBytes: &WorkingSetBytes,
|
||||
},
|
||||
},
|
||||
// Used for memory signal observations on windows
|
||||
{
|
||||
Name: statsapi.SystemContainerWindowsGlobalCommitMemory,
|
||||
Memory: &statsapi.MemoryStats{
|
||||
AvailableBytes: &availableBytes,
|
||||
UsageBytes: &WorkingSetBytes,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Pods: []statsapi.PodStats{},
|
||||
@ -354,6 +364,9 @@ func TestMemoryPressure_VerifyPodStatus(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPIDPressure_VerifyPodStatus(t *testing.T) {
|
||||
if goruntime.GOOS == "windows" {
|
||||
t.Skip("PID pressure is not supported on Windows")
|
||||
}
|
||||
testCases := map[string]struct {
|
||||
wantPodStatus v1.PodStatus
|
||||
}{
|
||||
|
@ -31,6 +31,7 @@ func makeMemoryAvailableSignalObservation(summary *statsapi.Summary) *signalObse
|
||||
sysContainer, err := getSysContainer(summary.Node.SystemContainers, statsapi.SystemContainerWindowsGlobalCommitMemory)
|
||||
if err != nil {
|
||||
klog.ErrorS(err, "Eviction manager: failed to construct signal", "signal", evictionapi.SignalMemoryAvailable)
|
||||
return nil
|
||||
}
|
||||
if memory := sysContainer.Memory; memory != nil && memory.AvailableBytes != nil && memory.UsageBytes != nil {
|
||||
klog.V(4).InfoS(
|
||||
|
Loading…
Reference in New Issue
Block a user