From d08ff86169b84f50af3f550cfd717dd2b4172891 Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bonicoli Date: Thu, 25 May 2017 16:47:52 +0200 Subject: [PATCH] ansible-test: pass --[skip-]tags to ansible-playbook Thanks to Olaf Klischat for the idea. --- test/runner/lib/executor.py | 8 ++++++++ test/runner/test.py | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/test/runner/lib/executor.py b/test/runner/lib/executor.py index 19c2a4d54d6..302d5576401 100644 --- a/test/runner/lib/executor.py +++ b/test/runner/lib/executor.py @@ -665,6 +665,12 @@ def command_integration_role(args, target, start_at_task): if start_at_task: cmd += ['--start-at-task', start_at_task] + if args.tags: + cmd += ['--tags', args.tags] + + if args.skip_tags: + cmd += ['--skip-tags', args.skip_tags] + if args.verbosity: cmd.append('-' + ('v' * args.verbosity)) @@ -1309,6 +1315,8 @@ class IntegrationConfig(TestConfig): self.start_at_task = args.start_at_task # type: str self.allow_destructive = args.allow_destructive if 'allow_destructive' in args else False # type: bool self.retry_on_error = args.retry_on_error # type: bool + self.tags = args.tags + self.skip_tags = args.skip_tags class PosixIntegrationConfig(IntegrationConfig): diff --git a/test/runner/test.py b/test/runner/test.py index e19e9899845..8722e6e56b1 100755 --- a/test/runner/test.py +++ b/test/runner/test.py @@ -193,6 +193,14 @@ def parse_args(): metavar='TASK', help='start at the specified task') + integration.add_argument('--tags', + metavar='TAGS', + help='only run plays and tasks tagged with these values') + + integration.add_argument('--skip-tags', + metavar='TAGS', + help='only run plays and tasks whose tags do not match these values') + integration.add_argument('--allow-destructive', action='store_true', help='allow destructive tests (--local and --tox only)')