mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add options --clean and --no-clean in runtest.py
--no-clean option speeds up repeating test execution by skipping the cleanup process before and after testing. Typical use case command could look like ./runtests.py -vv --no-clean --name integration.modules.ssh
This commit is contained in:
parent
8ac125acfc
commit
4cac03c42d
2 changed files with 18 additions and 1 deletions
|
@ -39,6 +39,10 @@ class TestDaemon(object):
|
|||
'''
|
||||
Set up the master and minion daemons, and run related cases
|
||||
'''
|
||||
|
||||
def __init__(self, clean):
|
||||
self.clean = clean
|
||||
|
||||
def __enter__(self):
|
||||
'''
|
||||
Start a master and minion
|
||||
|
@ -142,6 +146,8 @@ class TestDaemon(object):
|
|||
'''
|
||||
Clean out the tmp files
|
||||
'''
|
||||
if not self.clean:
|
||||
return
|
||||
if os.path.isdir(self.sub_minion_opts['root_dir']):
|
||||
shutil.rmtree(self.sub_minion_opts['root_dir'])
|
||||
if os.path.isdir(self.master_opts['root_dir']):
|
||||
|
|
|
@ -60,7 +60,7 @@ def run_integration_tests(opts):
|
|||
if not any([opts.client, opts.module, opts.runner,
|
||||
opts.shell, opts.state, opts.name]):
|
||||
return status
|
||||
with TestDaemon():
|
||||
with TestDaemon(clean=opts.clean):
|
||||
if opts.name:
|
||||
results = run_suite(opts, '', opts.name)
|
||||
status.append(results)
|
||||
|
@ -152,6 +152,17 @@ def parse_opts():
|
|||
dest='name',
|
||||
default='',
|
||||
help='Specific test name to run')
|
||||
parser.add_option('--clean',
|
||||
dest='clean',
|
||||
default=True,
|
||||
action='store_true',
|
||||
help=('Clean up test environment before and after '
|
||||
'integration testing (default behaviour)'))
|
||||
parser.add_option('--no-clean',
|
||||
dest='clean',
|
||||
action='store_false',
|
||||
help=('Don\'t clean up test environment before and after '
|
||||
'integration testing (speed up test process)'))
|
||||
|
||||
options, _ = parser.parse_args()
|
||||
if not any((options.module, options.client,
|
||||
|
|
Loading…
Add table
Reference in a new issue