Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

molecule test add support of ansible args #3166

Merged
merged 3 commits into from
Jun 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/molecule/command/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ class Test(base.Base):

Target all scenarios.

.. option:: molecule test -- -vvv --tags foo,bar

Providing additional command line arguments to the `ansible-playbook`
command. Use this option with care, as there is no sanitation or
validation of input. Options passed on the CLI are combined with options
provided in provisioner's `options` section of `molecule.yml`.

.. program:: molecule test --destroy=always

.. option:: molecule test --destroy=always
Expand Down Expand Up @@ -129,7 +136,10 @@ def execute(self):
default=MOLECULE_PARALLEL,
help="Enable or disable parallel mode. Default is disabled.",
)
def test(ctx, scenario_name, driver_name, __all, destroy, parallel): # pragma: no cover
@click.argument("ansible_args", nargs=-1, type=click.UNPROCESSED)
def test(
ctx, scenario_name, driver_name, __all, destroy, parallel, ansible_args
): # pragma: no cover
"""Test (dependency, lint, cleanup, destroy, syntax, create, prepare, converge, idempotence, side_effect, verify, cleanup, destroy)."""
args = ctx.obj.get("args")
subcommand = base._get_subcommand(__name__)
Expand All @@ -146,4 +156,4 @@ def test(ctx, scenario_name, driver_name, __all, destroy, parallel): # pragma:
if parallel:
util.validate_parallel_cmd_args(command_args)

base.execute_cmdline_scenarios(scenario_name, args, command_args)
base.execute_cmdline_scenarios(scenario_name, args, command_args, ansible_args)