Merge pull request #9317 from jsturtevant/fix-sbserver-windows

CRI: Handle ArgsEscaped for new Sb Server by clearing commandline in spec
This commit is contained in:
Phil Estes
2023-11-02 14:45:39 +00:00
committed by GitHub
3 changed files with 130 additions and 14 deletions

View File

@@ -127,7 +127,7 @@ func runHostProcess(t *testing.T, expectErr bool, image string, action hpcAction
action(t, cn, containerConfig)
}
func runAndRemoveContainer(t *testing.T, sb string, sbConfig *runtime.PodSandboxConfig, cnConfig *runtime.ContainerConfig) {
func runExecAndRemoveContainer(t *testing.T, sb string, sbConfig *runtime.PodSandboxConfig, cnConfig *runtime.ContainerConfig) {
t.Log("Create the container")
cn, err := runtimeService.CreateContainer(sb, cnConfig, sbConfig)
require.NoError(t, err)
@@ -136,6 +136,13 @@ func runAndRemoveContainer(t *testing.T, sb string, sbConfig *runtime.PodSandbox
// Wait few seconds for the container to be completely initialized
time.Sleep(5 * time.Second)
cmd := []string{"cmd", "/c", "echo", "hello"}
timeoutDuration := 10 * time.Second
stdout, _, err := runtimeService.ExecSync(cn, cmd, timeoutDuration)
require.NoError(t, err)
t.Logf("Exec response: %v", stdout)
require.Equal(t, "hello\r\n", string(stdout))
t.Log("Stop the container")
require.NoError(t, runtimeService.StopContainer(cn, 0))
t.Log("Remove the container")
@@ -187,6 +194,6 @@ func TestArgsEscapedImagesOnWindows(t *testing.T) {
localSystemUsername,
)
runAndRemoveContainer(t, sb, sbConfig, cnConfigWithCtrCmd)
runAndRemoveContainer(t, sb, sbConfig, cnConfigNoCtrCmd)
runExecAndRemoveContainer(t, sb, sbConfig, cnConfigWithCtrCmd)
runExecAndRemoveContainer(t, sb, sbConfig, cnConfigNoCtrCmd)
}