Async flag and test cleanup

This commit is contained in:
Mike Place 2015-01-09 13:14:33 -07:00
parent 783de9584a
commit 9d7990f264
2 changed files with 7 additions and 5 deletions

View File

@ -1172,11 +1172,13 @@ class ShellCase(AdaptedConfigurationTestCaseMixIn, ShellTestCase):
arg_str = '-c {0} -i --priv {1} --roster-file {2} --out=json localhost {3}'.format(self.get_config_dir(), os.path.join(TMP_CONF_DIR, 'key_test'), os.path.join(TMP_CONF_DIR, 'roster'), arg_str)
return self.run_script('salt-ssh', arg_str, with_retcode=with_retcode, catch_stderr=catch_stderr, raw=True)
def run_run(self, arg_str, with_retcode=False, catch_stderr=False):
def run_run(self, arg_str, with_retcode=False, catch_stderr=False, async=False):
'''
Execute salt-run
'''
arg_str = '-c {0} {1} --async'.format(self.get_config_dir(), arg_str)
arg_str = '-c {0}{async_flag}{1}'.format(self.get_config_dir(),
arg_str,
async_flag=' --async ' if async else '')
return self.run_script('salt-run', arg_str, with_retcode=with_retcode, catch_stderr=catch_stderr)
def run_run_plus(self, fun, options='', *arg, **kwargs):

View File

@ -107,8 +107,8 @@ class CallTest(integration.ShellCase, integration.ShellCaseCommonTestsMixIn):
@skipIf(sys.platform.startswith('win'), 'This test does not apply on Win')
def test_return(self):
self.run_call('-c {0} cmd.run "echo returnTOmaster"'.format(self.get_config_dir()))
jobs = [a for a in self.run_run('-c {0} jobs.list_jobs'.format(self.get_config_dir()))]
self.run_call('cmd.run "echo returnTOmaster"')
jobs = [a for a in self.run_run('jobs.list_jobs')]
self.assertTrue(True in ['returnTOmaster' in j for j in jobs])
# lookback jid
@ -125,7 +125,7 @@ class CallTest(integration.ShellCase, integration.ShellCaseCommonTestsMixIn):
assert idx > 0
assert jid
master_out = [
a for a in self.run_run('-c {0} jobs.lookup_jid {1}'.format(self.get_config_dir(), jid))
a for a in self.run_run('jobs.lookup_jid {0}'.format(jid))
]
self.assertTrue(True in ['returnTOmaster' in a for a in master_out])