Skip to content

Commit

Permalink
Updated tests in frontend/dockerfile/dockerfile_test.go to run on Win…
Browse files Browse the repository at this point in the history
…dows.

Partially addressing #4485

Signed-off-by: Billy Owire <billyowire95@gmail.com>
  • Loading branch information
billywr committed Nov 4, 2024
1 parent e91be04 commit c4b585b
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions frontend/dockerfile/dockerfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5724,18 +5724,29 @@ RUN echo bar > bar
}

func testNoCache(t *testing.T, sb integration.Sandbox) {
integration.SkipOnPlatform(t, "windows")
f := getFrontend(t, sb)

dockerfile := []byte(`
dockerfile := []byte(integration.UnixOrWindows(
`
FROM busybox AS s0
RUN cat /dev/urandom | head -c 100 | sha256sum | tee unique
FROM busybox AS s1
RUN cat /dev/urandom | head -c 100 | sha256sum | tee unique2
FROM scratch
COPY --from=s0 unique /
COPY --from=s1 unique2 /
`)
`,
`
FROM nanoserver AS s0
RUN echo test> unique
FROM nanoserver AS s1
RUN echo test> unique2
FROM nanoserver
COPY --from=s0 unique /
COPY --from=s1 unique2 /
`,
))

dir := integration.Tmpdir(
t,
fstest.CreateFile("Dockerfile", dockerfile, 0600),
Expand Down Expand Up @@ -5784,8 +5795,8 @@ COPY --from=s1 unique2 /
unique2Dir2, err := os.ReadFile(filepath.Join(destDir2, "unique2"))
require.NoError(t, err)

require.NotEqual(t, string(unique1Dir1), string(unique1Dir2))
require.NotEqual(t, string(unique2Dir1), string(unique2Dir2))
require.NotEqual(t, integration.UnixOrWindows(string(unique1Dir1), string(unique1Dir1)+"\r\n"), string(unique1Dir2))
require.NotEqual(t, integration.UnixOrWindows(string(unique2Dir1), string(unique2Dir1)+"\r\n"), string(unique2Dir2))

destDir3 := t.TempDir()

Expand All @@ -5802,7 +5813,7 @@ COPY --from=s1 unique2 /
require.NoError(t, err)

require.Equal(t, string(unique1Dir2), string(unique1Dir3))
require.NotEqual(t, string(unique2Dir1), string(unique2Dir3))
require.NotEqual(t, integration.UnixOrWindows(string(unique2Dir1), string(unique2Dir1)+"\r\n"), string(unique2Dir3))
}

// moby/buildkit#5305
Expand Down

0 comments on commit c4b585b

Please sign in to comment.