Add a dry-run option for the autopkgtest policy specifically

For rolling out britney on a new machine, we want to generate update_excuses
and update_output to confirm it's working correctly all the way through, so
we don't want to use the global --dry-run option; but we *do* want to
disable queuing tests and instead let the production instance of britney
queue the tests while we simply query the results.  Add support for
ADT_ENABLE=dry-run in britney.conf, parallelling the behavior of other
policies.
less-recipients
Steve Langasek 2 years ago
parent de19e280b2
commit e5247de7b8

@ -521,8 +521,9 @@ class Britney(object):
self._policy_engine.add_policy(RCBugPolicy(self.options, self.suite_info)) self._policy_engine.add_policy(RCBugPolicy(self.options, self.suite_info))
if getattr(self.options, 'piuparts_enable', 'yes') == 'yes': if getattr(self.options, 'piuparts_enable', 'yes') == 'yes':
self._policy_engine.add_policy(PiupartsPolicy(self.options, self.suite_info)) self._policy_engine.add_policy(PiupartsPolicy(self.options, self.suite_info))
if getattr(self.options, 'adt_enable') == 'yes': add_autopkgtest_policy = getattr(self.options, 'adt_enable', 'no')
self._policy_engine.add_policy(AutopkgtestPolicy(self.options, self.suite_info)) if add_autopkgtest_policy in ('yes', 'dry-run'):
self._policy_engine.add_policy(AutopkgtestPolicy(self.options, self.suite_info, dry_run=add_autopkgtest_policy))
self._policy_engine.add_policy(AgePolicy(self.options, self.suite_info, MINDAYS)) self._policy_engine.add_policy(AgePolicy(self.options, self.suite_info, MINDAYS))
# XXX this policy results in asymmetric enforcement of # XXX this policy results in asymmetric enforcement of
# build-dependencies in the release pocket (nothing blocks # build-dependencies in the release pocket (nothing blocks

@ -117,7 +117,8 @@ class AutopkgtestPolicy(BasePolicy):
reject the upload if any of those regress. reject the upload if any of those regress.
""" """
def __init__(self, options, suite_info): def __init__(self, options, suite_info, dry_run=False):
super().__init__('autopkgtest', options, suite_info, {SuiteClass.PRIMARY_SOURCE_SUITE}) super().__init__('autopkgtest', options, suite_info, {SuiteClass.PRIMARY_SOURCE_SUITE})
# tests requested in this and previous runs # tests requested in this and previous runs
# trigger -> src -> [arch] # trigger -> src -> [arch]
@ -126,6 +127,7 @@ class AutopkgtestPolicy(BasePolicy):
self.testsuite_triggers = {} self.testsuite_triggers = {}
self.result_in_baseline_cache = collections.defaultdict(dict) self.result_in_baseline_cache = collections.defaultdict(dict)
self.database_path = os.path.join(self.state_dir, 'autopkgtest.db') self.database_path = os.path.join(self.state_dir, 'autopkgtest.db')
self.dry_run = dry_run
# results map: trigger -> src -> arch -> [passed, version, run_id, seen] # results map: trigger -> src -> arch -> [passed, version, run_id, seen]
# - trigger is "source/version" of an unstable package that triggered # - trigger is "source/version" of an unstable package that triggered
@ -292,7 +294,7 @@ class AutopkgtestPolicy(BasePolicy):
# Initialize AMQP connection # Initialize AMQP connection
self.amqp_channel = None self.amqp_channel = None
self.amqp_file = None self.amqp_file = None
if self.options.dry_run: if self.options.dry_run or self.dry_run:
return return
amqp_url = self.options.adt_amqp amqp_url = self.options.adt_amqp
@ -1117,7 +1119,7 @@ class AutopkgtestPolicy(BasePolicy):
If huge is true, then the request will be put into the -huge instead of If huge is true, then the request will be put into the -huge instead of
normal queue. normal queue.
''' '''
if self.options.dry_run: if self.options.dry_run or self.dry_run:
return return
params = {'triggers': triggers} params = {'triggers': triggers}

Loading…
Cancel
Save