From e85c59b46ac2f770e94f385ed028380452efb491 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 14 Aug 2015 09:54:18 +0200 Subject: [PATCH] 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. --- autopkgtest.py | 22 +++------------------- britney.conf | 1 - britney_nobreakall.conf | 1 - tests/test_autopkgtest.py | 9 ++++++--- 4 files changed, 9 insertions(+), 24 deletions(-) diff --git a/autopkgtest.py b/autopkgtest.py index 4fd18d5..9650486 100644 --- a/autopkgtest.py +++ b/autopkgtest.py @@ -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: diff --git a/britney.conf b/britney.conf index 0be7171..37ac8ed 100644 --- a/britney.conf +++ b/britney.conf @@ -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 diff --git a/britney_nobreakall.conf b/britney_nobreakall.conf index 8012f6e..eeec806 100644 --- a/britney_nobreakall.conf +++ b/britney_nobreakall.conf @@ -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 diff --git a/tests/test_autopkgtest.py b/tests/test_autopkgtest.py index 2d69e69..243074e 100644 --- a/tests/test_autopkgtest.py +++ b/tests/test_autopkgtest.py @@ -912,12 +912,15 @@ lightgreen 1 i386 green 3 [r'\bdkms\b.*>1 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(