Ejemplo n.º 1
0
 def test_create_action_with_invalid_orchestrator():
     params = dict(description='description goes here.',
                   hosts=['host01'],
                   orchestrator='abc')
     with pytest.raises(TefloActionError) as ex:
         Action(name='action', parameters=params)
     assert 'Orchestrator: abc is not supported!' in ex.value.args
Ejemplo n.º 2
0
    def test_create_action_with_name_in_parameters():
        params = dict(name='action',
                      description='description goes here.',
                      hosts=['host01'])

        action = Action(parameters=params)
        assert action.name == 'action'
Ejemplo n.º 3
0
 def test_timeout_from_cfg(config):
     params = dict(
         description='description goes here.',
         hosts=['host01']
     )
     action = Action(name='action', parameters=params, config=config)
     assert action._orchestrate_timeout is 25
Ejemplo n.º 4
0
 def test_create_action_with_name():
     params = dict(
         description='description goes here.',
         hosts=['host01']
     )
     action = Action(name='action', parameters=params)
     assert isinstance(action, Action)
Ejemplo n.º 5
0
 def test_create_action_without_hosts():
     params = dict(name='action',
                   description='description goes here.',
                   hosts=None)
     with pytest.raises(TefloActionError) as ex:
         Action(parameters=params)
     assert 'Unable to associate hosts to action: action.No hosts ' \
            'defined!' in ex.value.args
Ejemplo n.º 6
0
 def test_create_action_with_hosts_as_str():
     params = dict(
         description='description goes here.',
         hosts='host01, host02',
         key='value'
     )
     action = Action(name='action', parameters=params)
     assert isinstance(action.hosts, list)
Ejemplo n.º 7
0
    def test_create_action_without_name():
        params = dict(
            description='description goes here.',
            hosts=['host01']
        )

        with pytest.raises(TefloActionError):
            Action(parameters=params)
Ejemplo n.º 8
0
def action_resource(config):
    return Action(
        name='action',
        config=config,
        parameters=dict(
            description='description',
            hosts=['host01'],
            orchestrator='ansible'
        )
    )
Ejemplo n.º 9
0
def action2(config):
    return Action(
        name='action',
        config=config,
        parameters=dict(
            description='description',
            hosts=['host_3'],
            orchestrator='ansible',
            labels='label3'
        )
    )
Ejemplo n.º 10
0
 def test_timeout_from_scenario(timeout_param_orchestrate):
     action = Action(name='action', parameters=timeout_param_orchestrate)
     assert action._orchestrate_timeout is 20