From e6f323e6b6267050ad805ca019e8ffe159d4c224 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Budai?= Date: Thu, 26 Mar 2020 14:53:08 +0100 Subject: [PATCH] tests/image: format osbuild output in case of a failure testify library cannot deal with error messages with length > 64k. Sadly, osbuild output is very long one line. This commits formats the output before making the error from it. --- cmd/osbuild-image-tests/main_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/osbuild-image-tests/main_test.go b/cmd/osbuild-image-tests/main_test.go index c92c76602..38312765d 100644 --- a/cmd/osbuild-image-tests/main_test.go +++ b/cmd/osbuild-image-tests/main_test.go @@ -50,7 +50,9 @@ func runOsbuild(manifest []byte, store string) (string, error) { if err != nil { if _, ok := err.(*exec.ExitError); ok { - return "", fmt.Errorf("running osbuild failed: %s", outBuffer.String()) + var formattedOutput bytes.Buffer + _ = json.Indent(&formattedOutput, outBuffer.Bytes(), "", " ") + return "", fmt.Errorf("running osbuild failed: %s", formattedOutput.String()) } return "", fmt.Errorf("running osbuild failed from an unexpected reason: %#v", err) }