mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add runner test interface
This commit is contained in:
parent
be35ac79a7
commit
aed4f593e0
1 changed files with 20 additions and 0 deletions
|
@ -15,6 +15,7 @@ import salt
|
|||
import salt.config
|
||||
import salt.master
|
||||
import salt.minion
|
||||
import salt.runner
|
||||
from salt.utils.verify import verify_env
|
||||
from saltunittest import TestCase
|
||||
|
||||
|
@ -136,6 +137,7 @@ class TestDaemon(object):
|
|||
elif os.path.islink(path):
|
||||
os.remove(path)
|
||||
|
||||
|
||||
class ModuleCase(TestCase):
|
||||
'''
|
||||
Execute a module function
|
||||
|
@ -254,6 +256,24 @@ class ShellCase(TestCase):
|
|||
arg_str = '-c {0} {1}'.format(mconf, arg_str)
|
||||
return self.run_script('salt-run', arg_str)
|
||||
|
||||
def run_run_plus(self, fun, options='', *arg):
|
||||
'''
|
||||
Execute Salt run and the salt run function and return the data from
|
||||
each in a dict
|
||||
'''
|
||||
ret = {}
|
||||
ret['out'] = self.run_run(
|
||||
'{0} {1} {2}'.format(options, fun, ' '.join(arg))
|
||||
)
|
||||
opts = salt.config.master_config(
|
||||
os.path.join(INTEGRATION_TEST_DIR, 'files', 'conf', 'master'))
|
||||
opts.update({'doc': False,
|
||||
'fun': fun,
|
||||
'arg': arg})
|
||||
runner = salt.runner.Runner(opts)
|
||||
ret['fun'] = runner.run()
|
||||
return ret
|
||||
|
||||
def run_key(self, arg_str):
|
||||
'''
|
||||
Execute salt-key
|
||||
|
|
Loading…
Add table
Reference in a new issue