예제 #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
예제 #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'
예제 #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
예제 #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)
예제 #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
예제 #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)
예제 #7
0
    def test_create_action_without_name():
        params = dict(
            description='description goes here.',
            hosts=['host01']
        )

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