Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated tests in frontend/dockerfile/dockerfile_test.go to run on Win… #5481

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions frontend/dockerfile/dockerfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5724,18 +5724,31 @@ 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
USER ContainerAdministrator
RUN echo test> unique
FROM nanoserver AS s1
USER ContainerAdministrator
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 +5797,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 +5815,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
Loading