Fix KeyError crash for sources which are only in unstable

The previous commit introduced a KeyError crash in tests_for_source() for
packages which are unbuilt/uninstallable and only present in unstable.

Ignore these in tests_for_source() as they can't possibly be a regression for
their dependencies, and there is no sensible way to run a test for them.
bzr-import-20160707
Martin Pitt 10 years ago
parent c9173b3ca3
commit 6c3dd0a3e2

@ -174,9 +174,14 @@ class AutoPackageTest(object):
# works, then the unstable src does not break the testing # works, then the unstable src does not break the testing
# rdep_src and is fine # rdep_src and is fine
if rdep_src in self.excludes: if rdep_src in self.excludes:
try:
rdep_src_info = self.britney.sources['testing'][rdep_src] rdep_src_info = self.britney.sources['testing'][rdep_src]
self.log_verbose('Reverse dependency %s of %s/%s is unbuilt or uninstallable, running test against testing version %s' % self.log_verbose('Reverse dependency %s of %s/%s is unbuilt or uninstallable, running test against testing version %s' %
(rdep_src, src, ver, rdep_src_info[VERSION])) (rdep_src, src, ver, rdep_src_info[VERSION]))
except KeyError:
self.log_verbose('Reverse dependency %s of %s/%s is unbuilt or uninstallable and not present in testing, ignoring' %
(rdep_src, src, ver))
continue
else: else:
rdep_src_info = sources_info[rdep_src] rdep_src_info = sources_info[rdep_src]
if rdep_src_info[AUTOPKGTEST] or self.has_autodep8(rdep_src_info): if rdep_src_info[AUTOPKGTEST] or self.has_autodep8(rdep_src_info):

@ -415,6 +415,38 @@ lightgreen 1 i386 green 2
self.assertEqual(self.amqp_requests, self.assertEqual(self.amqp_requests,
set(['debci-series-amd64:lightgreen', 'debci-series-i386:lightgreen'])) set(['debci-series-amd64:lightgreen', 'debci-series-i386:lightgreen']))
def test_rdepends_unbuilt_unstable_only(self):
'''Unbuilt reverse dependency which is not in testing'''
self.swift.set_results({'autopkgtest-series': {
'series/i386/d/darkgreen/20150101_100000@': (0, 'darkgreen 1'),
'series/amd64/d/darkgreen/20150101_100001@': (0, 'darkgreen 1'),
'series/i386/l/lightgreen/20150101_100000@': (0, 'lightgreen 1'),
'series/amd64/l/lightgreen/20150101_100000@': (0, 'lightgreen 1'),
'series/i386/g/green/20150101_020000@': (0, 'green 1'),
'series/amd64/g/green/20150101_020000@': (0, 'green 1'),
'series/i386/g/green/20150101_100200@': (0, 'green 2'),
'series/amd64/g/green/20150101_100201@': (0, 'green 2'),
}})
# run britney once to pick up previous results
self.do_test(
[('libgreen1', {'Version': '2', 'Source': 'green', 'Depends': 'libc6'}, 'autopkgtest')],
VALID_CANDIDATE)
os.unlink(self.fake_amqp)
# add new uninstallable brokengreen; should not run test at all
self.do_test(
[('brokengreen', {'Version': '1', 'Depends': 'libgreen1, nonexisting'}, 'autopkgtest')],
VALID_CANDIDATE,
[r'\bgreen\b.*>1</a> to .*>2<',
r'\bbrokengreen\b.*- to .*>1<',
r'autopkgtest for green 2: .*amd64.*Pass.*i386.*Pass',
r'autopkgtest for darkgreen 1: .*amd64.*Pass.*i386.*Pass',
'Not considered', # for brokengreen
r'brokengreen/amd64 unsatisfiable Depends: nonexisting'],
['autopkgtest for brokengreen'])
self.assertEqual(self.amqp_requests, set())
def test_hint_force_badtest(self): def test_hint_force_badtest(self):
'''force-badtest hint''' '''force-badtest hint'''

Loading…
Cancel
Save