Skip to content

Commit

Permalink
Merge pull request docker#2584 from tonistiigi/bake-test-fix
Browse files Browse the repository at this point in the history
bake: fix testing json formatted output
  • Loading branch information
tonistiigi authored Jul 9, 2024
2 parents dc83501 + 0f74f9a commit 06d96d6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/bake.go
Original file line number Diff line number Diff line change
Expand Up @@ -1074,15 +1074,16 @@ target "another" {
require.Contains(t, out, "another")
require.Contains(t, out, "UndefinedVar")

out, err = bakeCmd(
cmd := buildxCmd(
sb,
withDir(dir),
withArgs("build", "another", "--call", "check,format=json"),
withArgs("bake", "--progress=quiet", "build", "another", "--call", "check,format=json"),
)
require.Error(t, err, out)
outB, err := cmd.Output()
require.Error(t, err, string(outB))

var res map[string]any
err = json.Unmarshal([]byte(out), &res)
err = json.Unmarshal(outB, &res)
require.NoError(t, err, out)

targets, ok := res["target"].(map[string]any)
Expand Down

0 comments on commit 06d96d6

Please sign in to comment.