Skip to content

Commit

Permalink
tests/salt: workaround warning reported by Salt
Browse files Browse the repository at this point in the history
Workaround for saltstack/salt#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
  • Loading branch information
marmarek committed Oct 30, 2022
1 parent 864acef commit 3e6b30e
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions qubes/tests/integ/salt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 = \
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 3e6b30e

Please sign in to comment.