Skip to content

Commit

Permalink
e2e_basic_start_stop debugging (#937)
Browse files Browse the repository at this point in the history
wait at least 5s for algod shutdown. better subtest logging
  • Loading branch information
algobolson authored and tsachizehub committed May 2, 2020
1 parent 78d7b0b commit d9badc1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
4 changes: 2 additions & 2 deletions test/scripts/e2e_basic_start_stop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ function verify_at_least_one_running() {
}

function verify_none_running() {
# Shutting down can take some time, so retry up to 2 seconds
# Shutting down can take some time, so wait at least 5 seconds
for TRIES in 1 2 3 4 5; do
update_running_count
if [ ${RUNNING_COUNT} -eq 0 ]; then
return 0
fi
sleep .4
sleep 1.4
done
echo "algod not expected to be running but it is"
exit 1
Expand Down
33 changes: 17 additions & 16 deletions test/scripts/e2e_client_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,22 +109,23 @@ def _script_thread_inner(runset, scriptname):
retcode = -1
dt = time.time() - start
if retcode != 0:
logger.error('%s failed in %f seconds', scriptname, dt)
st = os.stat(cmdlogpath)
with open(cmdlogpath, 'r') as fin:
if st.st_size > LOG_WHOLE_CUTOFF:
fin.seek(st.st_size - LOG_WHOLE_CUTOFF)
text = fin.read()
lines = text.splitlines()
if len(lines) > 1:
# drop probably-partial first line
lines = lines[1:]
sys.stderr.write('end of log follows:\n')
sys.stderr.write('\n'.join(lines))
sys.stderr.write('\n\n')
else:
sys.stderr.write('whole log follows:\n')
sys.stderr.write(fin.read())
with runset.lock:
logger.error('%s failed in %f seconds', scriptname, dt)
st = os.stat(cmdlogpath)
with open(cmdlogpath, 'r') as fin:
if st.st_size > LOG_WHOLE_CUTOFF:
fin.seek(st.st_size - LOG_WHOLE_CUTOFF)
text = fin.read()
lines = text.splitlines()
if len(lines) > 1:
# drop probably-partial first line
lines = lines[1:]
sys.stderr.write('end of log follows ({}):\n'.format(scriptname))
sys.stderr.write('\n'.join(lines))
sys.stderr.write('\n\n')
else:
sys.stderr.write('whole log follows ({}):\n'.format(scriptname))
sys.stderr.write(fin.read())
else:
logger.info('finished %s OK in %f seconds', scriptname, dt)
runset.done(scriptname, retcode == 0, dt)
Expand Down

0 comments on commit d9badc1

Please sign in to comment.