added option to ansible-test to run test playbooks using the debug strategy (#26499)
This commit is contained in:
parent
3050856f2a
commit
294c0f91c0
4 changed files with 9 additions and 1 deletions
|
@ -140,6 +140,7 @@ class IntegrationConfig(TestConfig):
|
||||||
self.start_at_task = args.start_at_task # type: str
|
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.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.retry_on_error = args.retry_on_error # type: bool
|
||||||
|
self.debug_strategy = args.debug_strategy # type: bool
|
||||||
self.tags = args.tags
|
self.tags = args.tags
|
||||||
self.skip_tags = args.skip_tags
|
self.skip_tags = args.skip_tags
|
||||||
self.diff = args.diff
|
self.diff = args.diff
|
||||||
|
|
|
@ -183,7 +183,7 @@ def delegate_docker(args, exclude, require):
|
||||||
|
|
||||||
cmd_options = []
|
cmd_options = []
|
||||||
|
|
||||||
if isinstance(args, ShellConfig):
|
if isinstance(args, ShellConfig) or (isinstance(args, IntegrationConfig) and args.debug_strategy):
|
||||||
cmd_options.append('-it')
|
cmd_options.append('-it')
|
||||||
|
|
||||||
with tempfile.NamedTemporaryFile(prefix='ansible-source-', suffix='.tgz') as local_source_fd:
|
with tempfile.NamedTemporaryFile(prefix='ansible-source-', suffix='.tgz') as local_source_fd:
|
||||||
|
|
|
@ -595,6 +595,9 @@ def integration_environment(args, target, cmd):
|
||||||
ANSIBLE_CALLBACK_WHITELIST='junit',
|
ANSIBLE_CALLBACK_WHITELIST='junit',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if args.debug_strategy:
|
||||||
|
env.update(dict(ANSIBLE_STRATEGY='debug'))
|
||||||
|
|
||||||
env.update(integration)
|
env.update(integration)
|
||||||
|
|
||||||
cloud_environment = get_cloud_environment(args, target)
|
cloud_environment = get_cloud_environment(args, target)
|
||||||
|
|
|
@ -216,6 +216,10 @@ def parse_args():
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help='retry failed test with increased verbosity')
|
help='retry failed test with increased verbosity')
|
||||||
|
|
||||||
|
integration.add_argument('--debug-strategy',
|
||||||
|
action='store_true',
|
||||||
|
help='run test playbooks using the debug strategy')
|
||||||
|
|
||||||
subparsers = parser.add_subparsers(metavar='COMMAND')
|
subparsers = parser.add_subparsers(metavar='COMMAND')
|
||||||
subparsers.required = True # work-around for python 3 bug which makes subparsers optional
|
subparsers.required = True # work-around for python 3 bug which makes subparsers optional
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue