Add retry links to autopkgtest regressions

Generate https://autopkgtest.ubuntu.com/retry.cgi links for re-running tests
that regressed.

Change Excuse.html() back to usual % string formatting to be consistent with
the rest of the code.
bzr-import-20160707
Martin Pitt 9 years ago
parent 80a9121f62
commit ec420195bc

@ -196,7 +196,7 @@ from functools import reduce, partial
from itertools import chain, product from itertools import chain, product
from operator import attrgetter from operator import attrgetter
from urllib.parse import quote from urllib.parse import quote, urlencode
from installability.builder import InstallabilityTesterBuilder from installability.builder import InstallabilityTesterBuilder
from excuse import Excuse from excuse import Excuse
@ -1971,6 +1971,12 @@ class Britney(object):
kwargs['history_url'] = cloud_url % { kwargs['history_url'] = cloud_url % {
'h': srchash(adtsrc), 's': adtsrc, 'h': srchash(adtsrc), 's': adtsrc,
'r': self.options.series, 'a': arch} 'r': self.options.series, 'a': arch}
if status == 'REGRESSION':
kwargs['retry_url'] = 'https://autopkgtest.ubuntu.com/retry.cgi?' + \
urlencode({'release': self.options.series,
'arch': arch,
'package': adtsrc,
'trigger': '%s/%s' % (e.name, e.ver[1])})
e.addtest('autopkgtest', '%s %s' % (adtsrc, adtver), e.addtest('autopkgtest', '%s %s' % (adtsrc, adtver),
arch, status, log_url, **kwargs) arch, status, log_url, **kwargs)

@ -182,13 +182,18 @@ class Excuse(object):
for pkg in sorted(self.tests[testtype]): for pkg in sorted(self.tests[testtype]):
archmsg = [] archmsg = []
for arch in sorted(self.tests[testtype][pkg]): for arch in sorted(self.tests[testtype][pkg]):
status, log_url, history_url, artifact_url = self.tests[testtype][pkg][arch] status, log_url, history_url, artifact_url, retry_url = self.tests[testtype][pkg][arch]
label = EXCUSES_LABELS[status] label = EXCUSES_LABELS[status]
message = '<a href="{history_url}">{arch}</a>' if history_url else '{arch}' if history_url:
message += ': <a href="{log_url}">{label}</a>' message = '<a href="%s">%s</a>' % (history_url, arch)
else:
message = arch
message += ': <a href="%s">%s</a>' % (log_url, label)
if retry_url:
message += ' <a href="%s" style="text-decoration: none;">♻ </a> ' % retry_url
if artifact_url: if artifact_url:
message += ' <a href="{artifact_url}">[artifacts]</a>' message += ' <a href="%s">[artifacts]</a>' % artifact_url
archmsg.append(message.format(**locals())) archmsg.append(message)
res = res + ("<li>%s for %s: %s</li>\n" % (testtype, pkg, ', '.join(archmsg))) res = res + ("<li>%s for %s: %s</li>\n" % (testtype, pkg, ', '.join(archmsg)))
for x in self.htmlline: for x in self.htmlline:
@ -219,9 +224,10 @@ class Excuse(object):
""""adding reason""" """"adding reason"""
self.reason[reason] = 1 self.reason[reason] = 1
def addtest(self, type_, package, arch, state, log_url, history_url=None, artifact_url=None): def addtest(self, type_, package, arch, state, log_url, history_url=None,
artifact_url=None, retry_url=None):
"""Add test result""" """Add test result"""
self.tests.setdefault(type_, {}).setdefault(package, {})[arch] = [state, log_url, history_url, artifact_url] self.tests.setdefault(type_, {}).setdefault(package, {})[arch] = [state, log_url, history_url, artifact_url, retry_url]
# TODO merge with html() # TODO merge with html()
def text(self): def text(self):

@ -12,6 +12,7 @@ import fileinput
import unittest import unittest
import json import json
import pprint import pprint
import urllib.parse
import apt_pkg import apt_pkg
import yaml import yaml
@ -195,10 +196,12 @@ class T(TestBase):
'amd64': ['RUNNING-ALWAYSFAIL', 'amd64': ['RUNNING-ALWAYSFAIL',
'http://autopkgtest.ubuntu.com/running.shtml', 'http://autopkgtest.ubuntu.com/running.shtml',
'http://autopkgtest.ubuntu.com/packages/d/darkgreen/series/amd64', 'http://autopkgtest.ubuntu.com/packages/d/darkgreen/series/amd64',
None,
None], None],
'i386': ['RUNNING-ALWAYSFAIL', 'i386': ['RUNNING-ALWAYSFAIL',
'http://autopkgtest.ubuntu.com/running.shtml', 'http://autopkgtest.ubuntu.com/running.shtml',
'http://autopkgtest.ubuntu.com/packages/d/darkgreen/series/i386', 'http://autopkgtest.ubuntu.com/packages/d/darkgreen/series/i386',
None,
None]}}}) None]}}})
self.assertEqual(self.pending_requests, self.assertEqual(self.pending_requests,
@ -412,7 +415,7 @@ class T(TestBase):
'series/amd64/g/green/20150101_100201@': (4, 'green 2', tr('green/2')), 'series/amd64/g/green/20150101_100201@': (4, 'green 2', tr('green/2')),
}}) }})
out = self.do_test( out, exc = self.do_test(
[('libgreen1', {'Version': '2', 'Source': 'green', 'Depends': 'libc6'}, 'autopkgtest')], [('libgreen1', {'Version': '2', 'Source': 'green', 'Depends': 'libc6'}, 'autopkgtest')],
{'green': (False, {'green 2': {'amd64': 'REGRESSION', 'i386': 'PASS'}, {'green': (False, {'green 2': {'amd64': 'REGRESSION', 'i386': 'PASS'},
'lightgreen 1': {'amd64': 'REGRESSION', 'i386': 'REGRESSION'}, 'lightgreen 1': {'amd64': 'REGRESSION', 'i386': 'REGRESSION'},
@ -420,7 +423,24 @@ class T(TestBase):
}) })
}, },
{'green': [('old-version', '1'), ('new-version', '2')]} {'green': [('old-version', '1'), ('new-version', '2')]}
)[0] )
# should have links to log and history, but no artifacts (as this is
# not a PPA)
self.assertEqual(exc['green']['tests']['autopkgtest']['lightgreen 1']['amd64'][:4],
['REGRESSION',
'http://localhost:18085/autopkgtest-series/series/amd64/l/lightgreen/20150101_100101@/log.gz',
'http://autopkgtest.ubuntu.com/packages/l/lightgreen/series/amd64',
None])
# should have retry link for the regressions (not a stable URL, test
# seaprately)
link = urllib.parse.urlparse(exc['green']['tests']['autopkgtest']['lightgreen 1']['amd64'][4])
self.assertEqual(link.netloc, 'autopkgtest.ubuntu.com')
self.assertEqual(link.path, '/retry.cgi')
self.assertEqual(urllib.parse.parse_qs(link.query),
{'release': ['series'], 'arch': ['amd64'],
'package': ['lightgreen'], 'trigger': ['green/2']})
# we already had all results before the run, so this should not trigger # we already had all results before the run, so this should not trigger
# any new requests # any new requests
@ -1575,10 +1595,12 @@ class T(TestBase):
'amd64': ['RUNNING-ALWAYSFAIL', 'amd64': ['RUNNING-ALWAYSFAIL',
'http://autopkgtest.ubuntu.com/running.shtml', 'http://autopkgtest.ubuntu.com/running.shtml',
None, None,
None,
None], None],
'i386': ['RUNNING-ALWAYSFAIL', 'i386': ['RUNNING-ALWAYSFAIL',
'http://autopkgtest.ubuntu.com/running.shtml', 'http://autopkgtest.ubuntu.com/running.shtml',
None, None,
None,
None]} None]}
}}) }})
@ -1603,11 +1625,13 @@ class T(TestBase):
'amd64': ['PASS', 'amd64': ['PASS',
'http://localhost:18085/autopkgtest-series-awesome-developers-staging/series/amd64/l/lightgreen/20150101_100101@/log.gz', 'http://localhost:18085/autopkgtest-series-awesome-developers-staging/series/amd64/l/lightgreen/20150101_100101@/log.gz',
None, None,
'http://localhost:18085/autopkgtest-series-awesome-developers-staging/series/amd64/l/lightgreen/20150101_100101@/artifacts.tar.gz'], 'http://localhost:18085/autopkgtest-series-awesome-developers-staging/series/amd64/l/lightgreen/20150101_100101@/artifacts.tar.gz',
None],
'i386': ['PASS', 'i386': ['PASS',
'http://localhost:18085/autopkgtest-series-awesome-developers-staging/series/i386/l/lightgreen/20150101_100100@/log.gz', 'http://localhost:18085/autopkgtest-series-awesome-developers-staging/series/i386/l/lightgreen/20150101_100100@/log.gz',
None, None,
'http://localhost:18085/autopkgtest-series-awesome-developers-staging/series/i386/l/lightgreen/20150101_100100@/artifacts.tar.gz']} 'http://localhost:18085/autopkgtest-series-awesome-developers-staging/series/i386/l/lightgreen/20150101_100100@/artifacts.tar.gz',
None]}
}}) }})
self.assertEqual(self.amqp_requests, set()) self.assertEqual(self.amqp_requests, set())
self.assertEqual(self.pending_requests, {}) self.assertEqual(self.pending_requests, {})

Loading…
Cancel
Save