Commit c8e16881 authored by Jérome Perrin's avatar Jérome Perrin

testing/utils: log crontab output when execution fail

parent 2fa78884
...@@ -218,11 +218,17 @@ class CrontabMixin(object): ...@@ -218,11 +218,17 @@ class CrontabMixin(object):
be a relative time. be a relative time.
""" """
crontab_command = self._getCrontabCommand(crontab_name) crontab_command = self._getCrontabCommand(crontab_name)
crontab_output = subprocess.check_output( try:
"faketime {date} bash -o pipefail -e -c '{crontab_command}'".format(**locals()), crontab_output = subprocess.check_output(
shell=True, "faketime {date} bash -o pipefail -e -c '{crontab_command}'".format(**locals()),
) shell=True,
self.logger.debug("crontab %s output: %s", crontab_command, crontab_output) stderr=subprocess.STDOUT,
)
except subprocess.CalledProcessError as e:
self.logger.debug('error executing crontab %s output: %s', crontab_command, e.output)
raise
else:
self.logger.debug("crontab %s output: %s", crontab_command, crontab_output)
class ImageComparisonTestCase(unittest.TestCase): class ImageComparisonTestCase(unittest.TestCase):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment