mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #44572 from Ch3LL/watchin_test
Add watch_in integration test
This commit is contained in:
commit
5ec7ea0bb5
3 changed files with 41 additions and 0 deletions
|
@ -0,0 +1,7 @@
|
|||
return_changes:
|
||||
test.succeed_with_changes:
|
||||
- watch_in:
|
||||
- test: watch_states
|
||||
|
||||
watch_states:
|
||||
test.succeed_without_changes
|
|
@ -0,0 +1,7 @@
|
|||
return_changes:
|
||||
test.fail_with_changes:
|
||||
- watch_in:
|
||||
- test: watch_states
|
||||
|
||||
watch_states:
|
||||
test.succeed_without_changes
|
|
@ -586,6 +586,33 @@ class StateModuleTest(ModuleCase, SaltReturnAssertsMixin):
|
|||
#result = self.normalize_ret(ret)
|
||||
#self.assertEqual(expected_result, result)
|
||||
|
||||
def test_watch_in(self):
|
||||
'''
|
||||
test watch_in requisite when there is a success
|
||||
'''
|
||||
ret = self.run_function('state.sls', mods='requisites.watch_in')
|
||||
changes = 'test_|-return_changes_|-return_changes_|-succeed_with_changes'
|
||||
watch = 'test_|-watch_states_|-watch_states_|-succeed_without_changes'
|
||||
|
||||
self.assertEqual(ret[changes]['__run_num__'], 0)
|
||||
self.assertEqual(ret[watch]['__run_num__'], 2)
|
||||
|
||||
self.assertEqual('Watch statement fired.', ret[watch]['comment'])
|
||||
self.assertEqual('Something pretended to change',
|
||||
ret[changes]['changes']['testing']['new'])
|
||||
|
||||
def test_watch_in_failure(self):
|
||||
'''
|
||||
test watch_in requisite when there is a failure
|
||||
'''
|
||||
ret = self.run_function('state.sls', mods='requisites.watch_in_failure')
|
||||
fail = 'test_|-return_changes_|-return_changes_|-fail_with_changes'
|
||||
watch = 'test_|-watch_states_|-watch_states_|-succeed_without_changes'
|
||||
|
||||
self.assertEqual(False, ret[fail]['result'])
|
||||
self.assertEqual('One or more requisite failed: requisites.watch_in_failure.return_changes',
|
||||
ret[watch]['comment'])
|
||||
|
||||
def normalize_ret(self, ret):
|
||||
'''
|
||||
Normalize the return to the format that we'll use for result checking
|
||||
|
|
Loading…
Add table
Reference in a new issue