mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add shell tests and shellCase to test structure
This commit is contained in:
parent
4f3fbe0991
commit
e301fee420
2 changed files with 30 additions and 2 deletions
|
@ -5,6 +5,7 @@ Set up the Salt integration test suite
|
|||
# Import Python libs
|
||||
import multiprocessing
|
||||
import os
|
||||
import sys
|
||||
import shutil
|
||||
import signal
|
||||
import subprocess
|
||||
|
@ -191,7 +192,7 @@ class SyndicCase(TestCase):
|
|||
orig = self.client.cmd('minion', function, arg)
|
||||
return orig['minion']
|
||||
|
||||
class CLICase(TestCase):
|
||||
class CliCase(TestCase):
|
||||
'''
|
||||
Execute a test for a shell command
|
||||
'''
|
||||
|
@ -210,3 +211,11 @@ class CLICase(TestCase):
|
|||
stdout=subprocess.PIPE
|
||||
).communicate()[0].split('\n')
|
||||
return data
|
||||
|
||||
def run_key(self, arg_str):
|
||||
'''
|
||||
Execute salt-key
|
||||
'''
|
||||
mconf = os.path.join(INTEGRATION_TEST_DIR, 'files/conf/master')
|
||||
arg_str = '-c {0} {1}'.format(mconf, arg_str)
|
||||
return self.run_script('salt-key', arg_str)
|
||||
|
|
|
@ -36,11 +36,24 @@ def run_integration_tests(opts=None):
|
|||
saltunittest.TextTestRunner(verbosity=1).run(moduletests)
|
||||
if opts.get('client', True):
|
||||
clientloader = saltunittest.TestLoader()
|
||||
clienttests = clientloader.discover(os.path.join(TEST_DIR, 'integration', 'client'), '*.py')
|
||||
clienttests = clientloader.discover(
|
||||
os.path.join(TEST_DIR, 'integration', 'client'),
|
||||
'*.py'
|
||||
)
|
||||
print('~' * PNUM)
|
||||
print('Starting Client Tests')
|
||||
print('~' * PNUM)
|
||||
saltunittest.TextTestRunner(verbosity=1).run(clienttests)
|
||||
if opts.get('shell', True):
|
||||
shellloader = saltunittest.TestLoader()
|
||||
shelltests = shellloader.discover(
|
||||
os.path.join(TEST_DIR, 'integration', 'shell'),
|
||||
'*.py'
|
||||
)
|
||||
print('~' * PNUM)
|
||||
print('Starting Shell Tests')
|
||||
print('~' * PNUM)
|
||||
saltunittest.TextTestRunner(verbosity=1).run(shelltests)
|
||||
|
||||
|
||||
def run_unit_tests(opts=None):
|
||||
|
@ -85,6 +98,12 @@ def parse_opts():
|
|||
default=False,
|
||||
action='store_true',
|
||||
help='Run unit tests')
|
||||
parser.add_option('-s',
|
||||
'--shell',
|
||||
dest='shell',
|
||||
default=False,
|
||||
action='store_true',
|
||||
help='Run shell tests')
|
||||
|
||||
options, args = parser.parse_args()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue