Commit 54f6e741 authored by Kirill Smelkov's avatar Kirill Smelkov

tests: Don't leak WCFS log files

By default every WCFS run creates several files in /tmp/wcfs.*.log.* and
without explicit cleanup those files are left hanging on testnodes. Over
last ~6 months we accumulated ~ 300K such files.

Don't allow those files to be leaked by instructing WCFS to log to
stderr during test run. This should be also useful to see details in the
test output.
parent 49251408
...@@ -24,7 +24,7 @@ import pytest ...@@ -24,7 +24,7 @@ import pytest
import transaction import transaction
from golang import func, defer from golang import func, defer
from functools import partial from functools import partial
import gc import os, gc
# reset transaction synchronizers before every test run. # reset transaction synchronizers before every test run.
# #
...@@ -46,9 +46,24 @@ def transaction_reset(): ...@@ -46,9 +46,24 @@ def transaction_reset():
# nothing to run after test # nothing to run after test
# prepend_env prepends prefix + ' ' to environment variable var.
def prepend_env(var, prefix):
v = os.environ.get(var, '')
if v != '':
v = ' ' + v
v = prefix + v
os.environ[var] = v
# enable log_cli on no-capture # enable log_cli on no-capture
# (output during a test is a mixture of print and log) # (output during a test is a mixture of print and log)
def pytest_configure(config): def pytest_configure(config):
# put WCFS log into stderr instead of to many files in /tmp/wcfs.*.log
# this way we don't leak those files and include relevant information in test output
#
# TODO put WCFS logs into dedicated dir without -v?
prepend_env('WENDELIN_CORE_WCFS_OPTIONS', '-logtostderr')
if config.option.capture == "no": if config.option.capture == "no":
config.inicfg['log_cli'] = "true" config.inicfg['log_cli'] = "true"
assert config.getini("log_cli") is True assert config.getini("log_cli") is True
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment