From 3e6b30e329b4dac163c477c08125efc0b2a95791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sun, 30 Oct 2022 00:23:26 +0200 Subject: [PATCH] tests/salt: workaround warning reported by Salt Workaround for https://github.com/saltstack/salt/issues/60476 It prints warning to stdout(?!). The issue is fixed upstream already, but the fix isn't packaged yet. At this time, it affects Fedora 37 only. Fixes QubesOS/qubes-issues#7834 --- qubes/tests/integ/salt.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/qubes/tests/integ/salt.py b/qubes/tests/integ/salt.py index 8e34df623..d3c0a66fa 100644 --- a/qubes/tests/integ/salt.py +++ b/qubes/tests/integ/salt.py @@ -312,6 +312,12 @@ def test_000_simple_sls(self): state_id = 'file_|-/home/user/testfile_|-/home/user/testfile_|-managed' # drop the header json_data = state_output[len(expected_output):] + # workaround for https://github.com/saltstack/salt/issues/60476 + # (fixed upstream, but haven't flowd into Fedora yet) + if "Setuptools is replacing distutils" in json_data: + json_data = "\n".join( + l for l in json_data.splitlines() + if "Setuptools is replacing distutils" not in l) try: state_output_json = json.loads(json_data) except json.decoder.JSONDecodeError as e: @@ -405,10 +411,17 @@ def test_001_multi_state_highstate(self): expected_output = vmname + ':\n' self.assertTrue(state_output.startswith(expected_output), 'Full output: ' + state_output) + json_data = state_output[len(expected_output):] + # workaround for https://github.com/saltstack/salt/issues/60476 + # (fixed upstream, but haven't flowd into Fedora yet) + if "Setuptools is replacing distutils" in json_data: + json_data = "\n".join( + l for l in json_data.splitlines() + if "Setuptools is replacing distutils" not in l) try: - state_output_json = json.loads(state_output[len(expected_output):]) + state_output_json = json.loads(json_data) except json.decoder.JSONDecodeError as e: - self.fail('{}: {}'.format(e, state_output[len(expected_output):])) + self.fail('{}: {}'.format(e, json_data)) states = states + ('jinja',) for state in states: state_id = \ @@ -475,6 +488,12 @@ def test_002_grans_id(self): tpl_output = tpl_output[len(tplname + ':\n'):] for name, output in ((tplname, tpl_output), (vmname, appvm_output)): + # workaround for https://github.com/saltstack/salt/issues/60476 + # (fixed upstream, but haven't flowd into Fedora yet) + if "Setuptools is replacing distutils" in output: + output = "\n".join( + l for l in output.splitlines() + if "Setuptools is replacing distutils" not in l) try: state_output_json = json.loads(output) except json.decoder.JSONDecodeError as e: