diff --git a/autopkgtest.py b/autopkgtest.py index 7bf7113..aa97c52 100644 --- a/autopkgtest.py +++ b/autopkgtest.py @@ -558,6 +558,8 @@ class AutoPackageTest(object): triggers = _trigsources(verinfo, arch) for t in sorted(triggers): params = {'triggers': [t]} + if self.britney.options.adt_ppas: + params['ppas'] = self.britney.options.adt_ppas requests.append((pkg, json.dumps(params))) arch_queues[arch] = ('debci-%s-%s' % (self.series, arch), requests) diff --git a/britney.conf b/britney.conf index 0d3d93f..2b8bf45 100644 --- a/britney.conf +++ b/britney.conf @@ -69,6 +69,9 @@ ADT_ARCHES = amd64 i386 armhf ppc64el 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 +# space separate list of PPAs to add for test requests; the *last* one +# determines the swift container name +ADT_PPAS = BOOTTEST_ENABLE = no BOOTTEST_DEBUG = yes diff --git a/britney.py b/britney.py index 296b195..727c5b0 100755 --- a/britney.py +++ b/britney.py @@ -479,6 +479,7 @@ class Britney(object): else: self.__log("Ignoring ADT_ARCHES %s as it is not in architectures list" % arch) self.options.adt_arches = adt_arches + self.options.adt_ppas = self.options.adt_ppas.strip().split() def __log(self, msg, type="I"): """Print info messages according to verbosity level diff --git a/tests/test_autopkgtest.py b/tests/test_autopkgtest.py index 60afc8d..5c28d36 100755 --- a/tests/test_autopkgtest.py +++ b/tests/test_autopkgtest.py @@ -1209,26 +1209,6 @@ lightgreen 1 i386 green 3 {'lightgreen': [('old-version', '1'), ('new-version', '2')]} ) - def test_disable_adt(self): - '''Run without autopkgtest requests''' - - # 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 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) - - exc = self.do_test( - [('libgreen1', {'Version': '2', 'Source': 'green', 'Depends': 'libc6'}, 'autopkgtest')], - {'green': (True, {})}, - {'green': [('old-version', '1'), ('new-version', '2')]})[1] - self.assertNotIn('autopkgtest', exc['green']['tests']) - - self.assertEqual(self.amqp_requests, set()) - self.assertEqual(self.pending_requests, None) - ################################################################ # Tests for hint processing ################################################################ @@ -1565,6 +1545,50 @@ fancy 1 i386 linux-meta-lts-grumpy 1 {'gcc-snapshot': (True, {})})[1] self.assertNotIn('autopkgtest', exc['gcc-snapshot']['tests']) + ################################################################ + # Tests for non-default ADT_* configuration modes + ################################################################ + + def test_disable_adt(self): + '''Run without autopkgtest requests''' + + # 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 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) + + exc = self.do_test( + [('libgreen1', {'Version': '2', 'Source': 'green', 'Depends': 'libc6'}, 'autopkgtest')], + {'green': (True, {})}, + {'green': [('old-version', '1'), ('new-version', '2')]})[1] + self.assertNotIn('autopkgtest', exc['green']['tests']) + + self.assertEqual(self.amqp_requests, set()) + self.assertEqual(self.pending_requests, None) + + def test_ppas(self): + '''Run test requests with additional PPAs''' + + for line in fileinput.input(self.britney_conf, inplace=True): + if line.startswith('ADT_PPAS'): + print('ADT_PPAS = joe/foo awesome-developers/staging') + else: + sys.stdout.write(line) + + self.do_test( + [('lightgreen', {'Version': '2'}, 'autopkgtest')], + {'lightgreen': (True, {'lightgreen 2': {'amd64': 'RUNNING-ALWAYSFAILED'}})}, + {'lightgreen': [('old-version', '1'), ('new-version', '2')]} + ) + + self.assertEqual( + self.amqp_requests, + set(['debci-series-amd64:lightgreen {"triggers": ["lightgreen/2"], "ppas": ["joe/foo", "awesome-developers/staging"]}', + 'debci-series-i386:lightgreen {"triggers": ["lightgreen/2"], "ppas": ["joe/foo", "awesome-developers/staging"]}'])) + if __name__ == '__main__': unittest.main()