From f614fa534b4cc5b82d349808e4e3c2735a103ea7 Mon Sep 17 00:00:00 2001 From: juancarmore Date: Sat, 24 Oct 2026 14:39:17 +0200 Subject: [PATCH] openvidu-test-integration: keep the server log of each test in the report artifact --- .github/workflows/openvidu-integration-tests.yml | 4 +++- .../tests/utils/local-deployment.ts | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/openvidu-integration-tests.yml b/.github/workflows/openvidu-integration-tests.yml index c815dcb3b..956fe6b48 100644 --- a/.github/workflows/openvidu-integration-tests.yml +++ b/.github/workflows/openvidu-integration-tests.yml @@ -56,7 +56,9 @@ jobs: if: always() with: name: openvidu-integration-tests-report - path: ./openvidu/openvidu-test-integration/test-results.json + path: | + ./openvidu/openvidu-test-integration/test-results.json + ./openvidu/openvidu-test-integration/logs/ retention-days: 7 - name: Cleanup if: always() diff --git a/openvidu-test-integration/tests/utils/local-deployment.ts b/openvidu-test-integration/tests/utils/local-deployment.ts index c2050aeb5..c40994adb 100644 --- a/openvidu-test-integration/tests/utils/local-deployment.ts +++ b/openvidu-test-integration/tests/utils/local-deployment.ts @@ -1,6 +1,9 @@ +import { mkdirSync } from "fs"; +import { join } from "path"; import { execCommand, sleep } from "./helper"; const LOCAL_DEPLOYMENT_PATH = "../../openvidu-local-deployment/community/docker-compose.yaml"; +const LOGS_PATH = "logs"; export class LocalDeployment { static async start() { @@ -19,9 +22,17 @@ export class LocalDeployment { static stop() { console.log("Stopping local deployment..."); + LocalDeployment.saveServerLogs(); execCommand(`docker compose -f ${LOCAL_DEPLOYMENT_PATH} down -v`); } + /** Saves the log of the OpenVidu server in logs/, named after the current test, before the deployment is removed. */ + private static saveServerLogs() { + const name = (expect.getState().currentTestName ?? "deployment").replace(/[^\w-]+/g, "-"); + mkdirSync(LOGS_PATH, { recursive: true }); + execCommand(`docker logs openvidu > ${join(LOGS_PATH, `${name}.log`)} 2>&1 || true`); + } + static startContainer(containerName: string) { console.log(`Starting container ${containerName}...`); execCommand(`docker compose -f ${LOCAL_DEPLOYMENT_PATH} start ${containerName}`);