1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-02-22 10:12:12 +01:00

behave: Show also gitea logs on test failure

This commit is contained in:
Daniel Mach 2025-01-14 15:50:17 +01:00
parent fbbac5ad4c
commit 57d8254122

View File

@ -17,14 +17,14 @@ def after_step(context, step):
def before_scenario(context, scenario): def before_scenario(context, scenario):
# truncate the logs before running any commands # truncate the logs before running any commands
proc = context.podman.container.exec(["bash", "-c", "find /srv/www/obs/api/log/ /srv/obs/log/ -name '*.log' -exec truncate --size=0 {} \\;"]) proc = context.podman.container.exec(["bash", "-c", "find /srv/www/obs/api/log/ /srv/obs/log/ /var/log/gitea/ -name '*.log' -exec truncate --size=0 {} \\;"])
def after_scenario(context, scenario): def after_scenario(context, scenario):
if scenario.status == Status.failed: if scenario.status == Status.failed:
# the scenario has failed, dump server logs # the scenario has failed, dump server logs
print("===== BEGIN: server logs ======") print("===== BEGIN: server logs ======")
proc = context.podman.container.exec(["bash", "-c", "tail -n +1 /srv/www/obs/api/log/*.log /srv/obs/log/*.log"]) proc = context.podman.container.exec(["bash", "-c", "tail -n +1 /srv/www/obs/api/log/*.log /srv/obs/log/*.log /var/log/gitea/*.log"])
print(proc.stdout) print(proc.stdout)
print("===== END: server logs ======") print("===== END: server logs ======")