Always require ADT_{AMQP,SWIFT_URL} with ADT_ENABLE

Disabling AMQP requests with "ADT_ENABLE = yes" but ADT_AMQP unset made sense
while we still supported adt-britney. But as that's gone now, let's use the
ADT_ENABLE switch only, and if it's on, require ADT_AMQP and ADT_SWIFT_URL be
set.

This simplifies the code a bit and is less confusing.
bzr-import-20160707
Martin Pitt 10 years ago
parent 65b2686232
commit e85c59b46a

@ -431,11 +431,7 @@ class AutoPackageTest(object):
for arch in self.britney.options.adt_arches.split():
arch_queues[arch] = 'debci-%s-%s' % (self.series, arch)
try:
amqp_url = self.britney.options.adt_amqp
except AttributeError:
self.log_error('ADT_AMQP not set, cannot submit requests')
return
amqp_url = self.britney.options.adt_amqp
def _arches(verinfo):
res = set()
@ -466,25 +462,13 @@ class AutoPackageTest(object):
self.update_pending_tests()
def collect(self, packages):
# fetch results from swift
try:
swift_url = self.britney.options.adt_swift_url
except AttributeError:
self.log_error('ADT_SWIFT_URL not set, cannot collect results')
return
try:
self.britney.options.adt_amqp
except AttributeError:
self.log_error('ADT_AMQP not set, not collecting results from swift')
return
# update results from swift for all packages that we are waiting
# for, and remove pending tests that we have results for on all
# arches
for pkg, verinfo in copy.deepcopy(self.pending_tests.items()):
for archinfo in verinfo.values():
for arch in archinfo:
self.fetch_swift_results(swift_url, pkg, arch)
self.fetch_swift_results(self.britney.options.adt_swift_url, pkg, arch)
# also update results for excuses whose tests failed, in case a
# manual retry worked
for (trigpkg, trigver) in packages:
@ -492,7 +476,7 @@ class AutoPackageTest(object):
for (pkg, arch) in self.failed_tests_for_trigger(trigpkg, trigver):
self.log_verbose('Checking for new results for failed %s on %s for trigger %s/%s' %
(pkg, arch, trigpkg, trigver))
self.fetch_swift_results(swift_url, pkg, arch, (trigpkg, trigver))
self.fetch_swift_results(self.britney.options.adt_swift_url, pkg, arch, (trigpkg, trigver))
# update the results cache
with open(self.results_cache_file + '.new', 'w') as f:

@ -66,7 +66,6 @@ REMOVE_OBSOLETE = no
ADT_ENABLE = yes
ADT_DEBUG = no
ADT_ARCHES = amd64 i386
# comment this to disable autopkgtest requests
ADT_AMQP = amqp://test_request:password@162.213.33.228
# Swift base URL with the results (must be publicly readable and browsable)
ADT_SWIFT_URL = https://objectstorage.prodstack4-5.canonical.com/v1/AUTH_77e2ada1e7a84929a74ba3b87153c0ac

@ -66,7 +66,6 @@ REMOVE_OBSOLETE = no
ADT_ENABLE = yes
ADT_DEBUG = no
ADT_ARCHES = amd64 i386
# comment this to disable autopkgtest requests
ADT_AMQP = amqp://test_request:password@162.213.33.228
# Swift base URL with the results (must be publicly readable and browsable)
ADT_SWIFT_URL = https://objectstorage.prodstack4-5.canonical.com/v1/AUTH_77e2ada1e7a84929a74ba3b87153c0ac

@ -912,12 +912,15 @@ lightgreen 1 i386 green 3
[r'\bdkms\b.*>1</a> to .*>2<',
r'autopkgtest for fancy 1: .*amd64.*in progress.*i386.*in progress'])
def test_no_amqp_config(self):
def test_disable_adt(self):
'''Run without autopkgtest requests'''
# Disable AMQP server config
# Disable AMQP server config, to ensure we don't touch them with ADT
# disabled
for line in fileinput.input(self.britney_conf, inplace=True):
if not line.startswith('ADT_AMQP') and not line.startswith('ADT_SWIFT_URL'):
if line.startswith('ADT_ENABLE'):
print('ADT_ENABLE = no')
elif not line.startswith('ADT_AMQP') and not line.startswith('ADT_SWIFT_URL'):
sys.stdout.write(line)
self.do_test(

Loading…
Cancel
Save