autopkgtest: Don't cache results for undefined versions

If a result.tar does not contain a testpkg-version, we must still match it
against pending.txt, but we must not add it to the results cache. This ends up
being a "null" version key (JSON's serialization of None) which becomes an
actual version string once this is read back.
This commit is contained in:
Martin Pitt 2015-08-18 22:53:14 +02:00
parent 380e3fca64
commit 6db26ca1c6
2 changed files with 21 additions and 5 deletions

View File

@ -398,11 +398,12 @@ class AutoPackageTest(object):
# add this result
src_arch_results = self.test_results.setdefault(src, {}).setdefault(arch, [stamp, {}, False])
if passed:
# update ever_passed field
src_arch_results[2] = True
src_arch_results[1][ver] = (passed, merge_triggers(
src_arch_results[1].get(ver, (None, []))[1], satisfied_triggers))
if ver is not None:
if passed:
# update ever_passed field
src_arch_results[2] = True
src_arch_results[1][ver] = (passed, merge_triggers(
src_arch_results[1].get(ver, (None, []))[1], satisfied_triggers))
# update latest_stamp
if stamp > src_arch_results[0]:
src_arch_results[0] = stamp

View File

@ -818,6 +818,21 @@ lightgreen 1 i386 green 3
self.assertEqual(self.pending_requests, '')
# one more tmpfail result, should not confuse britney with None version
self.swift.set_results({'autopkgtest-series': {
'series/i386/l/lightgreen/20150101_100201@': (16, None),
}})
self.do_test(
[],
NOT_CONSIDERED,
[r'\blightgreen\b.*>1</a> to .*>2<',
r'autopkgtest for lightgreen 2: .*amd64.*Regression.*i386.*Regression'],
['in progress'])
with open(os.path.join(self.data.path, 'data/series-proposed/autopkgtest/results.cache')) as f:
contents = f.read()
self.assertNotIn('null', contents)
self.assertNotIn('None', contents)
def test_rerun_failure(self):
'''manually re-running failed tests gets picked up'''