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.
This commit is contained in:
Ondřej Budai 2020-03-26 14:53:08 +01:00 committed by Tom Gundersen
parent 2435163fc9
commit e6f323e6b6

View file

@ -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)
}