Skip to content

Commit

Permalink
tests/salt: improve error logging on JSON decoding error
Browse files Browse the repository at this point in the history
QubesOS/qubes-issues#7834

(cherry picked from commit 864acef)
  • Loading branch information
marmarek committed Nov 15, 2022
1 parent 152a94a commit 15edff4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion qubes/tests/integ/salt.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,13 @@ def test_000_simple_sls(self):
'Full output: ' + state_output)
state_id = 'file_|-/home/user/testfile_|-/home/user/testfile_|-managed'
# drop the header
state_output_json = json.loads(state_output[len(expected_output):])
json_data = state_output[len(expected_output):]
try:
state_output_json = json.loads(json_data)
except json.decoder.JSONDecodeError as e:
self.fail("JSON output decoding error: {}\n{}".format(
e, json_data
))
state_output_json = state_output_json[vmname][state_id]
try:
del state_output_json['duration']
Expand Down

0 comments on commit 15edff4

Please sign in to comment.