progress: do not return if osbuild status json reading fails
This commit tweaks an issue that potentially an incorrect status from osbuild would fail the build with a bad error message and without us getting the full buildlog.
This commit is contained in:
parent
655b6bbd0f
commit
0e1a0f8ace
2 changed files with 21 additions and 2 deletions
|
|
@ -140,7 +140,7 @@ func makeFakeOsbuild(t *testing.T, content string) string {
|
|||
return p
|
||||
}
|
||||
|
||||
func TestRunOSBuildWithProgress(t *testing.T) {
|
||||
func TestRunOSBuildWithProgressErrorReporting(t *testing.T) {
|
||||
restore := progress.MockOsbuildCmd(makeFakeOsbuild(t, `echo osbuild-stdout-output
|
||||
>&2 echo osbuild-stderr-output
|
||||
exit 112
|
||||
|
|
@ -156,3 +156,17 @@ osbuild-stdout-output
|
|||
osbuild-stderr-output
|
||||
`)
|
||||
}
|
||||
|
||||
func TestRunOSBuildWithProgressIncorrectJSON(t *testing.T) {
|
||||
restore := progress.MockOsbuildCmd(makeFakeOsbuild(t, `echo osbuild-stdout-output
|
||||
>&2 echo osbuild-stderr-output
|
||||
>&3 echo invalid-json
|
||||
`))
|
||||
defer restore()
|
||||
|
||||
pbar, err := progress.New("debug")
|
||||
assert.NoError(t, err)
|
||||
err = progress.RunOSBuild(pbar, []byte(`{"fake":"manifest"}`), "", "", nil, nil)
|
||||
assert.EqualError(t, err, `errors parsing osbuild status:
|
||||
cannot scan line "invalid-json": invalid character 'i' looking for beginning of value`)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue