mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #44484 from Ch3LL/orch_test
Add orchestration tests when target exists or not
This commit is contained in:
commit
5b95495e75
3 changed files with 85 additions and 0 deletions
|
@ -0,0 +1,17 @@
|
|||
core:
|
||||
salt.state:
|
||||
- tgt: 'doesnotexist*'
|
||||
- sls:
|
||||
- core
|
||||
|
||||
test-state:
|
||||
salt.state:
|
||||
- tgt: '*'
|
||||
- sls:
|
||||
- include-test
|
||||
|
||||
cmd.run:
|
||||
salt.function:
|
||||
- tgt: '*'
|
||||
- arg:
|
||||
- echo test
|
17
tests/integration/files/file/base/orch/target-exists.sls
Normal file
17
tests/integration/files/file/base/orch/target-exists.sls
Normal file
|
@ -0,0 +1,17 @@
|
|||
core:
|
||||
salt.state:
|
||||
- tgt: 'minion*'
|
||||
- sls:
|
||||
- core
|
||||
|
||||
test-state:
|
||||
salt.state:
|
||||
- tgt: '*'
|
||||
- sls:
|
||||
- include-test
|
||||
|
||||
cmd.run:
|
||||
salt.function:
|
||||
- tgt: '*'
|
||||
- arg:
|
||||
- echo test
|
|
@ -80,6 +80,57 @@ class StateRunnerTest(ShellCase):
|
|||
self.assertFalse(os.path.exists('/tmp/ewu-2016-12-13'))
|
||||
self.assertNotEqual(code, 0)
|
||||
|
||||
def test_orchestrate_target_exists(self):
|
||||
'''
|
||||
test orchestration when target exists
|
||||
while using multiple states
|
||||
'''
|
||||
ret = self.run_run('state.orchestrate orch.target-exists')
|
||||
|
||||
first = [' ID: core',
|
||||
' Function: salt.state',
|
||||
' Result: True']
|
||||
|
||||
second = [' ID: test-state',
|
||||
' Function: salt.state',
|
||||
' Result: True']
|
||||
|
||||
third = [' ID: cmd.run',
|
||||
' Function: salt.function',
|
||||
' Result: True']
|
||||
|
||||
ret_out = [first, second, third]
|
||||
|
||||
for out in ret_out:
|
||||
for item in out:
|
||||
self.assertIn(item, ret)
|
||||
|
||||
def test_orchestrate_target_doesnt_exists(self):
|
||||
'''
|
||||
test orchestration when target doesnt exist
|
||||
while using multiple states
|
||||
'''
|
||||
ret = self.run_run('state.orchestrate orch.target-doesnt-exists')
|
||||
|
||||
first = ['No minions matched the target. No command was sent, no jid was assigned.',
|
||||
' ID: core',
|
||||
' Function: salt.state',
|
||||
' Result: False']
|
||||
|
||||
second = [' ID: test-state',
|
||||
' Function: salt.state',
|
||||
' Result: True']
|
||||
|
||||
third = [' ID: cmd.run',
|
||||
' Function: salt.function',
|
||||
' Result: True']
|
||||
|
||||
ret_out = [first, second, third]
|
||||
|
||||
for out in ret_out:
|
||||
for item in out:
|
||||
self.assertIn(item, ret)
|
||||
|
||||
def test_state_event(self):
|
||||
'''
|
||||
test to ensure state.event
|
||||
|
|
Loading…
Add table
Reference in a new issue