From 3ce7dc3d843f31dc3c8cab79a08b83bc8c5e0d84 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 14 Jul 2015 20:19:01 +0200 Subject: [PATCH] Add test case for previous commit --- tests/mock_swift.py | 9 +++++---- tests/test_autopkgtest.py | 24 ++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/tests/mock_swift.py b/tests/mock_swift.py index c5d294a..9ef7492 100644 --- a/tests/mock_swift.py +++ b/tests/mock_swift.py @@ -60,10 +60,11 @@ class SwiftHTTPRequestHandler(BaseHTTPRequestHandler): ti.size = len(contents) results.addfile(ti, io.BytesIO(contents)) # add testpkg-version - contents = pkgver.encode() - ti = tarfile.TarInfo('testpkg-version') - ti.size = len(contents) - results.addfile(ti, io.BytesIO(contents)) + if pkgver is not None: + contents = pkgver.encode() + ti = tarfile.TarInfo('testpkg-version') + ti.size = len(contents) + results.addfile(ti, io.BytesIO(contents)) self.wfile.write(tar.getvalue()) def list_container(self, container, query): diff --git a/tests/test_autopkgtest.py b/tests/test_autopkgtest.py index eacb266..b1fcf23 100644 --- a/tests/test_autopkgtest.py +++ b/tests/test_autopkgtest.py @@ -100,10 +100,10 @@ echo "$@" >> /%s/adt-britney.log ''' % self.data.path) if excuses_expect: for re in excuses_expect: - self.assertRegexpMatches(excuses, re) + self.assertRegexpMatches(excuses, re, excuses) if excuses_no_expect: for re in excuses_no_expect: - self.assertNotRegexpMatches(excuses, re) + self.assertNotRegexpMatches(excuses, re, excuses) self.amqp_requests = set() try: @@ -297,6 +297,26 @@ lightgreen 2 i386 lightgreen 2 ''' self.assertEqual(self.pending_requests, expected_pending) + def test_tmpfail(self): + '''tmpfail result is considered a failure''' + + # one tmpfail result without testpkg-version + self.swift.set_results({'autopkgtest-series': { + 'series/i386/l/lightgreen/20150101_100101@': (16, None), + 'series/amd64/l/lightgreen/20150101_100101@': (16, 'lightgreen 2'), + }}) + + self.do_test( + [('lightgreen', {'Version': '2', 'Depends': 'libgreen1 (>= 1)'}, 'autopkgtest')], + # FIXME: while we only submit requests through AMQP, but don't consider + # their results, we don't expect this to hold back stuff. + VALID_CANDIDATE, + [r'\blightgreen\b.*>1 to .*>2<', + r'autopkgtest for lightgreen 2: .*amd64.*Regression.*i386.*Regression'], + ['in progress']) + + self.assertEqual(self.pending_requests, '') + def test_no_amqp_config(self): '''Run without autopkgtest requests'''