mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Add integration test for triggering orchestration failure via context
This commit is contained in:
parent
5e8eff9ff1
commit
18905cf32b
@ -0,0 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
'''
|
||||
Runner functions for integration tests
|
||||
'''
|
||||
|
||||
# Import python libs
|
||||
from __future__ import absolute_import
|
||||
|
||||
|
||||
def failure():
|
||||
__context__['retcode'] = 1
|
||||
return False
|
||||
|
||||
|
||||
def success():
|
||||
return True
|
16
tests/integration/files/file/base/_wheel/runtests_helpers.py
Normal file
16
tests/integration/files/file/base/_wheel/runtests_helpers.py
Normal file
@ -0,0 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
'''
|
||||
Wheel functions for integration tests
|
||||
'''
|
||||
|
||||
# Import python libs
|
||||
from __future__ import absolute_import
|
||||
|
||||
|
||||
def failure():
|
||||
__context__['retcode'] = 1
|
||||
return False
|
||||
|
||||
|
||||
def success():
|
||||
return True
|
15
tests/integration/files/file/base/orch/retcode.sls
Normal file
15
tests/integration/files/file/base/orch/retcode.sls
Normal file
@ -0,0 +1,15 @@
|
||||
test_runner_success:
|
||||
salt.runner:
|
||||
- name: runtests_helpers.success
|
||||
|
||||
test_runner_failure:
|
||||
salt.runner:
|
||||
- name: runtests_helpers.failure
|
||||
|
||||
test_wheel_success:
|
||||
salt.wheel:
|
||||
- name: runtests_helpers.success
|
||||
|
||||
test_wheel_failure:
|
||||
salt.wheel:
|
||||
- name: runtests_helpers.failure
|
@ -106,6 +106,35 @@ class StateRunnerTest(ShellCase):
|
||||
for item in out:
|
||||
self.assertIn(item, ret)
|
||||
|
||||
def test_orchestrate_retcode(self):
|
||||
'''
|
||||
Test orchestration with nonzero retcode set in __context__
|
||||
'''
|
||||
self.run_run('saltutil.sync_runners')
|
||||
self.run_run('saltutil.sync_wheel')
|
||||
ret = '\n'.join(self.run_run('state.orchestrate orch.retcode'))
|
||||
|
||||
for result in (' ID: test_runner_success\n'
|
||||
' Function: salt.runner\n'
|
||||
' Name: runtests_helpers.success\n'
|
||||
' Result: True',
|
||||
|
||||
' ID: test_runner_failure\n'
|
||||
' Function: salt.runner\n'
|
||||
' Name: runtests_helpers.failure\n'
|
||||
' Result: False',
|
||||
|
||||
' ID: test_wheel_success\n'
|
||||
' Function: salt.wheel\n'
|
||||
' Name: runtests_helpers.success\n'
|
||||
' Result: True',
|
||||
|
||||
' ID: test_wheel_failure\n'
|
||||
' Function: salt.wheel\n'
|
||||
' Name: runtests_helpers.failure\n'
|
||||
' Result: False'):
|
||||
self.assertIn(result, ret)
|
||||
|
||||
def test_orchestrate_target_doesnt_exists(self):
|
||||
'''
|
||||
test orchestration when target doesnt exist
|
||||
|
Loading…
Reference in New Issue
Block a user