mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Merge pull request #116575 from claudiubelu/fixes-kuberuntime-unittests
unit tests: Fixes kuberuntime unittests for Windows
This commit is contained in:
		@@ -21,6 +21,7 @@ import (
 | 
				
			|||||||
	"os"
 | 
						"os"
 | 
				
			||||||
	"path/filepath"
 | 
						"path/filepath"
 | 
				
			||||||
	"regexp"
 | 
						"regexp"
 | 
				
			||||||
 | 
						goruntime "runtime"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
	"testing"
 | 
						"testing"
 | 
				
			||||||
	"time"
 | 
						"time"
 | 
				
			||||||
@@ -234,6 +235,10 @@ func TestToKubeContainerStatus(t *testing.T) {
 | 
				
			|||||||
// TestToKubeContainerStatusWithResources tests the converting the CRI container status to
 | 
					// TestToKubeContainerStatusWithResources tests the converting the CRI container status to
 | 
				
			||||||
// the internal type (i.e., toKubeContainerStatus()) for containers that returns Resources.
 | 
					// the internal type (i.e., toKubeContainerStatus()) for containers that returns Resources.
 | 
				
			||||||
func TestToKubeContainerStatusWithResources(t *testing.T) {
 | 
					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)()
 | 
						defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.InPlacePodVerticalScaling, true)()
 | 
				
			||||||
	cid := &kubecontainer.ContainerID{Type: "testRuntime", ID: "dummyid"}
 | 
						cid := &kubecontainer.ContainerID{Type: "testRuntime", ID: "dummyid"}
 | 
				
			||||||
	meta := &runtimeapi.ContainerMetadata{Name: "cname", Attempt: 3}
 | 
						meta := &runtimeapi.ContainerMetadata{Name: "cname", Attempt: 3}
 | 
				
			||||||
@@ -805,6 +810,10 @@ func TestKillContainerGracePeriod(t *testing.T) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// TestUpdateContainerResources tests updating a container in a Pod.
 | 
					// TestUpdateContainerResources tests updating a container in a Pod.
 | 
				
			||||||
func TestUpdateContainerResources(t *testing.T) {
 | 
					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()
 | 
						fakeRuntime, _, m, errCreate := createTestRuntimeManager()
 | 
				
			||||||
	require.NoError(t, errCreate)
 | 
						require.NoError(t, errCreate)
 | 
				
			||||||
	pod := &v1.Pod{
 | 
						pod := &v1.Pod{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,6 +21,7 @@ import (
 | 
				
			|||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"path/filepath"
 | 
						"path/filepath"
 | 
				
			||||||
	"reflect"
 | 
						"reflect"
 | 
				
			||||||
 | 
						goruntime "runtime"
 | 
				
			||||||
	"sort"
 | 
						"sort"
 | 
				
			||||||
	"testing"
 | 
						"testing"
 | 
				
			||||||
	"time"
 | 
						"time"
 | 
				
			||||||
@@ -1993,6 +1994,10 @@ func TestComputePodActionsForPodResize(t *testing.T) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func TestUpdatePodContainerResources(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)()
 | 
						defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.InPlacePodVerticalScaling, true)()
 | 
				
			||||||
	fakeRuntime, _, m, err := createTestRuntimeManager()
 | 
						fakeRuntime, _, m, err := createTestRuntimeManager()
 | 
				
			||||||
	m.machineInfo.MemoryCapacity = 17179860387 // 16GB
 | 
						m.machineInfo.MemoryCapacity = 17179860387 // 16GB
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user