From 561548e86c41e58ed93bf1511e9087dba46f9085 Mon Sep 17 00:00:00 2001 From: Claudiu Belu Date: Tue, 14 Mar 2023 10:22:27 +0000 Subject: [PATCH] unit tests: Fixes kuberuntime unittests for Windows InPlace Pod Vertical Scaling has been introduced as a feature recently, and with it new unit tests. The feature does not have Windows support yet, thus, the unit tests fail on Windows. Fixes unit test which checks Linux-specific fields on Windows. --- pkg/kubelet/kuberuntime/kuberuntime_container_test.go | 9 +++++++++ pkg/kubelet/kuberuntime/kuberuntime_manager_test.go | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/pkg/kubelet/kuberuntime/kuberuntime_container_test.go b/pkg/kubelet/kuberuntime/kuberuntime_container_test.go index b0cda9911da..4a263a50061 100644 --- a/pkg/kubelet/kuberuntime/kuberuntime_container_test.go +++ b/pkg/kubelet/kuberuntime/kuberuntime_container_test.go @@ -21,6 +21,7 @@ import ( "os" "path/filepath" "regexp" + goruntime "runtime" "strings" "testing" "time" @@ -234,6 +235,10 @@ func TestToKubeContainerStatus(t *testing.T) { // TestToKubeContainerStatusWithResources tests the converting the CRI container status to // the internal type (i.e., toKubeContainerStatus()) for containers that returns Resources. func TestToKubeContainerStatusWithResources(t *testing.T) { + // TODO: remove this check on this PR merges: https://github.com/kubernetes/kubernetes/pull/112599 + if goruntime.GOOS == "windows" { + t.Skip("Updating Pod Container Resources is not supported on Windows.") + } defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.InPlacePodVerticalScaling, true)() cid := &kubecontainer.ContainerID{Type: "testRuntime", ID: "dummyid"} meta := &runtimeapi.ContainerMetadata{Name: "cname", Attempt: 3} @@ -805,6 +810,10 @@ func TestKillContainerGracePeriod(t *testing.T) { // TestUpdateContainerResources tests updating a container in a Pod. func TestUpdateContainerResources(t *testing.T) { + // TODO: remove this check on this PR merges: https://github.com/kubernetes/kubernetes/pull/112599 + if goruntime.GOOS == "windows" { + t.Skip("Updating Pod Container Resources is not supported on Windows.") + } fakeRuntime, _, m, errCreate := createTestRuntimeManager() require.NoError(t, errCreate) pod := &v1.Pod{ diff --git a/pkg/kubelet/kuberuntime/kuberuntime_manager_test.go b/pkg/kubelet/kuberuntime/kuberuntime_manager_test.go index 0747ea91e0a..cb084f5a3f3 100644 --- a/pkg/kubelet/kuberuntime/kuberuntime_manager_test.go +++ b/pkg/kubelet/kuberuntime/kuberuntime_manager_test.go @@ -21,6 +21,7 @@ import ( "fmt" "path/filepath" "reflect" + goruntime "runtime" "sort" "testing" "time" @@ -1992,6 +1993,10 @@ func TestComputePodActionsForPodResize(t *testing.T) { } func TestUpdatePodContainerResources(t *testing.T) { + // TODO: remove this check on this PR merges: https://github.com/kubernetes/kubernetes/pull/112599 + if goruntime.GOOS == "windows" { + t.Skip("Updating Pod Container Resources is not supported on Windows.") + } defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.InPlacePodVerticalScaling, true)() fakeRuntime, _, m, err := createTestRuntimeManager() m.machineInfo.MemoryCapacity = 17179860387 // 16GB