Skip to content

Commit a9e5941

Browse files
committed
integration: Enables TestVolumeCopyUp for Windows
The image that the test is used for Windows has busybox included, which means we can use sleep.
1 parent d0bdb0b commit a9e5941

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

integration/volume_copy_up_test.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ import (
2828
)
2929

3030
func TestVolumeCopyUp(t *testing.T) {
31-
if goruntime.GOOS == "windows" {
32-
// TODO(claudiub): Remove this when the volume-copy-up image has Windows support.
33-
// https://github.com/containerd/containerd/pull/5162
34-
t.Skip("Skipped on Windows.")
35-
}
3631
var (
3732
testImage = GetImage(VolumeCopyUp)
3833
execTimeout = time.Minute
@@ -47,7 +42,7 @@ func TestVolumeCopyUp(t *testing.T) {
4742
cnConfig := ContainerConfig(
4843
"container",
4944
testImage,
50-
WithCommand("tail", "-f", "/dev/null"),
45+
WithCommand("sleep", "150"),
5146
)
5247
cn, err := runtimeService.CreateContainer(sb, cnConfig, sbConfig)
5348
require.NoError(t, err)
@@ -67,7 +62,9 @@ func TestVolumeCopyUp(t *testing.T) {
6762
assert.Equal(t, "test_content\n", string(stdout))
6863

6964
t.Logf("Check host path of the volume")
70-
hostCmd := fmt.Sprintf("find %s/containers/%s/volumes/*/test_file | xargs cat", *criRoot, cn)
65+
// Windows paths might have spaces in them (e.g.: Program Files), which would
66+
// cause issues for this command. This will allow us to bypass them.
67+
hostCmd := fmt.Sprintf("find '%s/containers/%s/volumes/' -type f -print0 | xargs -0 cat", *criRoot, cn)
7168
output, err := exec.Command("sh", "-c", hostCmd).CombinedOutput()
7269
require.NoError(t, err)
7370
assert.Equal(t, "test_content\n", string(output))

0 commit comments

Comments
 (0)