mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Revert "Try to get the tests suite output streamed."
This reverts commit 1ef452a03a
.
This commit is contained in:
parent
8ea7390789
commit
363c9b828f
1 changed files with 48 additions and 29 deletions
|
@ -239,13 +239,47 @@ def run(opts):
|
|||
opts.download_unittest_reports = vm_name
|
||||
|
||||
cmd = (
|
||||
'salt-cloud -l debug --script-args "-D -n git {commit}" '
|
||||
'--start-action \'-l debug state.sls {sls} pillar="{pillar}" '
|
||||
'--no-color\' -p {provider}_{platform} {0}'.format(
|
||||
vm_name,
|
||||
'salt-cloud -l debug --script-args "-D -n git {commit}" -p '
|
||||
'{provider}_{platform} {0}'.format(vm_name, **opts.__dict__)
|
||||
)
|
||||
print('Running CMD: {0}'.format(cmd))
|
||||
sys.stdout.flush()
|
||||
|
||||
proc = Terminal(
|
||||
cmd,
|
||||
shell=True,
|
||||
stream_stdout=True,
|
||||
stream_stderr=True,
|
||||
log_stderr=True,
|
||||
log_stdout=True
|
||||
)
|
||||
while proc.isalive():
|
||||
proc.recv()
|
||||
time.sleep(0.025)
|
||||
|
||||
retcode = proc.exitstatus
|
||||
if retcode != 0:
|
||||
print('Failed to bootstrap VM. Exit code: {0}'.format(retcode))
|
||||
sys.stdout.flush()
|
||||
if opts.clean and 'JENKINS_SALTCLOUD_VM_NAME' not in os.environ:
|
||||
delete_vm(vm_name)
|
||||
sys.exit(retcode)
|
||||
|
||||
print('VM Bootstrapped. Exit code: {0}'.format(retcode))
|
||||
sys.stdout.flush()
|
||||
|
||||
print('Sleeping for 5 seconds to allow the minion to breathe a little')
|
||||
sys.stdout.flush()
|
||||
time.sleep(5)
|
||||
|
||||
# Run tests here
|
||||
cmd = (
|
||||
'salt -t 1800 {vm_name} state.sls {sls} pillar="{pillar}" '
|
||||
'--no-color'.format(
|
||||
sls=opts.sls,
|
||||
pillar=opts.pillar.format(commit=opts.commit),
|
||||
**opts.__dict__
|
||||
vm_name=vm_name,
|
||||
commit=opts.commit
|
||||
)
|
||||
)
|
||||
print('Running CMD: {0}'.format(cmd))
|
||||
|
@ -259,36 +293,27 @@ def run(opts):
|
|||
log_stderr=True,
|
||||
log_stdout=True
|
||||
)
|
||||
|
||||
exiting = False
|
||||
suite_retcode = None
|
||||
while True:
|
||||
stdout, _ = proc.recv(4096)
|
||||
if stdout and suite_retcode is None:
|
||||
retcode = None
|
||||
while proc.isalive():
|
||||
stdout, _ = proc.recv()
|
||||
if stdout and retcode is None:
|
||||
try:
|
||||
match = re.search(r'Test Suite Exit Code: (?P<exitcode>[\d]+)',
|
||||
stdout)
|
||||
if match:
|
||||
suite_retcode = int(match.group('exitcode'))
|
||||
retcode = int(match.group('exitcode'))
|
||||
except AttributeError:
|
||||
# No regex matching
|
||||
suite_retcode = 1
|
||||
retcode = 1
|
||||
except ValueError:
|
||||
# Not a number!?
|
||||
suite_retcode = 1
|
||||
retcode = 1
|
||||
except TypeError:
|
||||
# No output!?
|
||||
suite_retcode = 1
|
||||
retcode = 1
|
||||
if stdout:
|
||||
# Anything else, raise the exception
|
||||
raise
|
||||
|
||||
if exiting is True:
|
||||
break
|
||||
|
||||
if not proc.isalive:
|
||||
exiting = True
|
||||
|
||||
time.sleep(0.025)
|
||||
|
||||
if opts.download_remote_reports:
|
||||
|
@ -298,13 +323,7 @@ def run(opts):
|
|||
download_coverage_report(opts)
|
||||
|
||||
if opts.clean and 'JENKINS_SALTCLOUD_VM_NAME' not in os.environ:
|
||||
delete_vm(opts)
|
||||
|
||||
retcode = proc.exitstatus
|
||||
if suite_retcode == 0 and retcode == 0:
|
||||
return 0
|
||||
if suite_retcode > 0:
|
||||
return suite_retcode
|
||||
delete_vm(vm_name)
|
||||
return retcode
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue