Fix BootTest.get_status to return status for the latest known version. Boottests results are reported for the current (published) version, not the proposed one.

bzr-import-20160707
Celso Providelo 10 years ago
parent 9fb776f4c0
commit 760d08c459

@ -208,9 +208,11 @@ class BootTest(object):
if not (src in self.pkglist and ver in self.pkglist[src]):
self.pkglist[src][ver] = status
def get_status(self, name, version):
"""Return test status for the given source name and version."""
return self.pkglist[name][version]
def get_status(self, name):
"""Return test status for the given source name."""
last_version = sorted(
self.pkglist[name], cmp=apt_pkg.version_compare)[-1]
return self.pkglist[name][last_version]
def request(self, packages):
"""Requests boottests for the given sources list ([(src, ver),])."""
@ -236,6 +238,13 @@ class BootTest(object):
"""Collects boottests results and updates internal registry."""
self._run("collect", "-O", self._result_path)
self._read()
if not self.britney.options.verbose:
return
for src in sorted(self.pkglist):
for ver in sorted(self.pkglist[src], cmp=apt_pkg.version_compare):
status = self.pkglist[src][ver]
print("I: [%s] - Collected boottest status for %s_%s: "
"%s" % (time.asctime(), src, ver, status))
def needs_test(self, name, version):
"""Whether or not the given source and version should be tested.

@ -1944,7 +1944,7 @@ class Britney(object):
boottest.collect()
# Update excuses from the boottest context.
for excuse in boottest_excuses:
status = boottest.get_status(excuse.name, excuse.ver[1])
status = boottest.get_status(excuse.name)
label = BootTest.EXCUSE_LABELS.get(status, 'UNKNOWN STATUS')
excuse.addhtml("Boottest result: %s" % (label))
# Allows hints to force boottest failures/attempts

@ -146,6 +146,7 @@ class TestBoottestEnd2End(TestBase):
self.create_manifest([
'green 1.0',
'pyqt5:armhf 1.0',
'signon 1.0'
])
def create_manifest(self, lines):
@ -171,6 +172,7 @@ template = """
green 1.1~beta RUNNING
pyqt5-src 1.1~beta PASS
pyqt5-src 1.1 FAIL
signon 1.0 PASS
"""
def request():
@ -190,6 +192,9 @@ def collect():
p = argparse.ArgumentParser()
p.add_argument('-r')
p.add_argument('-c')
p.add_argument('-d', default=False, action='store_true')
p.add_argument('-P', default=False, action='store_true')
p.add_argument('-U', default=False, action='store_true')
sp = p.add_subparsers()
@ -258,11 +263,10 @@ args.func()
# promotion.
context = []
context.append(
('pyqt5', {'Source': 'pyqt5-src', 'Version': '1.1~beta',
'Architecture': 'all'}))
('signon', {'Version': '1.1', 'Architecture': 'armhf'}))
self.do_test(
context,
[r'\bpyqt5-src\b.*\(- to .*>1.1~beta<',
[r'\bsignon\b.*\(- to .*>1.1<',
'<li>Boottest result: {}'.format(
boottest.BootTest.EXCUSE_LABELS['PASS']),
'<li>Valid candidate'])

Loading…
Cancel
Save