return os.path.join(http_base, archive_subdir, str(job_id), '')
+def get_results_url(run_name, job_id=None):
+ """
+ :param run_name: The name of the test run
+ :param job_id: The job_id of the job. Optional.
+ :returns: URL to the run (or job, if job_id is passed) in the results web
+ UI. For example, Inktank uses Pulpito.
+ """
+ if not config.results_ui_server:
+ return None
+ base_url = config.results_ui_server
+
+ if job_id is None:
+ return os.path.join(base_url, run_name, '')
+ return os.path.join(base_url, run_name, str(job_id), '')
+
+
def get_ceph_binary_url(package=None,
branch=None, tag=None, sha1=None, dist=None,
flavor=None, format=None, arch=None):
job_dir = os.path.join(archive_dir, job)
summary_file = os.path.join(job_dir, 'summary.yaml')
+ # Every job gets a link to e.g. pulpito's pages
+ info_url = misc.get_results_url(name, job)
+ if info_url:
+ info_line = email_templates['info_url_templ'].format(info=info_url)
+ else:
+ info_line = ''
+
# Unfinished jobs will have no summary.yaml
if not os.path.exists(summary_file):
info_file = os.path.join(job_dir, 'info.yaml')
hung[job] = email_templates['hung_templ'].format(
job_id=job,
desc=desc,
+ info_line=info_line,
)
continue
job_id=job,
desc=summary.get('description'),
time=int(summary.get('duration', 0)),
+ info_line=info_line,
)
else:
log = misc.get_http_log_path(archive_dir, job)
desc=summary.get('description'),
time=int(summary.get('duration', 0)),
reason=reason,
+ info_line=info_line,
log_line=log_line,
sentry_line=sentry_line,
)
body = email_templates['body_templ'].format(
name=name,
+ info_root=misc.get_results_url(name),
log_root=misc.get_http_log_path(archive_dir),
fail_count=len(failed),
hung_count=len(hung),
'body_templ': dedent("""\
Test Run: {name}
=================================================================
+ info: {info_root}
logs: {log_root}
failed: {fail_count}
hung: {hung_count}
'fail_templ': dedent("""\
[{job_id}] {desc}
-----------------------------------------------------------------
- time: {time}s{log_line}{sentry_line}
+ time: {time}s{info_line}{log_line}{sentry_line}
{reason}
"""),
+ 'info_url_templ': "\ninfo: {info}",
'fail_log_templ': "\nlog: {log}",
'fail_sentry_templ': "\nsentry: {sentry_event}",
'hung_templ': dedent("""\
- [{job_id}] {desc}
+ [{job_id}] {desc}{info_line}
"""),
'pass_templ': dedent("""\
[{job_id}] {desc}
- time: {time}s
+ time: {time}s{info_line}
"""),
}
import os
import textwrap
+from ..config import config
from .. import results
from .fake_archive import FakeArchive
'body': textwrap.dedent("""
Test Run: test_name
=================================================================
+ info: http://example.com/test_name/
logs: http://qa-proxy.ceph.com/teuthology/test_name/
failed: 1
hung: 1
[88979] description for job with name test_name
-----------------------------------------------------------------
time: 35190s
+ info: http://example.com/test_name/88979/
log: http://qa-proxy.ceph.com/teuthology/test_name/88979/
Failure reason!
Hung
=================================================================
[30481] description for job with name test_name
+ info: http://example.com/test_name/30481/
Passed
=================================================================
[68369] description for job with name test_name
- time: 33771s
+ time: 33771s
+ info: http://example.com/test_name/68369/
""").strip(),
}
def setup(self):
+ config.results_ui_server = "http://example.com/"
self.archive = FakeArchive()
self.archive.setup()
self.archive_base = self.archive.archive_base
run_dir,
36000)
assert subject == self.reference['subject']
+ print body
assert body == self.reference['body']