tests/salt: log more details about failures

Log command output on failure. By default CalledProcessError
presentation do not include it.
This commit is contained in:
Marek Marczykowski-Górecki 2019-04-13 21:51:42 +02:00
parent 5d0f8f8efa
commit 33bf3d4506
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -57,7 +57,9 @@ class SaltTestMixin(object):
*full_cmd, stdout=subprocess.PIPE))
output, _ = self.loop.run_until_complete(p.communicate())
if p.returncode != 0:
raise subprocess.CalledProcessError(p.returncode, full_cmd, output)
raise AssertionError(
'Salt command \'{}\' failed with code {}. '
'Full output: {}'.format(full_cmd, p.returncode, output))
return output.decode()
def dom0_salt_call_json(self, cmd):