def test(ctx, scenario_name, driver_name, __all, destroy): # pragma: no cover """ Test (destroy, create, converge, lint, verify, destroy). """ args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = { 'subcommand': subcommand, 'driver_name': driver_name, } if __all: scenario_name = None s = scenarios.Scenarios( base.get_configs(args, command_args), scenario_name) s.print_matrix() for scenario in s: try: for term in scenario.sequence: base.execute_subcommand(scenario.config, term) except SystemExit: if destroy == 'always': msg = ('An error occured during the test sequence. ' 'Cleaning up.') LOG.warn(msg) base.execute_subcommand(scenario.config, 'destroy') util.sysexit() raise
def lint(ctx, scenario_name): # pragma: no cover """Lint the role (dependency, lint).""" args = ctx.obj.get("args") subcommand = base._get_subcommand(__name__) command_args = {"subcommand": subcommand} base.execute_cmdline_scenarios(scenario_name, args, command_args)
def lint(ctx, scenario_name): # pragma: no cover """ Lint the role. """ args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = {'subcommand': subcommand} base.execute_cmdline_scenarios(scenario_name, args, command_args)
def verify(ctx, scenario_name): # pragma: no cover """Run automated tests against instances.""" args = ctx.obj.get("args") subcommand = base._get_subcommand(__name__) command_args = {"subcommand": subcommand} base.execute_cmdline_scenarios(scenario_name, args, command_args)
def dependency(ctx, scenario_name): # pragma: no cover """Manage the role's dependencies.""" args = ctx.obj.get("args") subcommand = base._get_subcommand(__name__) command_args = {"subcommand": subcommand} base.execute_cmdline_scenarios(scenario_name, args, command_args)
def create(ctx, scenario_name, driver_name): # pragma: no cover """Use the provisioner to start the instances.""" args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = {'subcommand': subcommand, 'driver_name': driver_name} base.execute_cmdline_scenarios(scenario_name, args, command_args)
def reset(ctx, scenario_name): # pragma: no cover """Reset molecule temporary folders.""" args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = {'subcommand': subcommand} base.execute_cmdline_scenarios(scenario_name, args, command_args)
def syntax(ctx, scenario_name): # pragma: no cover """Use the provisioner to syntax check the role.""" args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = {'subcommand': subcommand} base.execute_cmdline_scenarios(scenario_name, args, command_args)
def test(ctx, scenario_name, driver_name, __all, destroy): # pragma: no cover """ Test (lint, destroy, dependency, syntax, create, prepare, converge, idempotence, side_effect, verify, destroy). """ args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = { 'destroy': destroy, 'subcommand': subcommand, 'driver_name': driver_name, } if __all: scenario_name = None s = scenarios.Scenarios(base.get_configs(args, command_args), scenario_name) s.print_matrix() for scenario in s: try: for term in scenario.sequence: base.execute_subcommand(scenario.config, term) except SystemExit: if destroy == 'always': msg = ('An error occured during the test sequence. ' 'Cleaning up.') LOG.warn(msg) base.execute_subcommand(scenario.config, 'destroy') util.sysexit() raise
def side_effect(ctx, scenario_name): # pragma: no cover """Use the provisioner to perform side-effects to the instances.""" args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = {'subcommand': subcommand} base.execute_cmdline_scenarios(scenario_name, args, command_args)
def converge(ctx, scenario_name, ansible_args): # pragma: no cover """Use the provisioner to configure instances (dependency, create, prepare converge).""" args = ctx.obj.get("args") subcommand = base._get_subcommand(__name__) command_args = {"subcommand": subcommand} base.execute_cmdline_scenarios(scenario_name, args, command_args, ansible_args)
def idempotence(ctx, scenario_name): # pragma: no cover """Use the provisioner to configure the instances and parse the output to \ determine idempotence.""" args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = {'subcommand': subcommand} base.execute_cmdline_scenarios(scenario_name, args, command_args)
def cleanup(ctx, scenario_name): # pragma: no cover """Use the provisioner to cleanup any changes made to external systems during \ the stages of testing.""" args = ctx.obj.get("args") subcommand = base._get_subcommand(__name__) command_args = {"subcommand": subcommand} base.execute_cmdline_scenarios(scenario_name, args, command_args)
def login(ctx, host, scenario_name): # pragma: no cover """Log in to one instance.""" args = ctx.obj.get("args") subcommand = base._get_subcommand(__name__) command_args = {"subcommand": subcommand, "host": host} s = scenarios.Scenarios(base.get_configs(args, command_args), scenario_name) for scenario in s.all: base.execute_subcommand(scenario.config, subcommand)
def reset(ctx, scenario_name): # pragma: no cover """Reset molecule temporary folders.""" args = ctx.obj.get("args") subcommand = base._get_subcommand(__name__) command_args = {"subcommand": subcommand} base.execute_cmdline_scenarios(scenario_name, args, command_args) for driver in drivers(): driver.reset()
def prepare(ctx, scenario_name, driver_name, force): # pragma: no cover """Use the provisioner to prepare the instances into a particular starting state.""" args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = { 'subcommand': subcommand, 'driver_name': driver_name, 'force': force, } base.execute_cmdline_scenarios(scenario_name, args, command_args)
def check(ctx, scenario_name, parallel): # pragma: no cover """Use the provisioner to perform a Dry-Run (destroy, dependency, create, \ prepare, converge).""" args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = {'parallel': parallel, 'subcommand': subcommand} if parallel: util.validate_parallel_cmd_args(command_args) base.execute_cmdline_scenarios(scenario_name, args, command_args)
def check(ctx, scenario_name): # pragma: no cover """ Use the provisioner to perform a Dry-Run (destroy, dependency, create, prepare, converge). """ args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = { 'subcommand': subcommand, } base.execute_cmdline_scenarios(scenario_name, args, command_args)
def destroy(ctx, scenario_name, driver_name, __all): # pragma: no cover """ Use the provisioner to destroy the instances. """ args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = { 'subcommand': subcommand, 'driver_name': driver_name, } if __all: scenario_name = None base.execute_cmdline_scenarios(scenario_name, args, command_args)
def login(ctx, host, scenario_name): # pragma: no cover """ Log in to one instance. """ args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = { 'subcommand': subcommand, 'host': host, } s = scenarios.Scenarios( base.get_configs(args, command_args), scenario_name) for scenario in s.all: base.execute_subcommand(scenario.config, subcommand)
def syntax(ctx, scenario_name): # pragma: no cover """ Use the provisioner to syntax check the role. """ args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = { 'subcommand': subcommand, } s = scenarios.Scenarios( base.get_configs(args, command_args), scenario_name) s.print_matrix() for scenario in s: for term in scenario.sequence: base.execute_subcommand(scenario.config, term)
def dependency(ctx, scenario_name): # pragma: no cover """ Manage the role's dependencies. """ args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = { 'subcommand': subcommand, } s = scenarios.Scenarios( base.get_configs(args, command_args), scenario_name) s.print_matrix() for scenario in s: for term in scenario.sequence: base.execute_subcommand(scenario.config, term)
def converge(ctx, scenario_name, ansible_args): # pragma: no cover """ Use the provisioner to configure instances (create, converge). """ args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = { 'subcommand': subcommand, } s = scenarios.Scenarios( base.get_configs(args, command_args, ansible_args), scenario_name) s.print_matrix() for scenario in s: for term in scenario.sequence: base.execute_subcommand(scenario.config, term)
def converge(ctx, scenario_name, ansible_args): # pragma: no cover """ Use the provisioner to configure instances (create, converge). """ args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = { 'subcommand': subcommand, } s = scenarios.Scenarios(base.get_configs(args, command_args, ansible_args), scenario_name) s.print_matrix() for scenario in s: for term in scenario.sequence: base.execute_subcommand(scenario.config, term)
def verify(ctx, scenario_name): # pragma: no cover """ Run automated tests against instances. """ args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = { 'subcommand': subcommand, } s = scenarios.Scenarios(base.get_configs(args, command_args), scenario_name) s.print_matrix() for scenario in s: for term in scenario.sequence: base.execute_subcommand(scenario.config, term)
def side_effect(ctx, scenario_name): # pragma: no cover """ Use the provisioner to perform side-effects to the instances. """ args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = { 'subcommand': subcommand, } s = scenarios.Scenarios(base.get_configs(args, command_args), scenario_name) s.print_matrix() for scenario in s: for term in scenario.sequence: base.execute_subcommand(scenario.config, term)
def syntax(ctx, scenario_name): # pragma: no cover """ Use the provisioner to syntax check the role. """ args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = { 'subcommand': subcommand, } s = scenarios.Scenarios(base.get_configs(args, command_args), scenario_name) s.print_matrix() for scenario in s: for term in scenario.sequence: base.execute_subcommand(scenario.config, term)
def side_effect(ctx, scenario_name): # pragma: no cover """ Use the provisioner to perform side-effects to the instances. """ args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = { 'subcommand': subcommand, } s = scenarios.Scenarios( base.get_configs(args, command_args), scenario_name) s.print_matrix() for scenario in s: for term in scenario.sequence: base.execute_subcommand(scenario.config, term)
def verify(ctx, scenario_name): # pragma: no cover """ Run automated tests against instances. """ args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = { 'subcommand': subcommand, } s = scenarios.Scenarios( base.get_configs(args, command_args), scenario_name) s.print_matrix() for scenario in s: for term in scenario.sequence: base.execute_subcommand(scenario.config, term)
def dependency(ctx, scenario_name): # pragma: no cover """ Manage the role's dependencies. """ args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = { 'subcommand': subcommand, } s = scenarios.Scenarios(base.get_configs(args, command_args), scenario_name) s.print_matrix() for scenario in s: for term in scenario.sequence: base.execute_subcommand(scenario.config, term)
def lint(ctx, scenario_name): # pragma: no cover """ Lint the role. """ args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = { 'subcommand': subcommand, } s = scenarios.Scenarios(base.get_configs(args, command_args), scenario_name) s.print_matrix() for scenario in s: for action in scenario.sequence: scenario.config.action = action base.execute_subcommand(scenario.config, action)
def create(ctx, scenario_name, driver_name): # pragma: no cover """ Start instances. """ args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = { 'subcommand': subcommand, 'driver_name': driver_name, } s = scenarios.Scenarios( base.get_configs(args, command_args), scenario_name) s.print_matrix() for scenario in s: for term in scenario.sequence: base.execute_subcommand(scenario.config, term)
def create(ctx, scenario_name, driver_name): # pragma: no cover """ Use the provisioner to start the instances. """ args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = { 'subcommand': subcommand, 'driver_name': driver_name, } s = scenarios.Scenarios( base.get_configs(args, command_args), scenario_name) s.print_matrix() for scenario in s: for action in scenario.sequence: scenario.config.action = action base.execute_subcommand(scenario.config, action)
def check(ctx, scenario_name): # pragma: no cover """ Use the provisioner to perform a Dry-Run (destroy, dependency, create, prepare, converge). """ args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = { 'subcommand': subcommand, } s = scenarios.Scenarios(base.get_configs(args, command_args), scenario_name) s.print_matrix() for scenario in s: for term in scenario.sequence: base.execute_subcommand(scenario.config, term)
def idempotence(ctx, scenario_name): # pragma: no cover """ Use the provisioner to configure the instances and parse the output to determine idempotence. """ args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = { 'subcommand': subcommand, } s = scenarios.Scenarios( base.get_configs(args, command_args), scenario_name) s.print_matrix() for scenario in s: for term in scenario.sequence: base.execute_subcommand(scenario.config, term)
def destroy(ctx, scenario_name, driver_name, __all, parallel): # pragma: no cover """Use the provisioner to destroy the instances.""" args = ctx.obj.get("args") subcommand = base._get_subcommand(__name__) command_args = { "parallel": parallel, "subcommand": subcommand, "driver_name": driver_name, } if __all: scenario_name = None if parallel: util.validate_parallel_cmd_args(command_args) base.execute_cmdline_scenarios(scenario_name, args, command_args)
def destroy(ctx, scenario_name, driver_name, __all): # pragma: no cover """ Use the provisioner to destroy the instances. """ args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = { 'subcommand': subcommand, 'driver_name': driver_name, } if __all: scenario_name = None s = scenarios.Scenarios(base.get_configs(args, command_args), scenario_name) s.print_matrix() for scenario in s: for term in scenario.sequence: base.execute_subcommand(scenario.config, term)
def list(ctx, scenario_name, format): # pragma: no cover """ Lists status of instances. """ args = ctx.obj.get('args') subcommand = base._get_subcommand(__name__) command_args = { 'subcommand': subcommand, 'format': format, } statuses = [] s = scenarios.Scenarios( base.get_configs(args, command_args), scenario_name) for scenario in s: statuses.extend(base.execute_subcommand(scenario.config, subcommand)) headers = [util.title(name) for name in status.get_status()._fields] if format == 'simple' or format == 'plain': table_format = 'simple' if format == 'plain': headers = [] table_format = format _print_tabulate_data(headers, statuses, table_format) else: _print_yaml_data(headers, statuses)
def test_get_subcommand(): assert 'test_base' == base._get_subcommand(__name__)