mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Updating tests for watch_any_fail and require_any_fail.
This commit is contained in:
parent
4dbd3e5567
commit
7cdf703884
2 changed files with 12 additions and 50 deletions
|
@ -1,11 +1,4 @@
|
|||
# A should fail since both E & F fail
|
||||
D:
|
||||
cmd.run:
|
||||
- name: echo D
|
||||
- require_any:
|
||||
- cmd: E
|
||||
- cmd: F
|
||||
|
||||
# D should fail since both E & F fail
|
||||
E:
|
||||
cmd.run:
|
||||
- name: 'false'
|
||||
|
@ -13,3 +6,10 @@ E:
|
|||
F:
|
||||
cmd.run:
|
||||
- name: 'false'
|
||||
|
||||
D:
|
||||
cmd.run:
|
||||
- name: echo D
|
||||
- require_any:
|
||||
- cmd: E
|
||||
- cmd: F
|
||||
|
|
|
@ -745,30 +745,11 @@ class StateModuleTest(ModuleCase, SaltReturnAssertsMixin):
|
|||
|
||||
Ensure that some of them are failing and that the order is right.
|
||||
'''
|
||||
expected_result = {
|
||||
'cmd_|-D_|-echo D_|-run': {
|
||||
'__run_num__': 2,
|
||||
'comment': 'One or more requisite failed: requisites.require_any_fail.F, requisites.require_any_fail.E',
|
||||
'result': False,
|
||||
'changes': False,
|
||||
},
|
||||
'cmd_|-E_|-false_|-run': {
|
||||
'__run_num__': 0,
|
||||
'comment': 'Command "false" run',
|
||||
'result': False,
|
||||
'changes': True,
|
||||
},
|
||||
'cmd_|-F_|-false_|-run': {
|
||||
'__run_num__': 1,
|
||||
'comment': 'Command "false" run',
|
||||
'result': False,
|
||||
'changes': True,
|
||||
},
|
||||
}
|
||||
ret = self.run_function('state.sls', mods='requisites.require_any_fail')
|
||||
result = self.normalize_ret(ret)
|
||||
self.assertReturnNonEmptySaltType(ret)
|
||||
self.assertEqual(expected_result, result)
|
||||
self.assertIn('One or more requisite failed',
|
||||
result['cmd_|-D_|-echo D_|-run']['comment'])
|
||||
|
||||
def test_requisites_watch_any(self):
|
||||
'''
|
||||
|
@ -837,30 +818,11 @@ class StateModuleTest(ModuleCase, SaltReturnAssertsMixin):
|
|||
|
||||
Ensure that some of them are failing and that the order is right.
|
||||
'''
|
||||
expected_result = {
|
||||
'cmd_|-A_|-true_|-wait': {
|
||||
'__run_num__': 2,
|
||||
'comment': 'One or more requisite failed: requisites.watch_any_fail.B, requisites.watch_any_fail.C',
|
||||
'result': False,
|
||||
'changes': False,
|
||||
},
|
||||
'cmd_|-B_|-false_|-run': {
|
||||
'__run_num__': 0,
|
||||
'comment': 'Command "false" run',
|
||||
'result': False,
|
||||
'changes': True,
|
||||
},
|
||||
'cmd_|-C_|-false_|-run': {
|
||||
'__run_num__': 1,
|
||||
'comment': 'Command "false" run',
|
||||
'result': False,
|
||||
'changes': True,
|
||||
},
|
||||
}
|
||||
ret = self.run_function('state.sls', mods='requisites.watch_any_fail')
|
||||
result = self.normalize_ret(ret)
|
||||
self.assertReturnNonEmptySaltType(ret)
|
||||
self.assertEqual(expected_result, result)
|
||||
self.assertIn('One or more requisite failed',
|
||||
result['cmd_|-A_|-true_|-wait']['comment'])
|
||||
|
||||
def test_requisites_onchanges_any(self):
|
||||
'''
|
||||
|
|
Loading…
Add table
Reference in a new issue