fix(logs): send logs to a single file
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
7eab188b32
commit
8351ae80ca
|
@ -24,7 +24,5 @@ AUT_PATH = SystemPath(AUT_PATH)
|
|||
# Save application logs
|
||||
AUT_DIR = path.dirname(AUT_PATH)
|
||||
PYTEST_LOG = path.join(AUT_DIR, 'pytest.log')
|
||||
AUT_LOGS_STDOUT = path.join(AUT_DIR, 'aut_stdout.log')
|
||||
AUT_LOGS_STDERR = path.join(AUT_DIR, 'aut_stderr.log')
|
||||
SERVER_LOGS_STDOUT = path.join(AUT_DIR, 'server_stdout.log')
|
||||
SERVER_LOGS_STDERR = path.join(AUT_DIR, 'server_stderr.log')
|
||||
AUT_LOG_FILE = path.join(AUT_DIR, 'aut.log')
|
||||
SQUISH_LOG_FILE = path.join(AUT_DIR, 'squish.log')
|
||||
|
|
|
@ -105,7 +105,8 @@ class AUT:
|
|||
f'--LOG_LEVEL={configs.testpath.LOG_LEVEL}',
|
||||
]
|
||||
try:
|
||||
self.pid = local_system.execute_with_log_files(command)
|
||||
with open(configs.AUT_LOG_FILE, "ab") as log:
|
||||
self.pid = local_system.execute(command, stderr=log, stdout=log)
|
||||
LOG.debug('Launched AUT under PID: %d', self.pid)
|
||||
self.attach()
|
||||
assert squish.waitFor(lambda: self.ctx.isRunning, configs.timeouts.PROCESS_TIMEOUT_SEC)
|
||||
|
|
|
@ -34,11 +34,8 @@ class SquishServer:
|
|||
f'--host={cls.host}',
|
||||
f'--port={cls.port}',
|
||||
]
|
||||
cls.pid = local_system.execute_with_log_files(
|
||||
cmd,
|
||||
stderr_log=configs.SERVER_LOGS_STDOUT,
|
||||
stdout_log=configs.SERVER_LOGS_STDOUT,
|
||||
)
|
||||
with open(configs.SQUISH_LOG_FILE, "ab") as log:
|
||||
cls.pid = local_system.execute(cmd, stderr=log, stdout=log)
|
||||
|
||||
@classmethod
|
||||
def stop(cls):
|
||||
|
@ -58,20 +55,14 @@ class SquishServer:
|
|||
# https://doc-snapshots.qt.io/squish/cli-squishserver.html
|
||||
@classmethod
|
||||
def configuring(cls, action: str, options: typing.Union[int, str, list]):
|
||||
with (
|
||||
open(configs.SERVER_LOGS_STDOUT, "ab") as out_file,
|
||||
open(configs.SERVER_LOGS_STDERR, "ab") as err_file,
|
||||
):
|
||||
rval = local_system.run(
|
||||
[
|
||||
str(cls.path),
|
||||
f'--configfile={cls.config}',
|
||||
f'--config={action}',
|
||||
] + options,
|
||||
stdout=out_file,
|
||||
stderr=err_file,
|
||||
)
|
||||
LOG.info('rval: %s', rval)
|
||||
LOG.info('Configuring Squish server config: %s', cls.config)
|
||||
cmd = [
|
||||
str(cls.path),
|
||||
f'--configfile={cls.config}',
|
||||
f'--config={action}',
|
||||
] + options
|
||||
with open(configs.SQUISH_LOG_FILE, "ab") as log:
|
||||
rval = local_system.run(cmd, stdout=log, stderr=log)
|
||||
|
||||
@classmethod
|
||||
def add_attachable_aut(cls, aut_id: str, port: int):
|
||||
|
|
|
@ -74,18 +74,6 @@ def execute(
|
|||
process = subprocess.Popen(command, shell=shell, stderr=stderr, stdout=stdout)
|
||||
return process.pid
|
||||
|
||||
def execute_with_log_files(
|
||||
command: list,
|
||||
stderr_log=configs.AUT_LOGS_STDERR,
|
||||
stdout_log=configs.AUT_LOGS_STDOUT,
|
||||
shell=False,
|
||||
):
|
||||
with (
|
||||
open(stderr_log, "ab") as out_file,
|
||||
open(stdout_log, "ab") as err_file,
|
||||
):
|
||||
return execute(command, shell=shell, stderr=err_file, stdout=out_file)
|
||||
|
||||
@allure.step('System run command')
|
||||
def run(
|
||||
command: list,
|
||||
|
|
Loading…
Reference in New Issue