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

dockerfile: fix validation errors in linter tests #4839

Merged
merged 1 commit into from
Apr 13, 2024
Merged
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
11 changes: 6 additions & 5 deletions frontend/dockerfile/dockerfile_lint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ COPY Dockerfile /bar
checkLinterWarnings(t, sb, dockerfile, []expectedLintWarning{})
}

func checkUnmarshal(t *testing.T, sb integration.Sandbox, c *client.Client, f frontend, dir *integration.TmpDirWithName, dockerfile []byte, expected []expectedLintWarning) {
func checkUnmarshal(t *testing.T, sb integration.Sandbox, c *client.Client, dir *integration.TmpDirWithName, expected []expectedLintWarning) {
destDir, err := os.MkdirTemp("", "buildkit")
require.NoError(t, err)
defer os.RemoveAll(destDir)
Expand Down Expand Up @@ -253,7 +253,7 @@ func checkUnmarshal(t *testing.T, sb integration.Sandbox, c *client.Client, f fr
require.True(t, called)
}

func checkProgressStream(t *testing.T, sb integration.Sandbox, c *client.Client, f frontend, dir *integration.TmpDirWithName, dockerfile []byte, expected []expectedLintWarning) {
func checkProgressStream(t *testing.T, sb integration.Sandbox, c *client.Client, dir *integration.TmpDirWithName, expected []expectedLintWarning) {
status := make(chan *client.SolveStatus)
statusDone := make(chan struct{})
done := make(chan struct{})
Expand All @@ -275,6 +275,8 @@ func checkProgressStream(t *testing.T, sb integration.Sandbox, c *client.Client,
}
}()

f := getFrontend(t, sb)

_, err := f.Solve(sb.Context(), c, client.SolveOpt{
FrontendAttrs: map[string]string{
"platform": "linux/amd64,linux/arm64",
Expand Down Expand Up @@ -314,7 +316,6 @@ func checkLinterWarnings(t *testing.T, sb integration.Sandbox, dockerfile []byte
// warnings to be in order of appearance in the Dockerfile.

integration.SkipOnPlatform(t, "windows")
f := getFrontend(t, sb)

dir := integration.Tmpdir(
t,
Expand All @@ -326,10 +327,10 @@ func checkLinterWarnings(t *testing.T, sb integration.Sandbox, dockerfile []byte
defer c.Close()

t.Run("warntype=progress", func(t *testing.T) {
checkProgressStream(t, sb, c, f, dir, dockerfile, expected)
checkProgressStream(t, sb, c, dir, expected)
})
t.Run("warntype=unmarshal", func(t *testing.T) {
checkUnmarshal(t, sb, c, f, dir, dockerfile, expected)
checkUnmarshal(t, sb, c, dir, expected)
})
}

Expand Down