From 1848597433951bf7cf432a197960372243399549 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Mon, 13 Feb 2023 11:03:59 +0100 Subject: [PATCH] Support PPAs which have fingerprint enabled in them. --- britney2/policies/autopkgtest.py | 6 ++++++ tests/test_autopkgtest.py | 26 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/britney2/policies/autopkgtest.py b/britney2/policies/autopkgtest.py index c80adf1..385d7c9 100644 --- a/britney2/policies/autopkgtest.py +++ b/britney2/policies/autopkgtest.py @@ -142,6 +142,12 @@ class AutopkgtestPolicy(BasePolicy): try: self.options.adt_ppas = self.options.adt_ppas.strip().split() + # We also allow, for certain other use-cases, passing the PPA + # fingerprint to for each of the PPAs. This however is not + # currently used by the ADT policy, so get rid of it. + for i, ppa in enumerate(self.options.adt_ppas): + if '@' not in ppa and ':' in ppa: + self.options.adt_ppas[i] = ppa.split(':')[0] except AttributeError: self.options.adt_ppas = [] diff --git a/tests/test_autopkgtest.py b/tests/test_autopkgtest.py index 8235a0c..25185ac 100644 --- a/tests/test_autopkgtest.py +++ b/tests/test_autopkgtest.py @@ -2546,6 +2546,32 @@ class AT(TestAutopkgtestBase): self.assertEqual(self.amqp_requests, set()) self.assertEqual(self.pending_requests, {}) + def test_ppas_fingerprint(self): + '''Run test requests with PPAs where fingerprint is provided''' + + self.data.add_default_packages(lightgreen=False) + + for line in fileinput.input(self.britney_conf, inplace=True): + if line.startswith('ADT_PPAS'): + print('ADT_PPAS = joe/foo:fingerprint awesome-developers/staging') + else: + sys.stdout.write(line) + + exc = self.run_it( + [('lightgreen', {'Version': '2'}, 'autopkgtest')], + {'lightgreen': (True, {'lightgreen': {'amd64': 'RUNNING-ALWAYSFAIL'}})}, + {'lightgreen': [('old-version', '1'), ('new-version', '2')]} + )[1] + + for arch in ['i386', 'amd64']: + self.assertTrue( + ('debci-ppa-testing-%s:lightgreen {"triggers": ["lightgreen/2"], ' + '"ppas": ["joe/foo", "awesome-developers/staging"]}') % arch in self.amqp_requests or + ('debci-ppa-testing-%s:lightgreen {"ppas": ["joe/foo", ' + '"awesome-developers/staging"], "triggers": ["lightgreen/2"]}') % arch in self.amqp_requests, + self.amqp_requests) + self.assertEqual(len(self.amqp_requests), 2) + def test_private_ppas(self): '''Run test requests with an additional private PPA'''