mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #46799 from garethgreenaway/46762_prereq_shenanigans_tests
[2017.7] Adding test for PR #46788
This commit is contained in:
commit
058bbed221
2 changed files with 44 additions and 0 deletions
11
tests/integration/files/file/base/issue-46762.sls
Normal file
11
tests/integration/files/file/base/issue-46762.sls
Normal file
|
@ -0,0 +1,11 @@
|
|||
a: test.fail_without_changes
|
||||
|
||||
b:
|
||||
test.nop:
|
||||
- prereq:
|
||||
- c
|
||||
|
||||
c:
|
||||
test.nop:
|
||||
- require:
|
||||
- a
|
|
@ -1347,6 +1347,39 @@ class StateModuleTest(ModuleCase, SaltReturnAssertsMixin):
|
|||
self.assertEqual(state_run[state_id]['comment'], 'Failure!')
|
||||
self.assertFalse(state_run[state_id]['result'])
|
||||
|
||||
def test_issue_46762_prereqs_on_a_state_with_unfulfilled_requirements(self):
|
||||
'''
|
||||
This tests the case where state C requires state A, which fails.
|
||||
State C is a pre-required state for State B.
|
||||
Since state A fails, state C will not run because the requisite failed,
|
||||
therefore state B will not run because state C failed to run.
|
||||
|
||||
See https://github.com/saltstack/salt/issues/46762 for
|
||||
more information.
|
||||
'''
|
||||
state_run = self.run_function(
|
||||
'state.sls',
|
||||
mods='issue-46762'
|
||||
)
|
||||
|
||||
state_id = 'test_|-a_|-a_|-fail_without_changes'
|
||||
self.assertIn(state_id, state_run)
|
||||
self.assertEqual(state_run[state_id]['comment'],
|
||||
'Failure!')
|
||||
self.assertFalse(state_run[state_id]['result'])
|
||||
|
||||
state_id = 'test_|-b_|-b_|-nop'
|
||||
self.assertIn(state_id, state_run)
|
||||
self.assertEqual(state_run[state_id]['comment'],
|
||||
'One or more requisite failed: issue-46762.c')
|
||||
self.assertFalse(state_run[state_id]['result'])
|
||||
|
||||
state_id = 'test_|-c_|-c_|-nop'
|
||||
self.assertIn(state_id, state_run)
|
||||
self.assertEqual(state_run[state_id]['comment'],
|
||||
'One or more requisite failed: issue-46762.a')
|
||||
self.assertFalse(state_run[state_id]['result'])
|
||||
|
||||
def test_state_nonbase_environment(self):
|
||||
'''
|
||||
test state.sls with saltenv using a nonbase environment
|
||||
|
|
Loading…
Add table
Reference in a new issue