From 864acef1e62c03e26878f6bf78937e3982035d26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sun, 30 Oct 2022 00:22:40 +0200 Subject: [PATCH] tests/salt: improve error logging on JSON decoding error QubesOS/qubes-issues#7834 --- qubes/tests/integ/salt.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/qubes/tests/integ/salt.py b/qubes/tests/integ/salt.py index 9d69ce854..8e34df623 100644 --- a/qubes/tests/integ/salt.py +++ b/qubes/tests/integ/salt.py @@ -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']