(t *testing.T, sb string, sbConfig *runtime.PodSandboxConfig, cnConfig *runtime.ContainerConfig)
| 128 | } |
| 129 | |
| 130 | func runExecAndRemoveContainer(t *testing.T, sb string, sbConfig *runtime.PodSandboxConfig, cnConfig *runtime.ContainerConfig) { |
| 131 | t.Log("Create the container") |
| 132 | cn, err := runtimeService.CreateContainer(sb, cnConfig, sbConfig) |
| 133 | require.NoError(t, err) |
| 134 | t.Log("Start the container") |
| 135 | require.NoError(t, runtimeService.StartContainer(cn)) |
| 136 | // Wait few seconds for the container to be completely initialized |
| 137 | time.Sleep(5 * time.Second) |
| 138 | |
| 139 | cmd := []string{"cmd", "/c", "echo", "hello"} |
| 140 | timeoutDuration := 10 * time.Second |
| 141 | stdout, _, err := runtimeService.ExecSync(cn, cmd, timeoutDuration) |
| 142 | require.NoError(t, err) |
| 143 | t.Logf("Exec response: %v", stdout) |
| 144 | require.Equal(t, "hello\r\n", string(stdout)) |
| 145 | |
| 146 | t.Log("Stop the container") |
| 147 | require.NoError(t, runtimeService.StopContainer(cn, 0)) |
| 148 | t.Log("Remove the container") |
| 149 | require.NoError(t, runtimeService.RemoveContainer(cn)) |
| 150 | } |
| 151 | |
| 152 | func TestArgsEscapedImagesOnWindows(t *testing.T) { |
| 153 | // the ArgsEscaped test image is based on nanoserver:ltsc2022, so ensure we run on the correct OS version |
no test coverage detected
searching dependent graphs…