Enable minimal testing
This commit is contained in:
9
molecule_hetznercloud/test/functional/.ansible-lint
Normal file
9
molecule_hetznercloud/test/functional/.ansible-lint
Normal file
@ -0,0 +1,9 @@
|
||||
# ansible-lint config for functional testing, used to bypass expected metadata
|
||||
# errors in molecule-generated roles. Loaded via the metadata_lint_update
|
||||
# pytest helper. For reference, see "E7xx - metadata" in:
|
||||
# https://docs.ansible.com/ansible-lint/rules/default_rules.html
|
||||
skip_list:
|
||||
# metadata/701 - Role info should contain platforms
|
||||
- '701'
|
||||
# metadata/703 - Should change default metadata: <field>"
|
||||
- '703'
|
0
molecule_hetznercloud/test/functional/__init__.py
Normal file
0
molecule_hetznercloud/test/functional/__init__.py
Normal file
246
molecule_hetznercloud/test/functional/conftest.py
Normal file
246
molecule_hetznercloud/test/functional/conftest.py
Normal file
@ -0,0 +1,246 @@
|
||||
# Copyright (c) 2015-2018 Cisco Systems, Inc.
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
# DEALINGS IN THE SOFTWARE.
|
||||
|
||||
import os
|
||||
import pkg_resources
|
||||
import shutil
|
||||
|
||||
import pexpect
|
||||
import pytest
|
||||
import sh
|
||||
|
||||
from molecule import logger
|
||||
from molecule import util
|
||||
|
||||
from ..conftest import change_dir_to
|
||||
|
||||
LOG = logger.get_logger(__name__)
|
||||
|
||||
IS_TRAVIS = os.getenv("TRAVIS") and os.getenv("CI")
|
||||
|
||||
|
||||
def _env_vars_exposed(env_vars, env=os.environ):
|
||||
"""Check if environment variables are exposed and populated."""
|
||||
for env_var in env_vars:
|
||||
if env_var not in os.environ:
|
||||
return False
|
||||
return os.environ[env_var] != ""
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def with_scenario(request, scenario_to_test, driver_name, scenario_name, skip_test):
|
||||
scenario_directory = os.path.join(
|
||||
os.path.dirname(util.abs_path(__file__)),
|
||||
os.path.pardir,
|
||||
"scenarios",
|
||||
scenario_to_test,
|
||||
)
|
||||
|
||||
with change_dir_to(scenario_directory):
|
||||
yield
|
||||
if scenario_name:
|
||||
msg = "CLEANUP: Destroying instances for all scenario(s)"
|
||||
LOG.out(msg)
|
||||
options = {"driver_name": driver_name, "all": True}
|
||||
cmd = sh.molecule.bake("destroy", **options)
|
||||
pytest.helpers.run_command(cmd)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def skip_test(request, driver_name):
|
||||
msg_tmpl = (
|
||||
"Ignoring '{}' tests for now"
|
||||
if driver_name == "delegated"
|
||||
else "Skipped '{}' not supported"
|
||||
)
|
||||
support_checks_map = {
|
||||
"hetznercloud": lambda: min_ansible("2.8") and supports_hetznercloud()
|
||||
}
|
||||
try:
|
||||
check_func = support_checks_map[driver_name]
|
||||
if not check_func():
|
||||
pytest.skip(msg_tmpl.format(driver_name))
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
|
||||
@pytest.helpers.register
|
||||
def idempotence(scenario_name):
|
||||
options = {"scenario_name": scenario_name}
|
||||
cmd = sh.molecule.bake("create", **options)
|
||||
pytest.helpers.run_command(cmd)
|
||||
|
||||
options = {"scenario_name": scenario_name}
|
||||
cmd = sh.molecule.bake("converge", **options)
|
||||
pytest.helpers.run_command(cmd)
|
||||
|
||||
options = {"scenario_name": scenario_name}
|
||||
cmd = sh.molecule.bake("idempotence", **options)
|
||||
pytest.helpers.run_command(cmd)
|
||||
|
||||
|
||||
@pytest.helpers.register
|
||||
def init_role(temp_dir, driver_name):
|
||||
role_directory = os.path.join(temp_dir.strpath, "test-init")
|
||||
|
||||
cmd = sh.molecule.bake(
|
||||
"init", "role", {"driver-name": driver_name, "role-name": "test-init"}
|
||||
)
|
||||
pytest.helpers.run_command(cmd)
|
||||
pytest.helpers.metadata_lint_update(role_directory)
|
||||
|
||||
with change_dir_to(role_directory):
|
||||
options = {"all": True}
|
||||
cmd = sh.molecule.bake("test", **options)
|
||||
pytest.helpers.run_command(cmd)
|
||||
|
||||
|
||||
@pytest.helpers.register
|
||||
def init_scenario(temp_dir, driver_name):
|
||||
role_directory = os.path.join(temp_dir.strpath, "test-init")
|
||||
cmd = sh.molecule.bake(
|
||||
"init", "role", {"driver-name": driver_name, "role-name": "test-init"}
|
||||
)
|
||||
pytest.helpers.run_command(cmd)
|
||||
pytest.helpers.metadata_lint_update(role_directory)
|
||||
|
||||
with change_dir_to(role_directory):
|
||||
molecule_directory = pytest.helpers.molecule_directory()
|
||||
scenario_directory = os.path.join(molecule_directory, "test-scenario")
|
||||
|
||||
options = {"scenario_name": "test-scenario", "role_name": "test-init"}
|
||||
cmd = sh.molecule.bake("init", "scenario", **options)
|
||||
pytest.helpers.run_command(cmd)
|
||||
|
||||
assert os.path.isdir(scenario_directory)
|
||||
|
||||
options = {"scenario_name": "test-scenario", "all": True}
|
||||
cmd = sh.molecule.bake("test", **options)
|
||||
pytest.helpers.run_command(cmd)
|
||||
|
||||
|
||||
@pytest.helpers.register
|
||||
def metadata_lint_update(role_directory):
|
||||
ansible_lint_src = os.path.join(
|
||||
os.path.dirname(util.abs_path(__file__)), ".ansible-lint"
|
||||
)
|
||||
|
||||
shutil.copy(ansible_lint_src, role_directory)
|
||||
|
||||
with change_dir_to(role_directory):
|
||||
cmd = sh.ansible_lint.bake(".")
|
||||
pytest.helpers.run_command(cmd)
|
||||
|
||||
|
||||
@pytest.helpers.register
|
||||
def list(x):
|
||||
cmd = sh.molecule.bake("list")
|
||||
out = pytest.helpers.run_command(cmd, log=False)
|
||||
out = out.stdout.decode("utf-8")
|
||||
out = util.strip_ansi_color(out)
|
||||
|
||||
for l in x.splitlines():
|
||||
assert l in out
|
||||
|
||||
|
||||
@pytest.helpers.register
|
||||
def list_with_format_plain(x):
|
||||
cmd = sh.molecule.bake("list", {"format": "plain"})
|
||||
out = pytest.helpers.run_command(cmd, log=False)
|
||||
out = out.stdout.decode("utf-8")
|
||||
out = util.strip_ansi_color(out)
|
||||
|
||||
for l in x.splitlines():
|
||||
assert l in out
|
||||
|
||||
|
||||
@pytest.helpers.register
|
||||
def login(login_args, scenario_name="default"):
|
||||
options = {"scenario_name": scenario_name}
|
||||
cmd = sh.molecule.bake("destroy", **options)
|
||||
pytest.helpers.run_command(cmd)
|
||||
|
||||
options = {"scenario_name": scenario_name}
|
||||
cmd = sh.molecule.bake("create", **options)
|
||||
pytest.helpers.run_command(cmd)
|
||||
|
||||
for instance, regexp in login_args:
|
||||
if len(login_args) > 1:
|
||||
child_cmd = "molecule login --host {} --scenario-name {}".format(
|
||||
instance, scenario_name
|
||||
)
|
||||
else:
|
||||
child_cmd = "molecule login --scenario-name {}".format(scenario_name)
|
||||
child = pexpect.spawn(child_cmd)
|
||||
child.expect(regexp)
|
||||
child.sendline("exit")
|
||||
|
||||
|
||||
@pytest.helpers.register
|
||||
def test(driver_name, scenario_name="default", parallel=False):
|
||||
options = {
|
||||
"scenario_name": scenario_name,
|
||||
"all": scenario_name is None,
|
||||
"parallel": parallel,
|
||||
}
|
||||
|
||||
if driver_name == "delegated":
|
||||
options = {"scenario_name": scenario_name}
|
||||
|
||||
cmd = sh.molecule.bake("test", **options)
|
||||
pytest.helpers.run_command(cmd)
|
||||
|
||||
|
||||
@pytest.helpers.register
|
||||
def verify(scenario_name="default"):
|
||||
options = {"scenario_name": scenario_name}
|
||||
cmd = sh.molecule.bake("create", **options)
|
||||
pytest.helpers.run_command(cmd)
|
||||
|
||||
options = {"scenario_name": scenario_name}
|
||||
cmd = sh.molecule.bake("converge", **options)
|
||||
pytest.helpers.run_command(cmd)
|
||||
|
||||
options = {"scenario_name": scenario_name}
|
||||
cmd = sh.molecule.bake("verify", **options)
|
||||
pytest.helpers.run_command(cmd)
|
||||
|
||||
|
||||
def min_ansible(version):
|
||||
"""Ensure current Ansible is newer than a given a minimal one."""
|
||||
try:
|
||||
from ansible.release import __version__
|
||||
|
||||
return pkg_resources.parse_version(__version__) >= pkg_resources.parse_version(
|
||||
version
|
||||
)
|
||||
except ImportError as exception:
|
||||
LOG.error("Unable to parse Ansible version", exc_info=exception)
|
||||
return False
|
||||
|
||||
|
||||
@pytest.helpers.register
|
||||
def supports_hetznercloud():
|
||||
pytest.importorskip("hcloud")
|
||||
|
||||
env_vars = ("HCLOUD_TOKEN",)
|
||||
|
||||
return _env_vars_exposed(env_vars)
|
312
molecule_hetznercloud/test/functional/test_command.py
Normal file
312
molecule_hetznercloud/test/functional/test_command.py
Normal file
@ -0,0 +1,312 @@
|
||||
# Copyright (c) 2015-2018 Cisco Systems, Inc.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
# DEALINGS IN THE SOFTWARE.
|
||||
|
||||
import os
|
||||
|
||||
import pytest
|
||||
import sh
|
||||
from molecule.scenario import ephemeral_directory
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def scenario_to_test(request):
|
||||
return request.param
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def scenario_name(request):
|
||||
try:
|
||||
return request.param
|
||||
except AttributeError:
|
||||
return None
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def driver_name(request):
|
||||
return request.param
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"scenario_to_test, driver_name, scenario_name",
|
||||
[("driver/hetznercloud", "hetznercloud", "default")],
|
||||
indirect=["scenario_to_test", "driver_name", "scenario_name"],
|
||||
)
|
||||
def test_command_check(scenario_to_test, with_scenario, scenario_name):
|
||||
options = {"scenario_name": scenario_name}
|
||||
cmd = sh.molecule.bake("check", **options)
|
||||
pytest.helpers.run_command(cmd)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"scenario_to_test, driver_name, scenario_name",
|
||||
[("driver/hetznercloud", "hetznercloud", "default")],
|
||||
indirect=["scenario_to_test", "driver_name", "scenario_name"],
|
||||
)
|
||||
def test_command_cleanup(scenario_to_test, with_scenario, scenario_name):
|
||||
options = {"scenario_name": scenario_name}
|
||||
cmd = sh.molecule.bake("cleanup", **options)
|
||||
pytest.helpers.run_command(cmd)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"scenario_to_test, driver_name, scenario_name",
|
||||
[("driver/hetznercloud", "hetznercloud", "default")],
|
||||
indirect=["scenario_to_test", "driver_name", "scenario_name"],
|
||||
)
|
||||
def test_command_converge(scenario_to_test, with_scenario, scenario_name):
|
||||
options = {"scenario_name": scenario_name}
|
||||
cmd = sh.molecule.bake("converge", **options)
|
||||
pytest.helpers.run_command(cmd)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"scenario_to_test, driver_name, scenario_name",
|
||||
[("driver/hetznercloud", "hetznercloud", "default")],
|
||||
indirect=["scenario_to_test", "driver_name", "scenario_name"],
|
||||
)
|
||||
def test_command_create(scenario_to_test, with_scenario, scenario_name):
|
||||
options = {"scenario_name": scenario_name}
|
||||
cmd = sh.molecule.bake("create", **options)
|
||||
pytest.helpers.run_command(cmd)
|
||||
|
||||
|
||||
@pytest.mark.skip(
|
||||
reason="Disabled due to https://github.com/ansible/galaxy/issues/2030"
|
||||
)
|
||||
@pytest.mark.parametrize(
|
||||
"scenario_to_test, driver_name, scenario_name",
|
||||
[("dependency", "hetznercloud", "ansible-galaxy")],
|
||||
indirect=["scenario_to_test", "driver_name", "scenario_name"],
|
||||
)
|
||||
def test_command_dependency_ansible_galaxy(
|
||||
request, scenario_to_test, with_scenario, scenario_name
|
||||
):
|
||||
options = {"scenario_name": scenario_name}
|
||||
cmd = sh.molecule.bake("dependency", **options)
|
||||
pytest.helpers.run_command(cmd)
|
||||
|
||||
dependency_role = os.path.join(
|
||||
ephemeral_directory("molecule"),
|
||||
"dependency",
|
||||
"ansible-galaxy",
|
||||
"roles",
|
||||
"timezone",
|
||||
)
|
||||
assert os.path.isdir(dependency_role)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"scenario_to_test, driver_name, scenario_name",
|
||||
[("dependency", "hetznercloud", "gilt")],
|
||||
indirect=["scenario_to_test", "driver_name", "scenario_name"],
|
||||
)
|
||||
def test_command_dependency_gilt(
|
||||
request, scenario_to_test, with_scenario, scenario_name
|
||||
):
|
||||
options = {"scenario_name": scenario_name}
|
||||
cmd = sh.molecule.bake("dependency", **options)
|
||||
pytest.helpers.run_command(cmd)
|
||||
|
||||
dependency_role = os.path.join(
|
||||
ephemeral_directory("molecule"), "dependency", "gilt", "roles", "timezone"
|
||||
)
|
||||
assert os.path.isdir(dependency_role)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"scenario_to_test, driver_name, scenario_name",
|
||||
[("dependency", "hetznercloud", "shell")],
|
||||
indirect=["scenario_to_test", "driver_name", "scenario_name"],
|
||||
)
|
||||
def test_command_dependency_shell(
|
||||
request, scenario_to_test, with_scenario, scenario_name
|
||||
):
|
||||
options = {"scenario_name": scenario_name}
|
||||
cmd = sh.molecule.bake("dependency", **options)
|
||||
pytest.helpers.run_command(cmd)
|
||||
|
||||
dependency_role = os.path.join(
|
||||
ephemeral_directory("molecule"), "dependency", "shell", "roles", "timezone"
|
||||
)
|
||||
assert os.path.isdir(dependency_role)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"scenario_to_test, driver_name, scenario_name",
|
||||
[("driver/hetznercloud", "hetznercloud", "default")],
|
||||
indirect=["scenario_to_test", "driver_name", "scenario_name"],
|
||||
)
|
||||
def test_command_destroy(scenario_to_test, with_scenario, scenario_name):
|
||||
options = {"scenario_name": scenario_name}
|
||||
cmd = sh.molecule.bake("destroy", **options)
|
||||
pytest.helpers.run_command(cmd)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"scenario_to_test, driver_name, scenario_name",
|
||||
[("driver/hetznercloud", "hetznercloud", "default")],
|
||||
indirect=["scenario_to_test", "driver_name", "scenario_name"],
|
||||
)
|
||||
def test_command_idempotence(scenario_to_test, with_scenario, scenario_name):
|
||||
pytest.helpers.idempotence(scenario_name)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"driver_name",
|
||||
[
|
||||
("digitalocean"),
|
||||
("docker"),
|
||||
("ec2"),
|
||||
("gce"),
|
||||
("linode"),
|
||||
("openstack"),
|
||||
("vagrant"),
|
||||
],
|
||||
indirect=["driver_name"],
|
||||
)
|
||||
def test_command_init_role(temp_dir, driver_name, skip_test):
|
||||
pytest.helpers.init_role(temp_dir, driver_name)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("driver_name", [("hetznercloud")], indirect=["driver_name"])
|
||||
def test_command_init_scenario(temp_dir, driver_name, skip_test):
|
||||
pytest.helpers.init_scenario(temp_dir, driver_name)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"scenario_to_test, driver_name, scenario_name",
|
||||
[("driver/hetznercloud", "hetznercloud", "default")],
|
||||
indirect=["scenario_to_test", "driver_name", "scenario_name"],
|
||||
)
|
||||
def test_command_lint(scenario_to_test, with_scenario, scenario_name):
|
||||
options = {"scenario_name": scenario_name}
|
||||
cmd = sh.molecule.bake("lint", **options)
|
||||
pytest.helpers.run_command(cmd)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"scenario_to_test, driver_name, expected",
|
||||
[
|
||||
(
|
||||
"driver/hetznercloud",
|
||||
"hetznercloud",
|
||||
"""
|
||||
Instance Name Driver Name Provisioner Name Scenario Name Created Converged
|
||||
--------------- ------------- ------------------ --------------- --------- -----------
|
||||
instance hetznercloud ansible default false false
|
||||
instance-1 hetznercloud ansible multi-node false false
|
||||
instance-2 hetznercloud ansible multi-node false false
|
||||
""".strip(), # noqa
|
||||
)
|
||||
],
|
||||
indirect=["scenario_to_test", "driver_name"],
|
||||
)
|
||||
def test_command_list(scenario_to_test, with_scenario, expected):
|
||||
pytest.helpers.list(expected)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"scenario_to_test, driver_name, expected",
|
||||
[
|
||||
(
|
||||
"driver/hetznercloud",
|
||||
"hetznercloud",
|
||||
"""
|
||||
instance hetznercloud ansible default false false
|
||||
instance-1 hetznercloud ansible multi-node false false
|
||||
instance-2 hetznercloud ansible multi-node false false
|
||||
""".strip(),
|
||||
) # noqa
|
||||
],
|
||||
indirect=["scenario_to_test", "driver_name"],
|
||||
)
|
||||
def test_command_list_with_format_plain(scenario_to_test, with_scenario, expected):
|
||||
pytest.helpers.list_with_format_plain(expected)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"scenario_to_test, driver_name, login_args, scenario_name",
|
||||
[
|
||||
(
|
||||
"driver/hetznercloud",
|
||||
"hetznercloud",
|
||||
[["instance-1", ".*instance-1.*"], ["instance-2", ".*instance-2.*"]],
|
||||
"multi-node",
|
||||
)
|
||||
],
|
||||
indirect=["scenario_to_test", "driver_name", "scenario_name"],
|
||||
)
|
||||
def test_command_login(scenario_to_test, with_scenario, login_args, scenario_name):
|
||||
pytest.helpers.login(login_args, scenario_name)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"scenario_to_test, driver_name, scenario_name",
|
||||
[("driver/hetznercloud", "hetznercloud", "default")],
|
||||
indirect=["scenario_to_test", "driver_name", "scenario_name"],
|
||||
)
|
||||
def test_command_prepare(scenario_to_test, with_scenario, scenario_name):
|
||||
options = {"scenario_name": scenario_name}
|
||||
|
||||
cmd = sh.molecule.bake("create", **options)
|
||||
pytest.helpers.run_command(cmd)
|
||||
|
||||
cmd = sh.molecule.bake("prepare", **options)
|
||||
pytest.helpers.run_command(cmd)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"scenario_to_test, driver_name, scenario_name",
|
||||
[("driver/hetznercloud", "hetznercloud", "default")],
|
||||
indirect=["scenario_to_test", "driver_name", "scenario_name"],
|
||||
)
|
||||
def test_command_side_effect(scenario_to_test, with_scenario, scenario_name):
|
||||
options = {"scenario_name": scenario_name}
|
||||
cmd = sh.molecule.bake("side-effect", **options)
|
||||
pytest.helpers.run_command(cmd)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"scenario_to_test, driver_name, scenario_name",
|
||||
[("driver/hetznercloud", "hetznercloud", "default")],
|
||||
indirect=["scenario_to_test", "driver_name", "scenario_name"],
|
||||
)
|
||||
def test_command_syntax(scenario_to_test, with_scenario, scenario_name):
|
||||
options = {"scenario_name": scenario_name}
|
||||
cmd = sh.molecule.bake("syntax", **options)
|
||||
pytest.helpers.run_command(cmd)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"scenario_to_test, driver_name, scenario_name",
|
||||
[("driver/hetznercloud", "hetznercloud", None)],
|
||||
indirect=["scenario_to_test", "driver_name", "scenario_name"],
|
||||
)
|
||||
def test_command_test(scenario_to_test, with_scenario, scenario_name, driver_name):
|
||||
pytest.helpers.test(driver_name, scenario_name)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"scenario_to_test, driver_name, scenario_name",
|
||||
[("driver/hetznercloud", "hetznercloud", "default")],
|
||||
indirect=["scenario_to_test", "driver_name", "scenario_name"],
|
||||
)
|
||||
def test_command_verify(scenario_to_test, with_scenario, scenario_name):
|
||||
pytest.helpers.verify(scenario_name)
|
Reference in New Issue
Block a user