Skip to content

Commit

Permalink
integration: Enables TestVolumeCopyUp for Windows
Browse files Browse the repository at this point in the history
The image that the test is used for Windows has busybox included,
which means we can use sleep.

Signed-off-by: Claudiu Belu <cbelu@cloudbasesolutions.com>
  • Loading branch information
claudiubelu committed Oct 8, 2021
1 parent d0bdb0b commit fb4432c
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions integration/volume_copy_up_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ import (
)

func TestVolumeCopyUp(t *testing.T) {
if goruntime.GOOS == "windows" {
// TODO(claudiub): Remove this when the volume-copy-up image has Windows support.
// https://github.com/containerd/containerd/pull/5162
t.Skip("Skipped on Windows.")
}
var (
testImage = GetImage(VolumeCopyUp)
execTimeout = time.Minute
Expand All @@ -47,7 +42,7 @@ func TestVolumeCopyUp(t *testing.T) {
cnConfig := ContainerConfig(
"container",
testImage,
WithCommand("tail", "-f", "/dev/null"),
WithCommand("sleep", "150"),
)
cn, err := runtimeService.CreateContainer(sb, cnConfig, sbConfig)
require.NoError(t, err)
Expand All @@ -67,7 +62,9 @@ func TestVolumeCopyUp(t *testing.T) {
assert.Equal(t, "test_content\n", string(stdout))

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

0 comments on commit fb4432c

Please sign in to comment.