diff --git a/test/cri-containerd/container_downlevel_test.go b/test/cri-containerd/container_downlevel_test.go index 774ebdc653..46c618a638 100644 --- a/test/cri-containerd/container_downlevel_test.go +++ b/test/cri-containerd/container_downlevel_test.go @@ -16,16 +16,7 @@ func Test_CreateContainer_DownLevel_WCOW_Hypervisor(t *testing.T) { pullRequiredImages(t, []string{imageWindowsNanoserver17763}) - sandboxRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name() + "-Sandbox", - Uid: "0", - Namespace: testNamespace, - }, - }, - RuntimeHandler: wcowHypervisor17763RuntimeHandler, - } + sandboxRequest := getRunPodSandboxRequest(t, wcowHypervisor17763RuntimeHandler) request := &runtime.CreateContainerRequest{ Config: &runtime.ContainerConfig{ diff --git a/test/cri-containerd/container_network_test.go b/test/cri-containerd/container_network_test.go index e03e30e186..1be472f139 100644 --- a/test/cri-containerd/container_network_test.go +++ b/test/cri-containerd/container_network_test.go @@ -32,15 +32,7 @@ func Test_Container_Network_LCOW(t *testing.T) { }() log := filepath.Join(dir, "ping.txt") - sandboxRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name() + "-Sandbox", - Namespace: testNamespace, - }, - }, - RuntimeHandler: lcowRuntimeHandler, - } + sandboxRequest := getRunPodSandboxRequest(t, lcowRuntimeHandler) client := newTestRuntimeClient(t) ctx, cancel := context.WithCancel(context.Background()) @@ -145,16 +137,8 @@ func Test_Container_Network_Hostname(t *testing.T) { pullRequiredImages(t, []string{test.sandboxImage, test.containerImage}) } - sandboxRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name() + "-Sandbox", - Namespace: testNamespace, - }, - Hostname: "TestHost", - }, - RuntimeHandler: test.runtimeHandler, - } + sandboxRequest := getRunPodSandboxRequest(t, test.runtimeHandler) + sandboxRequest.Config.Hostname = "TestHost" client := newTestRuntimeClient(t) ctx, cancel := context.WithCancel(context.Background()) diff --git a/test/cri-containerd/container_test.go b/test/cri-containerd/container_test.go index d3e25c6842..1c3679b54d 100644 --- a/test/cri-containerd/container_test.go +++ b/test/cri-containerd/container_test.go @@ -80,15 +80,7 @@ func Test_RotateLogs_LCOW(t *testing.T) { pullRequiredLcowImages(t, []string{imageLcowK8sPause, image}) logrus.SetLevel(logrus.DebugLevel) - sandboxRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name() + "-Sandbox", - Namespace: testNamespace, - }, - }, - RuntimeHandler: lcowRuntimeHandler, - } + sandboxRequest := getRunPodSandboxRequest(t, lcowRuntimeHandler) request := &runtime.CreateContainerRequest{ Config: &runtime.ContainerConfig{ @@ -150,16 +142,7 @@ func Test_RunContainer_Events_LCOW(t *testing.T) { defer podcancel() targetNamespace := "k8s.io" - sandboxRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - }, - RuntimeHandler: lcowRuntimeHandler, - } + sandboxRequest := getRunPodSandboxRequest(t, lcowRuntimeHandler) podID := runPodSandbox(t, client, podctx, sandboxRequest) defer removePodSandbox(t, client, podctx, podID) @@ -228,15 +211,7 @@ func Test_RunContainer_ForksThenExits_ShowsAsExited_LCOW(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second) defer cancel() - podRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Namespace: testNamespace, - }, - }, - RuntimeHandler: lcowRuntimeHandler, - } + podRequest := getRunPodSandboxRequest(t, lcowRuntimeHandler) podID := runPodSandbox(t, client, ctx, podRequest) defer removePodSandbox(t, client, ctx, podID) defer stopPodSandbox(t, client, ctx, podID) @@ -288,18 +263,10 @@ func Test_RunContainer_ZeroVPMEM_LCOW(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - sandboxRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name() + "-Sandbox", - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.lcow.preferredrootfstype": "initrd", - "io.microsoft.virtualmachine.devices.virtualpmem.maximumcount": "0", - }, - }, - RuntimeHandler: lcowRuntimeHandler, + sandboxRequest := getRunPodSandboxRequest(t, lcowRuntimeHandler) + sandboxRequest.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.lcow.preferredrootfstype": "initrd", + "io.microsoft.virtualmachine.devices.virtualpmem.maximumcount": "0", } podID := runPodSandbox(t, client, ctx, sandboxRequest) @@ -335,18 +302,10 @@ func Test_RunContainer_ZeroVPMEM_Multiple_LCOW(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - sandboxRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name() + "-Sandbox", - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.lcow.preferredrootfstype": "initrd", - "io.microsoft.virtualmachine.devices.virtualpmem.maximumcount": "0", - }, - }, - RuntimeHandler: lcowRuntimeHandler, + sandboxRequest := getRunPodSandboxRequest(t, lcowRuntimeHandler) + sandboxRequest.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.lcow.preferredrootfstype": "initrd", + "io.microsoft.virtualmachine.devices.virtualpmem.maximumcount": "0", } podID := runPodSandbox(t, client, ctx, sandboxRequest) @@ -391,15 +350,7 @@ func Test_RunContainer_GMSA_WCOW_Process(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - sandboxRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name() + "-Sandbox", - Namespace: testNamespace, - }, - }, - RuntimeHandler: wcowProcessRuntimeHandler, - } + sandboxRequest := getRunPodSandboxRequest(t, wcowProcessRuntimeHandler) podID := runPodSandbox(t, client, ctx, sandboxRequest) defer removePodSandbox(t, client, ctx, podID) @@ -463,15 +414,7 @@ func Test_RunContainer_GMSA_WCOW_Hypervisor(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - sandboxRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name() + "-Sandbox", - Namespace: testNamespace, - }, - }, - RuntimeHandler: wcowHypervisorRuntimeHandler, - } + sandboxRequest := getRunPodSandboxRequest(t, wcowHypervisorRuntimeHandler) podID := runPodSandbox(t, client, ctx, sandboxRequest) defer removePodSandbox(t, client, ctx, podID) @@ -535,20 +478,11 @@ func Test_RunContainer_SandboxDevice_LCOW(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - sandboxRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name() + "-Sandbox", - Uid: "0", - Namespace: testNamespace, - }, - Linux: &runtime.LinuxPodSandboxConfig{ - SecurityContext: &runtime.LinuxSandboxSecurityContext{ - Privileged: true, - }, - }, + sandboxRequest := getRunPodSandboxRequest(t, lcowRuntimeHandler) + sandboxRequest.Config.Linux = &runtime.LinuxPodSandboxConfig{ + SecurityContext: &runtime.LinuxSandboxSecurityContext{ + Privileged: true, }, - RuntimeHandler: lcowRuntimeHandler, } podID := runPodSandbox(t, client, ctx, sandboxRequest) @@ -596,3 +530,67 @@ func Test_RunContainer_SandboxDevice_LCOW(t *testing.T) { t.Fatal("did not find expected device /dev/fuse in container") } } + +func Test_RunContainer_NonDefault_User(t *testing.T) { + requireFeatures(t, featureLCOW) + + type config struct { + containerSecCtx *runtime.LinuxContainerSecurityContext + name string + } + client := newTestRuntimeClient(t) + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + pullRequiredLcowImages(t, []string{imageLcowK8sPause, imageLcowAlpine}) + + podReq := getRunPodSandboxRequest(t, lcowRuntimeHandler) + podID := runPodSandbox(t, client, ctx, podReq) + defer removePodSandbox(t, client, ctx, podID) + defer stopPodSandbox(t, client, ctx, podID) + + tests := []config{ + { + containerSecCtx: &runtime.LinuxContainerSecurityContext{ + RunAsUsername: "guest", + }, + name: "RunAsUsername", + }, + { + containerSecCtx: &runtime.LinuxContainerSecurityContext{ + RunAsUser: &runtime.Int64Value{ + Value: 10001, + }, + }, + name: "RunAsUserUID", + }, + } + + for _, test := range tests { + t.Run(test.name, func(_ *testing.T) { + conReq := &runtime.CreateContainerRequest{ + Config: &runtime.ContainerConfig{ + Metadata: &runtime.ContainerMetadata{ + Name: t.Name() + "-Container", + }, + Image: &runtime.ImageSpec{ + Image: imageLcowAlpine, + }, + Command: []string{ + "top", + }, + Linux: &runtime.LinuxContainerConfig{ + SecurityContext: test.containerSecCtx, + }, + }, + PodSandboxId: podID, + SandboxConfig: podReq.Config, + } + + containerID := createContainer(t, client, ctx, conReq) + defer removeContainer(t, client, ctx, containerID) + startContainer(t, client, ctx, containerID) + defer stopContainer(t, client, ctx, containerID) + }) + } +} diff --git a/test/cri-containerd/container_virtual_device_test.go b/test/cri-containerd/container_virtual_device_test.go index c1ba40df55..b3c7ae4f3b 100644 --- a/test/cri-containerd/container_virtual_device_test.go +++ b/test/cri-containerd/container_virtual_device_test.go @@ -420,15 +420,7 @@ func Test_RunContainer_VirtualDevice_LocationPath_WCOW_Process(t *testing.T) { client := newTestRuntimeClient(t) podctx := context.Background() - sandboxRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Namespace: testNamespace, - }, - }, - RuntimeHandler: wcowProcessRuntimeHandler, - } + sandboxRequest := getRunPodSandboxRequest(t, wcowProcessRuntimeHandler) podID := runPodSandbox(t, client, podctx, sandboxRequest) defer removePodSandbox(t, client, podctx, podID) @@ -469,15 +461,7 @@ func Test_RunContainer_VirtualDevice_ClassGUID_WCOW_Process(t *testing.T) { client := newTestRuntimeClient(t) podctx := context.Background() - sandboxRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Namespace: testNamespace, - }, - }, - RuntimeHandler: wcowProcessRuntimeHandler, - } + sandboxRequest := getRunPodSandboxRequest(t, wcowProcessRuntimeHandler) podID := runPodSandbox(t, client, podctx, sandboxRequest) defer removePodSandbox(t, client, podctx, podID) @@ -518,17 +502,9 @@ func Test_RunContainer_VirtualDevice_GPU_WCOW_Hypervisor(t *testing.T) { client := newTestRuntimeClient(t) podctx := context.Background() - sandboxRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.fullyphysicallybacked": "true", - }, - }, - RuntimeHandler: wcowHypervisorRuntimeHandler, + sandboxRequest := getRunPodSandboxRequest(t, wcowHypervisorRuntimeHandler) + sandboxRequest.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.fullyphysicallybacked": "true", } podID := runPodSandbox(t, client, podctx, sandboxRequest) @@ -571,17 +547,9 @@ func Test_RunContainer_VirtualDevice_GPU_and_NoGPU_WCOW_Hypervisor(t *testing.T) client := newTestRuntimeClient(t) podctx := context.Background() - sandboxRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.fullyphysicallybacked": "true", - }, - }, - RuntimeHandler: wcowHypervisorRuntimeHandler, + sandboxRequest := getRunPodSandboxRequest(t, wcowHypervisorRuntimeHandler) + sandboxRequest.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.fullyphysicallybacked": "true", } podID := runPodSandbox(t, client, podctx, sandboxRequest) @@ -641,17 +609,9 @@ func Test_RunContainer_VirtualDevice_GPU_Multiple_WCOW_Hypervisor(t *testing.T) client := newTestRuntimeClient(t) podctx := context.Background() - sandboxRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.fullyphysicallybacked": "true", - }, - }, - RuntimeHandler: wcowHypervisorRuntimeHandler, + sandboxRequest := getRunPodSandboxRequest(t, wcowHypervisorRuntimeHandler) + sandboxRequest.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.fullyphysicallybacked": "true", } podID := runPodSandbox(t, client, podctx, sandboxRequest) @@ -701,17 +661,9 @@ func Test_RunContainer_VirtualDevice_GPU_Multiple_Removal_WCOW_Hypervisor(t *tes client := newTestRuntimeClient(t) podctx := context.Background() - sandboxRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.fullyphysicallybacked": "true", - }, - }, - RuntimeHandler: wcowHypervisorRuntimeHandler, + sandboxRequest := getRunPodSandboxRequest(t, wcowHypervisorRuntimeHandler) + sandboxRequest.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.fullyphysicallybacked": "true", } podID := runPodSandbox(t, client, podctx, sandboxRequest) diff --git a/test/cri-containerd/createcontainer_test.go b/test/cri-containerd/createcontainer_test.go index a980d9092b..76bd6cfe68 100644 --- a/test/cri-containerd/createcontainer_test.go +++ b/test/cri-containerd/createcontainer_test.go @@ -17,16 +17,7 @@ import ( ) func runCreateContainerTest(t *testing.T, runtimeHandler string, request *runtime.CreateContainerRequest) { - sandboxRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name() + "-Sandbox", - Uid: "0", - Namespace: testNamespace, - }, - }, - RuntimeHandler: runtimeHandler, - } + sandboxRequest := getRunPodSandboxRequest(t, runtimeHandler) runCreateContainerTestWithSandbox(t, sandboxRequest, request) } @@ -197,20 +188,11 @@ func Test_CreateContainer_LCOW_Privileged(t *testing.T) { pullRequiredLcowImages(t, []string{imageLcowK8sPause, imageLcowAlpine}) - sandboxRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name() + "-Sandbox", - Uid: "0", - Namespace: testNamespace, - }, - Linux: &runtime.LinuxPodSandboxConfig{ - SecurityContext: &runtime.LinuxSandboxSecurityContext{ - Privileged: true, - }, - }, + sandboxRequest := getRunPodSandboxRequest(t, lcowRuntimeHandler) + sandboxRequest.Config.Linux = &runtime.LinuxPodSandboxConfig{ + SecurityContext: &runtime.LinuxSandboxSecurityContext{ + Privileged: true, }, - RuntimeHandler: lcowRuntimeHandler, } request := &runtime.CreateContainerRequest{ @@ -240,20 +222,11 @@ func Test_CreateContainer_SandboxDevice_LCOW(t *testing.T) { pullRequiredLcowImages(t, []string{imageLcowK8sPause, imageLcowAlpine}) - sandboxRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name() + "-Sandbox", - Uid: "0", - Namespace: testNamespace, - }, - Linux: &runtime.LinuxPodSandboxConfig{ - SecurityContext: &runtime.LinuxSandboxSecurityContext{ - Privileged: true, - }, - }, + sandboxRequest := getRunPodSandboxRequest(t, lcowRuntimeHandler) + sandboxRequest.Config.Linux = &runtime.LinuxPodSandboxConfig{ + SecurityContext: &runtime.LinuxSandboxSecurityContext{ + Privileged: true, }, - RuntimeHandler: lcowRuntimeHandler, } request := &runtime.CreateContainerRequest{ @@ -1254,15 +1227,7 @@ func Test_Mount_ReadOnlyDirReuse_WCOW(t *testing.T) { } defer os.RemoveAll(tempDir) - sandboxRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name() + "-Sandbox", - Namespace: testNamespace, - }, - }, - RuntimeHandler: wcowHypervisorRuntimeHandler, - } + sandboxRequest := getRunPodSandboxRequest(t, wcowHypervisorRuntimeHandler) podID := runPodSandbox(t, client, ctx, sandboxRequest) defer removePodSandbox(t, client, ctx, podID) diff --git a/test/cri-containerd/execcontainer_test.go b/test/cri-containerd/execcontainer_test.go index 1f183ddfe4..ff2eb73e0d 100644 --- a/test/cri-containerd/execcontainer_test.go +++ b/test/cri-containerd/execcontainer_test.go @@ -36,24 +36,15 @@ func runexecContainerTestWithSandbox(t *testing.T, sandboxRequest *runtime.RunPo func execContainerLCOW(t *testing.T, uid int64, cmd []string) *runtime.ExecSyncResponse { pullRequiredLcowImages(t, []string{imageLcowK8sPause, imageLcowCosmos}) - //run podsandbox request - sandboxRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name() + "-Sandbox2", - Uid: "0", - Namespace: testNamespace, - }, - Linux: &runtime.LinuxPodSandboxConfig{ - SecurityContext: &runtime.LinuxSandboxSecurityContext{ - Privileged: true, - }, - }, + // run podsandbox request + sandboxRequest := getRunPodSandboxRequest(t, lcowRuntimeHandler) + sandboxRequest.Config.Linux = &runtime.LinuxPodSandboxConfig{ + SecurityContext: &runtime.LinuxSandboxSecurityContext{ + Privileged: true, }, - RuntimeHandler: lcowRuntimeHandler, } - //create container request + // create container request request := &runtime.CreateContainerRequest{ Config: &runtime.ContainerConfig{ Metadata: &runtime.ContainerMetadata{ diff --git a/test/cri-containerd/pullimage_test.go b/test/cri-containerd/pullimage_test.go index ea5b715c3a..de5a817fd9 100644 --- a/test/cri-containerd/pullimage_test.go +++ b/test/cri-containerd/pullimage_test.go @@ -7,8 +7,6 @@ import ( "strings" "testing" "time" - - runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2" ) const ( @@ -46,16 +44,7 @@ func Test_PullImageTimestamps(t *testing.T) { pullRequiredImages(t, []string{imageWindowsNanoserverTestImage}) defer removeImages(t, []string{imageWindowsNanoserverTestImage}) - sandboxRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - }, - RuntimeHandler: wcowHypervisor18362RuntimeHandler, - } + sandboxRequest := getRunPodSandboxRequest(t, wcowHypervisor18362RuntimeHandler) podID := runPodSandbox(t, client, ctx, sandboxRequest) defer removePodSandbox(t, client, ctx, podID) diff --git a/test/cri-containerd/removepodsandbox_test.go b/test/cri-containerd/removepodsandbox_test.go index 7d8276ad1d..d9cbaf56c5 100644 --- a/test/cri-containerd/removepodsandbox_test.go +++ b/test/cri-containerd/removepodsandbox_test.go @@ -43,7 +43,7 @@ func runPodSandboxTestWithoutPodStop(t *testing.T, request *runtime.RunPodSandbo // Utility function to start sandbox with one container and make sure that sandbox is removed in the end func runPodWithContainer(t *testing.T, client runtime.RuntimeServiceClient, ctx context.Context, tc *TestConfig) (string, string) { request := getRunPodSandboxRequest(t, tc.runtimeHandler) - podID := runPodSandbox(t, client, ctx, &request) + podID := runPodSandbox(t, client, ctx, request) defer removePodSandbox(t, client, ctx, podID) containerID := createContainerInSandbox(t, client, ctx, podID, tc.containerName, tc.containerImage, tc.cmd, nil, nil, request.Config) @@ -113,7 +113,7 @@ func Test_RunPodSandbox_Without_Sandbox_Stop(t *testing.T) { } request := getRunPodSandboxRequest(t, test.runtimeHandler) - runPodSandboxTestWithoutPodStop(t, &request) + runPodSandboxTestWithoutPodStop(t, request) }) } } diff --git a/test/cri-containerd/runpodsandbox_test.go b/test/cri-containerd/runpodsandbox_test.go index d9eab6260e..695eaff31b 100644 --- a/test/cri-containerd/runpodsandbox_test.go +++ b/test/cri-containerd/runpodsandbox_test.go @@ -36,16 +36,7 @@ func Test_RunPodSandbox_WCOW_Process(t *testing.T) { pullRequiredImages(t, []string{imageWindowsNanoserver}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - }, - RuntimeHandler: wcowProcessRuntimeHandler, - } + request := getRunPodSandboxRequest(t, wcowProcessRuntimeHandler) runPodSandboxTest(t, request) } @@ -54,16 +45,7 @@ func Test_RunPodSandbox_WCOW_Hypervisor(t *testing.T) { pullRequiredImages(t, []string{imageWindowsNanoserver}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - }, - RuntimeHandler: wcowHypervisorRuntimeHandler, - } + request := getRunPodSandboxRequest(t, wcowHypervisorRuntimeHandler) runPodSandboxTest(t, request) } @@ -72,18 +54,9 @@ func Test_RunPodSandbox_WCOW_Hypervisor_WithoutExternalBridge(t *testing.T) { pullRequiredImages(t, []string{imageWindowsNanoserver}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.useexternalgcsbridge": "false", - }, - }, - RuntimeHandler: wcowHypervisorRuntimeHandler, + request := getRunPodSandboxRequest(t, wcowHypervisorRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.useexternalgcsbridge": "false", } runPodSandboxTest(t, request) } @@ -93,16 +66,7 @@ func Test_RunPodSandbox_LCOW(t *testing.T) { pullRequiredLcowImages(t, []string{imageLcowK8sPause}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - }, - RuntimeHandler: lcowRuntimeHandler, - } + request := getRunPodSandboxRequest(t, lcowRuntimeHandler) runPodSandboxTest(t, request) } @@ -117,16 +81,7 @@ func Test_RunPodSandbox_Events_LCOW(t *testing.T) { pullRequiredLcowImages(t, []string{imageLcowK8sPause}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - }, - RuntimeHandler: lcowRuntimeHandler, - } + request := getRunPodSandboxRequest(t, lcowRuntimeHandler) topicNames, filters := getTargetRunTopics() targetNamespace := "k8s.io" @@ -171,18 +126,9 @@ func Test_RunPodSandbox_VirtualMemory_WCOW_Hypervisor(t *testing.T) { pullRequiredImages(t, []string{imageWindowsNanoserver}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.computetopology.memory.allowovercommit": "true", - }, - }, - RuntimeHandler: wcowHypervisorRuntimeHandler, + request := getRunPodSandboxRequest(t, wcowHypervisorRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.computetopology.memory.allowovercommit": "true", } runPodSandboxTest(t, request) } @@ -192,18 +138,9 @@ func Test_RunPodSandbox_VirtualMemory_LCOW(t *testing.T) { pullRequiredLcowImages(t, []string{imageLcowK8sPause}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.computetopology.memory.allowovercommit": "true", - }, - }, - RuntimeHandler: lcowRuntimeHandler, + request := getRunPodSandboxRequest(t, lcowRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.computetopology.memory.allowovercommit": "true", } runPodSandboxTest(t, request) } @@ -213,19 +150,10 @@ func Test_RunPodSandbox_VirtualMemory_DeferredCommit_WCOW_Hypervisor(t *testing. pullRequiredImages(t, []string{imageWindowsNanoserver}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.computetopology.memory.allowovercommit": "true", - "io.microsoft.virtualmachine.computetopology.memory.enabledeferredcommit": "true", - }, - }, - RuntimeHandler: wcowHypervisorRuntimeHandler, + request := getRunPodSandboxRequest(t, wcowHypervisorRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.computetopology.memory.allowovercommit": "true", + "io.microsoft.virtualmachine.computetopology.memory.enabledeferredcommit": "true", } runPodSandboxTest(t, request) } @@ -235,19 +163,10 @@ func Test_RunPodSandbox_VirtualMemory_DeferredCommit_LCOW(t *testing.T) { pullRequiredLcowImages(t, []string{imageLcowK8sPause}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.computetopology.memory.allowovercommit": "true", - "io.microsoft.virtualmachine.computetopology.memory.enabledeferredcommit": "true", - }, - }, - RuntimeHandler: lcowRuntimeHandler, + request := getRunPodSandboxRequest(t, lcowRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.computetopology.memory.allowovercommit": "true", + "io.microsoft.virtualmachine.computetopology.memory.enabledeferredcommit": "true", } runPodSandboxTest(t, request) } @@ -257,18 +176,9 @@ func Test_RunPodSandbox_PhysicalMemory_WCOW_Hypervisor(t *testing.T) { pullRequiredImages(t, []string{imageWindowsNanoserver}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.computetopology.memory.allowovercommit": "false", - }, - }, - RuntimeHandler: wcowHypervisorRuntimeHandler, + request := getRunPodSandboxRequest(t, wcowHypervisorRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.computetopology.memory.allowovercommit": "false", } runPodSandboxTest(t, request) } @@ -278,17 +188,9 @@ func Test_RunPodSandbox_FullyPhysicallyBacked_WCOW_Hypervisor(t *testing.T) { pullRequiredImages(t, []string{imageWindowsNanoserver}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.fullyphysicallybacked": "true", - }, - }, - RuntimeHandler: wcowHypervisorRuntimeHandler, + request := getRunPodSandboxRequest(t, wcowHypervisorRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.fullyphysicallybacked": "true", } runPodSandboxTest(t, request) } @@ -298,18 +200,9 @@ func Test_RunPodSandbox_PhysicalMemory_LCOW(t *testing.T) { pullRequiredLcowImages(t, []string{imageLcowK8sPause}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.computetopology.memory.allowovercommit": "false", - }, - }, - RuntimeHandler: lcowRuntimeHandler, + request := getRunPodSandboxRequest(t, lcowRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.computetopology.memory.allowovercommit": "false", } runPodSandboxTest(t, request) } @@ -319,17 +212,9 @@ func Test_RunPodSandbox_FullyPhysicallyBacked_LCOW(t *testing.T) { pullRequiredLcowImages(t, []string{imageLcowK8sPause}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.fullyphysicallybacked": "true", - }, - }, - RuntimeHandler: lcowRuntimeHandler, + request := getRunPodSandboxRequest(t, lcowRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.fullyphysicallybacked": "true", } runPodSandboxTest(t, request) } @@ -339,18 +224,9 @@ func Test_RunPodSandbox_MemorySize_WCOW_Process(t *testing.T) { pullRequiredImages(t, []string{imageWindowsNanoserver}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.container.memory.sizeinmb": "128", - }, - }, - RuntimeHandler: wcowProcessRuntimeHandler, + request := getRunPodSandboxRequest(t, wcowProcessRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.container.memory.sizeinmb": "128", } runPodSandboxTest(t, request) } @@ -360,18 +236,9 @@ func Test_RunPodSandbox_MemorySize_WCOW_Hypervisor(t *testing.T) { pullRequiredImages(t, []string{imageWindowsNanoserver}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.computetopology.memory.sizeinmb": "768", // 128 is too small for WCOW. It is really slow boot. - }, - }, - RuntimeHandler: wcowHypervisorRuntimeHandler, + request := getRunPodSandboxRequest(t, wcowHypervisorRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.computetopology.memory.sizeinmb": "768", // 128 is too small for WCOW. It is really slow boot. } runPodSandboxTest(t, request) } @@ -381,18 +248,9 @@ func Test_RunPodSandbox_MemorySize_LCOW(t *testing.T) { pullRequiredLcowImages(t, []string{imageLcowK8sPause}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.computetopology.memory.sizeinmb": "200", - }, - }, - RuntimeHandler: lcowRuntimeHandler, + request := getRunPodSandboxRequest(t, lcowRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.computetopology.memory.sizeinmb": "200", } runPodSandboxTest(t, request) } @@ -405,19 +263,11 @@ func Test_RunPodSandbox_MMIO_WCOW_Process(t *testing.T) { } pullRequiredImages(t, []string{imageWindowsNanoserver}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.computetopology.memory.lowmmiogapinmb": "100", - "io.microsoft.virtualmachine.computetopology.memory.highmmiobaseinmb": "100", - "io.microsoft.virtualmachine.computetopology.memory.highmmiogapinmb": "100", - }, - }, - RuntimeHandler: wcowProcessRuntimeHandler, + request := getRunPodSandboxRequest(t, wcowProcessRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.computetopology.memory.lowmmiogapinmb": "100", + "io.microsoft.virtualmachine.computetopology.memory.highmmiobaseinmb": "100", + "io.microsoft.virtualmachine.computetopology.memory.highmmiogapinmb": "100", } runPodSandboxTest(t, request) } @@ -430,19 +280,11 @@ func Test_RunPodSandbox_MMIO_WCOW_Hypervisor(t *testing.T) { } pullRequiredImages(t, []string{imageWindowsNanoserver}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.computetopology.memory.lowmmiogapinmb": "100", - "io.microsoft.virtualmachine.computetopology.memory.highmmiobaseinmb": "100", - "io.microsoft.virtualmachine.computetopology.memory.highmmiogapinmb": "100", - }, - }, - RuntimeHandler: wcowHypervisorRuntimeHandler, + request := getRunPodSandboxRequest(t, wcowHypervisorRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.computetopology.memory.lowmmiogapinmb": "100", + "io.microsoft.virtualmachine.computetopology.memory.highmmiobaseinmb": "100", + "io.microsoft.virtualmachine.computetopology.memory.highmmiogapinmb": "100", } runPodSandboxTest(t, request) } @@ -455,19 +297,11 @@ func Test_RunPodSandbox_MMIO_LCOW(t *testing.T) { } pullRequiredLcowImages(t, []string{imageLcowK8sPause}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.computetopology.memory.lowmmiogapinmb": "100", - "io.microsoft.virtualmachine.computetopology.memory.highmmiobaseinmb": "100", - "io.microsoft.virtualmachine.computetopology.memory.highmmiogapinmb": "100", - }, - }, - RuntimeHandler: lcowRuntimeHandler, + request := getRunPodSandboxRequest(t, lcowRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.computetopology.memory.lowmmiogapinmb": "100", + "io.microsoft.virtualmachine.computetopology.memory.highmmiobaseinmb": "100", + "io.microsoft.virtualmachine.computetopology.memory.highmmiogapinmb": "100", } runPodSandboxTest(t, request) } @@ -477,18 +311,9 @@ func Test_RunPodSandbox_CPUCount_WCOW_Process(t *testing.T) { pullRequiredImages(t, []string{imageWindowsNanoserver}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.container.processor.count": "1", - }, - }, - RuntimeHandler: wcowProcessRuntimeHandler, + request := getRunPodSandboxRequest(t, wcowProcessRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.container.processor.count": "1", } runPodSandboxTest(t, request) } @@ -498,18 +323,9 @@ func Test_RunPodSandbox_CPUCount_WCOW_Hypervisor(t *testing.T) { pullRequiredImages(t, []string{imageWindowsNanoserver}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.computetopology.processor.count": "1", - }, - }, - RuntimeHandler: wcowHypervisorRuntimeHandler, + request := getRunPodSandboxRequest(t, wcowHypervisorRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.computetopology.processor.count": "1", } runPodSandboxTest(t, request) } @@ -519,18 +335,9 @@ func Test_RunPodSandbox_CPUCount_LCOW(t *testing.T) { pullRequiredLcowImages(t, []string{imageLcowK8sPause}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.computetopology.processor.count": "1", - }, - }, - RuntimeHandler: lcowRuntimeHandler, + request := getRunPodSandboxRequest(t, lcowRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.computetopology.processor.count": "1", } runPodSandboxTest(t, request) } @@ -540,18 +347,9 @@ func Test_RunPodSandbox_CPULimit_WCOW_Process(t *testing.T) { pullRequiredImages(t, []string{imageWindowsNanoserver}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.container.processor.limit": "9000", - }, - }, - RuntimeHandler: wcowProcessRuntimeHandler, + request := getRunPodSandboxRequest(t, wcowProcessRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.container.processor.limit": "9000", } runPodSandboxTest(t, request) } @@ -561,18 +359,9 @@ func Test_RunPodSandbox_CPULimit_WCOW_Hypervisor(t *testing.T) { pullRequiredImages(t, []string{imageWindowsNanoserver}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.computetopology.processor.limit": "90000", - }, - }, - RuntimeHandler: wcowHypervisorRuntimeHandler, + request := getRunPodSandboxRequest(t, wcowHypervisorRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.computetopology.processor.limit": "90000", } runPodSandboxTest(t, request) } @@ -582,18 +371,9 @@ func Test_RunPodSandbox_CPULimit_LCOW(t *testing.T) { pullRequiredLcowImages(t, []string{imageLcowK8sPause}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.computetopology.processor.limit": "90000", - }, - }, - RuntimeHandler: lcowRuntimeHandler, + request := getRunPodSandboxRequest(t, lcowRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.computetopology.processor.limit": "90000", } runPodSandboxTest(t, request) } @@ -603,18 +383,9 @@ func Test_RunPodSandbox_CPUWeight_WCOW_Process(t *testing.T) { pullRequiredImages(t, []string{imageWindowsNanoserver}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.container.processor.weight": "500", - }, - }, - RuntimeHandler: wcowProcessRuntimeHandler, + request := getRunPodSandboxRequest(t, wcowProcessRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.container.processor.weight": "500", } runPodSandboxTest(t, request) } @@ -624,18 +395,9 @@ func Test_RunPodSandbox_CPUWeight_WCOW_Hypervisor(t *testing.T) { pullRequiredImages(t, []string{imageWindowsNanoserver}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.computetopology.processor.weight": "500", - }, - }, - RuntimeHandler: wcowHypervisorRuntimeHandler, + request := getRunPodSandboxRequest(t, wcowHypervisorRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.computetopology.processor.weight": "500", } runPodSandboxTest(t, request) } @@ -645,18 +407,9 @@ func Test_RunPodSandbox_CPUWeight_LCOW(t *testing.T) { pullRequiredLcowImages(t, []string{imageLcowK8sPause}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.computetopology.processor.weight": "500", - }, - }, - RuntimeHandler: lcowRuntimeHandler, + request := getRunPodSandboxRequest(t, lcowRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.computetopology.processor.weight": "500", } runPodSandboxTest(t, request) } @@ -666,18 +419,9 @@ func Test_RunPodSandbox_StorageQoSBandwithMax_WCOW_Process(t *testing.T) { pullRequiredImages(t, []string{imageWindowsNanoserver}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.container.storage.qos.bandwidthmaximum": fmt.Sprintf("%d", 1024*1024), // 1MB/s - }, - }, - RuntimeHandler: wcowProcessRuntimeHandler, + request := getRunPodSandboxRequest(t, wcowProcessRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.container.storage.qos.bandwidthmaximum": fmt.Sprintf("%d", 1024*1024), // 1MB/s } runPodSandboxTest(t, request) } @@ -687,18 +431,9 @@ func Test_RunPodSandbox_StorageQoSBandwithMax_WCOW_Hypervisor(t *testing.T) { pullRequiredImages(t, []string{imageWindowsNanoserver}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.storageqos.bandwidthmaximum": fmt.Sprintf("%d", 1024*1024), // 1MB/s - }, - }, - RuntimeHandler: wcowHypervisorRuntimeHandler, + request := getRunPodSandboxRequest(t, wcowHypervisorRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.storageqos.bandwidthmaximum": fmt.Sprintf("%d", 1024*1024), // 1MB/s } runPodSandboxTest(t, request) } @@ -708,18 +443,9 @@ func Test_RunPodSandbox_StorageQoSBandwithMax_LCOW(t *testing.T) { pullRequiredLcowImages(t, []string{imageLcowK8sPause}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.storageqos.bandwidthmaximum": fmt.Sprintf("%d", 1024*1024), // 1MB/s - }, - }, - RuntimeHandler: lcowRuntimeHandler, + request := getRunPodSandboxRequest(t, lcowRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.storageqos.bandwidthmaximum": fmt.Sprintf("%d", 1024*1024), // 1MB/s } runPodSandboxTest(t, request) } @@ -729,18 +455,9 @@ func Test_RunPodSandbox_StorageQoSIopsMax_WCOW_Process(t *testing.T) { pullRequiredImages(t, []string{imageWindowsNanoserver}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.container.storage.qos.iopsmaximum": "300", - }, - }, - RuntimeHandler: wcowProcessRuntimeHandler, + request := getRunPodSandboxRequest(t, wcowProcessRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.container.storage.qos.iopsmaximum": "300", } runPodSandboxTest(t, request) } @@ -750,18 +467,9 @@ func Test_RunPodSandbox_StorageQoSIopsMax_WCOW_Hypervisor(t *testing.T) { pullRequiredImages(t, []string{imageWindowsNanoserver}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.storageqos.iopsmaximum": "300", - }, - }, - RuntimeHandler: wcowHypervisorRuntimeHandler, + request := getRunPodSandboxRequest(t, wcowHypervisorRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.storageqos.iopsmaximum": "300", } runPodSandboxTest(t, request) } @@ -771,18 +479,9 @@ func Test_RunPodSandbox_StorageQoSIopsMax_LCOW(t *testing.T) { pullRequiredLcowImages(t, []string{imageLcowK8sPause}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.storageqos.iopsmaximum": "300", - }, - }, - RuntimeHandler: lcowRuntimeHandler, + request := getRunPodSandboxRequest(t, lcowRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.storageqos.iopsmaximum": "300", } runPodSandboxTest(t, request) } @@ -792,18 +491,9 @@ func Test_RunPodSandbox_InitrdBoot_LCOW(t *testing.T) { pullRequiredLcowImages(t, []string{imageLcowK8sPause}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.lcow.preferredrootfstype": "initrd", - }, - }, - RuntimeHandler: lcowRuntimeHandler, + request := getRunPodSandboxRequest(t, lcowRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.lcow.preferredrootfstype": "initrd", } runPodSandboxTest(t, request) } @@ -813,18 +503,9 @@ func Test_RunPodSandbox_RootfsVhdBoot_LCOW(t *testing.T) { pullRequiredLcowImages(t, []string{imageLcowK8sPause}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.lcow.preferredrootfstype": "vhd", - }, - }, - RuntimeHandler: lcowRuntimeHandler, + request := getRunPodSandboxRequest(t, lcowRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.lcow.preferredrootfstype": "vhd", } runPodSandboxTest(t, request) } @@ -834,17 +515,9 @@ func Test_RunPodSandbox_VPCIEnabled_LCOW(t *testing.T) { pullRequiredLcowImages(t, []string{imageLcowK8sPause}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.lcow.vpcienabled": "true", - }, - }, - RuntimeHandler: lcowRuntimeHandler, + request := getRunPodSandboxRequest(t, lcowRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.lcow.vpcienabled": "true", } runPodSandboxTest(t, request) } @@ -854,17 +527,9 @@ func Test_RunPodSandbox_UEFIBoot_LCOW(t *testing.T) { pullRequiredLcowImages(t, []string{imageLcowK8sPause}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.lcow.kerneldirectboot": "false", - }, - }, - RuntimeHandler: lcowRuntimeHandler, + request := getRunPodSandboxRequest(t, lcowRuntimeHandler) + request.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.lcow.kerneldirectboot": "false", } runPodSandboxTest(t, request) } @@ -874,18 +539,9 @@ func Test_RunPodSandbox_DnsConfig_WCOW_Process(t *testing.T) { pullRequiredImages(t, []string{imageWindowsNanoserver}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - DnsConfig: &runtime.DNSConfig{ - Searches: []string{"8.8.8.8", "8.8.4.4"}, - }, - }, - RuntimeHandler: wcowProcessRuntimeHandler, + request := getRunPodSandboxRequest(t, wcowProcessRuntimeHandler) + request.Config.DnsConfig = &runtime.DNSConfig{ + Searches: []string{"8.8.8.8", "8.8.4.4"}, } runPodSandboxTest(t, request) // TODO: JTERRY75 - This is just a boot test at present. We need to create a @@ -898,18 +554,9 @@ func Test_RunPodSandbox_DnsConfig_WCOW_Hypervisor(t *testing.T) { pullRequiredImages(t, []string{imageWindowsNanoserver}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - DnsConfig: &runtime.DNSConfig{ - Searches: []string{"8.8.8.8", "8.8.4.4"}, - }, - }, - RuntimeHandler: wcowHypervisorRuntimeHandler, + request := getRunPodSandboxRequest(t, wcowHypervisorRuntimeHandler) + request.Config.DnsConfig = &runtime.DNSConfig{ + Searches: []string{"8.8.8.8", "8.8.4.4"}, } runPodSandboxTest(t, request) // TODO: JTERRY75 - This is just a boot test at present. We need to create a @@ -922,18 +569,9 @@ func Test_RunPodSandbox_DnsConfig_LCOW(t *testing.T) { pullRequiredLcowImages(t, []string{imageLcowK8sPause}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - DnsConfig: &runtime.DNSConfig{ - Searches: []string{"8.8.8.8", "8.8.4.4"}, - }, - }, - RuntimeHandler: lcowRuntimeHandler, + request := getRunPodSandboxRequest(t, lcowRuntimeHandler) + request.Config.DnsConfig = &runtime.DNSConfig{ + Searches: []string{"8.8.8.8", "8.8.4.4"}, } runPodSandboxTest(t, request) // TODO: JTERRY75 - This is just a boot test at present. We need to create a @@ -946,22 +584,13 @@ func Test_RunPodSandbox_PortMappings_WCOW_Process(t *testing.T) { pullRequiredImages(t, []string{imageWindowsNanoserver}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - PortMappings: []*runtime.PortMapping{ - { - Protocol: runtime.Protocol_TCP, - ContainerPort: 80, - HostPort: 8080, - }, - }, + request := getRunPodSandboxRequest(t, wcowProcessRuntimeHandler) + request.Config.PortMappings = []*runtime.PortMapping{ + { + Protocol: runtime.Protocol_TCP, + ContainerPort: 80, + HostPort: 8080, }, - RuntimeHandler: wcowProcessRuntimeHandler, } runPodSandboxTest(t, request) } @@ -971,22 +600,13 @@ func Test_RunPodSandbox_PortMappings_WCOW_Hypervisor(t *testing.T) { pullRequiredImages(t, []string{imageWindowsNanoserver}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - PortMappings: []*runtime.PortMapping{ - { - Protocol: runtime.Protocol_TCP, - ContainerPort: 80, - HostPort: 8080, - }, - }, + request := getRunPodSandboxRequest(t, wcowHypervisorRuntimeHandler) + request.Config.PortMappings = []*runtime.PortMapping{ + { + Protocol: runtime.Protocol_TCP, + ContainerPort: 80, + HostPort: 8080, }, - RuntimeHandler: wcowHypervisorRuntimeHandler, } runPodSandboxTest(t, request) } @@ -996,22 +616,13 @@ func Test_RunPodSandbox_PortMappings_LCOW(t *testing.T) { pullRequiredLcowImages(t, []string{imageLcowK8sPause}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - PortMappings: []*runtime.PortMapping{ - { - Protocol: runtime.Protocol_TCP, - ContainerPort: 80, - HostPort: 8080, - }, - }, + request := getRunPodSandboxRequest(t, lcowRuntimeHandler) + request.Config.PortMappings = []*runtime.PortMapping{ + { + Protocol: runtime.Protocol_TCP, + ContainerPort: 80, + HostPort: 8080, }, - RuntimeHandler: lcowRuntimeHandler, } runPodSandboxTest(t, request) } @@ -1177,17 +788,8 @@ func Test_RunPodSandbox_MultipleContainersSameVhd_LCOW(t *testing.T) { }, } - sbRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - Annotations: annotations, - }, - RuntimeHandler: lcowRuntimeHandler, - } + sbRequest := getRunPodSandboxRequest(t, lcowRuntimeHandler) + sbRequest.Config.Annotations = annotations podID := runPodSandbox(t, client, ctx, sbRequest) defer removePodSandbox(t, client, ctx, podID) @@ -1277,17 +879,8 @@ func Test_RunPodSandbox_MultipleContainersSameVhd_WCOW(t *testing.T) { }, } - sbRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - Annotations: annotations, - }, - RuntimeHandler: wcowHypervisorRuntimeHandler, - } + sbRequest := getRunPodSandboxRequest(t, wcowHypervisorRuntimeHandler) + sbRequest.Config.Annotations = annotations podID := runPodSandbox(t, client, ctx, sbRequest) defer removePodSandbox(t, client, ctx, podID) @@ -1394,17 +987,8 @@ func createSandboxContainerAndExec(t *testing.T, annotations map[string]string, ctx, cancel := context.WithCancel(context.Background()) defer cancel() - sbRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - Annotations: annotations, - }, - RuntimeHandler: lcowRuntimeHandler, - } + sbRequest := getRunPodSandboxRequest(t, lcowRuntimeHandler) + sbRequest.Config.Annotations = annotations podID := runPodSandbox(t, client, ctx, sbRequest) defer removePodSandbox(t, client, ctx, podID) diff --git a/test/cri-containerd/sandbox.go b/test/cri-containerd/sandbox.go index f952df61d4..9ec62d5d16 100644 --- a/test/cri-containerd/sandbox.go +++ b/test/cri-containerd/sandbox.go @@ -35,8 +35,8 @@ func removePodSandbox(t *testing.T, client runtime.RuntimeServiceClient, ctx con } } -func getRunPodSandboxRequest(t *testing.T, runtimeHandler string) runtime.RunPodSandboxRequest { - return runtime.RunPodSandboxRequest{ +func getRunPodSandboxRequest(t *testing.T, runtimeHandler string) *runtime.RunPodSandboxRequest { + return &runtime.RunPodSandboxRequest{ Config: &runtime.PodSandboxConfig{ Metadata: &runtime.PodSandboxMetadata{ Name: t.Name(), diff --git a/test/cri-containerd/stats_test.go b/test/cri-containerd/stats_test.go index 2f5aa6b9ce..357d6cda3c 100644 --- a/test/cri-containerd/stats_test.go +++ b/test/cri-containerd/stats_test.go @@ -88,15 +88,7 @@ func Test_SandboxStats_Single_LCOW(t *testing.T) { pullRequiredLcowImages(t, []string{imageLcowK8sPause}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Namespace: testNamespace, - }, - }, - RuntimeHandler: lcowRuntimeHandler, - } + request := getRunPodSandboxRequest(t, lcowRuntimeHandler) client := newTestRuntimeClient(t) ctx, cancel := context.WithCancel(context.Background()) @@ -124,15 +116,7 @@ func Test_SandboxStats_List_ContainerID_LCOW(t *testing.T) { pullRequiredLcowImages(t, []string{imageLcowK8sPause}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Namespace: testNamespace, - }, - }, - RuntimeHandler: lcowRuntimeHandler, - } + request := getRunPodSandboxRequest(t, lcowRuntimeHandler) client := newTestRuntimeClient(t) ctx, cancel := context.WithCancel(context.Background()) @@ -165,15 +149,7 @@ func Test_SandboxStats_List_PodID_LCOW(t *testing.T) { pullRequiredLcowImages(t, []string{imageLcowK8sPause}) - request := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Namespace: testNamespace, - }, - }, - RuntimeHandler: lcowRuntimeHandler, - } + request := getRunPodSandboxRequest(t, lcowRuntimeHandler) client := newTestRuntimeClient(t) ctx, cancel := context.WithCancel(context.Background()) @@ -247,16 +223,7 @@ func Test_ContainerStats_ContainerID(t *testing.T) { pullRequiredImages(t, []string{test.sandboxImage, test.containerImage}) } - podRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - }, - RuntimeHandler: test.runtimeHandler, - } + podRequest := getRunPodSandboxRequest(t, test.runtimeHandler) client := newTestRuntimeClient(t) ctx, cancel := context.WithCancel(context.Background()) @@ -331,16 +298,7 @@ func Test_ContainerStats_List_ContainerID(t *testing.T) { pullRequiredImages(t, []string{test.sandboxImage, test.containerImage}) } - podRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - }, - RuntimeHandler: test.runtimeHandler, - } + podRequest := getRunPodSandboxRequest(t, test.runtimeHandler) client := newTestRuntimeClient(t) ctx, cancel := context.WithCancel(context.Background()) @@ -406,20 +364,11 @@ func Test_SandboxStats_WorkingSet_PhysicallyBacked(t *testing.T) { // sluggish. var sizeInMB uint64 = 1536 sizeInMBStr := strconv.FormatUint(sizeInMB, 10) - podRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name(), - Uid: "0", - Namespace: testNamespace, - }, - Annotations: map[string]string{ - "io.microsoft.virtualmachine.computetopology.memory.allowovercommit": "false", - "io.microsoft.virtualmachine.computetopology.memory.enabledeferredcommit": "false", - "io.microsoft.virtualmachine.computetopology.memory.sizeinmb": sizeInMBStr, - }, - }, - RuntimeHandler: test.runtimeHandler, + podRequest := getRunPodSandboxRequest(t, test.runtimeHandler) + podRequest.Config.Annotations = map[string]string{ + "io.microsoft.virtualmachine.computetopology.memory.allowovercommit": "false", + "io.microsoft.virtualmachine.computetopology.memory.enabledeferredcommit": "false", + "io.microsoft.virtualmachine.computetopology.memory.sizeinmb": sizeInMBStr, } client := newTestRuntimeClient(t) diff --git a/test/cri-containerd/stopcontainer_test.go b/test/cri-containerd/stopcontainer_test.go index f161d5dbc2..113ca51d61 100644 --- a/test/cri-containerd/stopcontainer_test.go +++ b/test/cri-containerd/stopcontainer_test.go @@ -18,15 +18,7 @@ func Test_StopContainer_LCOW(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - sandboxRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name() + "-Sandbox", - Namespace: testNamespace, - }, - }, - RuntimeHandler: lcowRuntimeHandler, - } + sandboxRequest := getRunPodSandboxRequest(t, lcowRuntimeHandler) podID := runPodSandbox(t, client, ctx, sandboxRequest) defer removePodSandbox(t, client, ctx, podID) @@ -64,15 +56,7 @@ func Test_StopContainer_WithTimeout_LCOW(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - sandboxRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name() + "-Sandbox", - Namespace: testNamespace, - }, - }, - RuntimeHandler: lcowRuntimeHandler, - } + sandboxRequest := getRunPodSandboxRequest(t, lcowRuntimeHandler) podID := runPodSandbox(t, client, ctx, sandboxRequest) defer removePodSandbox(t, client, ctx, podID) @@ -110,15 +94,7 @@ func Test_StopContainer_WithExec_LCOW(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - sandboxRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name() + "-Sandbox", - Namespace: testNamespace, - }, - }, - RuntimeHandler: lcowRuntimeHandler, - } + sandboxRequest := getRunPodSandboxRequest(t, lcowRuntimeHandler) podID := runPodSandbox(t, client, ctx, sandboxRequest) defer removePodSandbox(t, client, ctx, podID) @@ -164,15 +140,7 @@ func Test_StopContainer_ReusePod_LCOW(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - sandboxRequest := &runtime.RunPodSandboxRequest{ - Config: &runtime.PodSandboxConfig{ - Metadata: &runtime.PodSandboxMetadata{ - Name: t.Name() + "-Sandbox", - Namespace: testNamespace, - }, - }, - RuntimeHandler: lcowRuntimeHandler, - } + sandboxRequest := getRunPodSandboxRequest(t, lcowRuntimeHandler) podID := runPodSandbox(t, client, ctx, sandboxRequest) defer removePodSandbox(t, client, ctx, podID)