提交 a83d52d9 编写于 作者: C Cleber Rosa

latest job result: create the `latest` symlink at the job beginning

Instead of creating at the end of the job. This allows users running
long (time wise) jobs to be monitored by "following" the
$AVOCADO_RESULT/latest/job.log file.

This implements the card described at:

 https://trello.com/c/QJ4wCD8x/447-reconsider-when-the-latest-log-symlink-is-createdSigned-off-by: NCleber Rosa <crosa@redhat.com>
上级 f7364a6f
......@@ -443,6 +443,8 @@ class Job(object):
self.args.test_result_total = mux.get_number_of_tests(test_suite)
self._make_test_result()
if not self.standalone:
self._update_latest_link()
self._make_test_runner()
self._start_sysinfo()
......@@ -452,8 +454,6 @@ class Job(object):
failures = self.test_runner.run_suite(test_suite, mux,
timeout=self.timeout)
self.view.stop_file_logging()
if not self.standalone:
self._update_latest_link()
# If it's all good so far, set job status to 'PASS'
if self.status == 'RUNNING':
self.status = 'PASS'
......
......@@ -237,6 +237,24 @@ class RunnerOperationTest(unittest.TestCase):
result))
self.assertIn('"status": "ERROR"', result.stdout)
def test_early_latest_result(self):
"""
Tests that the `latest` link to the latest job results is created early
"""
os.chdir(basedir)
cmd_line = ('./scripts/avocado run --sysinfo=off --job-results-dir %s examples/tests/sleeptest.py '
'-m examples/tests/sleeptest.py.data/sleeptest.yaml' % self.tmpdir)
avocado_process = process.SubProcess(cmd_line)
avocado_process.start()
link = os.path.join(self.tmpdir, 'latest')
for trial in xrange(0, 50):
time.sleep(0.1)
if os.path.exists(link) and os.path.islink(link):
avocado_process.terminate()
break
self.assertTrue(os.path.exists(link))
self.assertTrue(os.path.islink(link))
def tearDown(self):
shutil.rmtree(self.tmpdir)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册