summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul J. Davis <paul.joseph.davis@gmail.com>2017-09-13 11:48:19 -0500
committerPaul J. Davis <paul.joseph.davis@gmail.com>2017-09-13 11:48:19 -0500
commit2780ec5d0328cf84580d743767838765d8768265 (patch)
tree068c4fac9df55b2f150427efb9720fcee330bbc0
parentd9e2940839532a727c3e8dddf3e9f24fdd806fb1 (diff)
downloadcouchdb-fix-log-resets-during-js-tests.tar.gz
Don't reset logs when JS tests restart the serverfix-log-resets-during-js-tests
When a JS test requested a restart server we would wip the current log file. This makes it hard to debug failing tests occasionally when they happen just after a restart. This change prevents just opens log files in read/write mode specifically when a test requests a server restart. The current behavior for interactive use of `dev/run` will continue to truncate log files on startup.
-rwxr-xr-xdev/run8
1 files changed, 7 insertions, 1 deletions
diff --git a/dev/run b/dev/run
index 2f25071a1..5693e1273 100755
--- a/dev/run
+++ b/dev/run
@@ -146,6 +146,7 @@ def setup_context(opts, args):
'haproxy': opts.haproxy,
'haproxy_port': opts.haproxy_port,
'config_overrides': opts.config_overrides,
+ 'reset_logs': True,
'procs': []}
@@ -400,8 +401,12 @@ def boot_node(ctx, node):
"-pa", os.path.join(erl_libs, "*"),
"-s", "boot_node"
]
+ if ctx['reset_logs']:
+ mode = "wb"
+ else:
+ mode = "r+b"
logfname = os.path.join(ctx['devdir'], "logs", "%s.log" % node)
- log = open(logfname, "wb")
+ log = open(logfname, mode)
cmd = [toposixpath(x) for x in cmd]
return sp.Popen(cmd, stdin=sp.PIPE, stdout=log, stderr=sp.STDOUT, env=env)
@@ -545,6 +550,7 @@ def run_command(ctx, cmd):
@log('Restart all nodes')
def reboot_nodes(ctx):
+ ctx['reset_logs'] = False
kill_processes(ctx)
boot_nodes(ctx)
ensure_all_nodes_alive(ctx)