From 0f74f9a7947c119a7446b2bfe553752c95b0aabe Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Mon, 8 Jul 2024 18:31:27 -0700 Subject: [PATCH] bake: fix testing json formatted output Because the test checked for combinedoutput, it could contain internal warning messages in stderr. JSON output is guaranteed in stdout. Signed-off-by: Tonis Tiigi --- tests/bake.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/bake.go b/tests/bake.go index da70629b..47f85eac 100644 --- a/tests/bake.go +++ b/tests/bake.go @@ -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)