diff --git a/autopkgtest.py b/autopkgtest.py index 5ab9c8d..5260609 100644 --- a/autopkgtest.py +++ b/autopkgtest.py @@ -269,6 +269,8 @@ class AutoPackageTest(object): f = urlopen(url) if f.getcode() == 200: result_paths = f.read().strip().splitlines() + elif f.getcode() == 204: # No content + result_paths = [] else: self.log_error('Failure to fetch swift results from %s: %u' % (url, f.getcode())) diff --git a/tests/mock_swift.py b/tests/mock_swift.py index 277e9d6..c5d294a 100644 --- a/tests/mock_swift.py +++ b/tests/mock_swift.py @@ -85,7 +85,7 @@ class SwiftHTTPRequestHandler(BaseHTTPRequestHandler): find_adapter = lambda i: (i >= 0) and (i + 1) or None objs = set([o[:find_adapter(o.find(d))] for o in objs]) - self.send_response(200) + self.send_response(objs and 200 or 204) # 204: "No Content" self.send_header('Content-type', 'text/plain') self.end_headers() self.wfile.write(('\n'.join(sorted(objs)) + '\n').encode('UTF-8')) diff --git a/tests/test_autopkgtest.py b/tests/test_autopkgtest.py index 8fe3654..eacb266 100644 --- a/tests/test_autopkgtest.py +++ b/tests/test_autopkgtest.py @@ -247,7 +247,7 @@ lightgreen 1 i386 green 2 'series/amd64/g/green/20150101_100201@': (4, 'green 2'), }}) - self.do_test( + out = self.do_test( [], # FIXME: while we only submit requests through AMQP, but don't consider # their results, we don't expect this to hold back stuff. @@ -257,6 +257,9 @@ lightgreen 1 i386 green 2 r'autopkgtest for lightgreen 1: .*amd64.*Regression.*i386.*in progress', r'autopkgtest for darkgreen 1: .*amd64.*in progress.*i386.*Pass']) + # not expecting any failures to retrieve from swift + self.assertNotIn('Failure', out, out) + # there should be some pending ones self.assertIn('darkgreen 1 amd64 green 2', self.pending_requests) self.assertIn('lightgreen 1 i386 green 2', self.pending_requests)