mirror of https://github.com/OpenVidu/openvidu.git
openvidu-test-integration: keep the server log of each test in the report artifact
parent
cc01a69a96
commit
f614fa534b
|
|
@ -56,7 +56,9 @@ jobs:
|
||||||
if: always()
|
if: always()
|
||||||
with:
|
with:
|
||||||
name: openvidu-integration-tests-report
|
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
|
retention-days: 7
|
||||||
- name: Cleanup
|
- name: Cleanup
|
||||||
if: always()
|
if: always()
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
|
import { mkdirSync } from "fs";
|
||||||
|
import { join } from "path";
|
||||||
import { execCommand, sleep } from "./helper";
|
import { execCommand, sleep } from "./helper";
|
||||||
|
|
||||||
const LOCAL_DEPLOYMENT_PATH = "../../openvidu-local-deployment/community/docker-compose.yaml";
|
const LOCAL_DEPLOYMENT_PATH = "../../openvidu-local-deployment/community/docker-compose.yaml";
|
||||||
|
const LOGS_PATH = "logs";
|
||||||
|
|
||||||
export class LocalDeployment {
|
export class LocalDeployment {
|
||||||
static async start() {
|
static async start() {
|
||||||
|
|
@ -19,9 +22,17 @@ export class LocalDeployment {
|
||||||
|
|
||||||
static stop() {
|
static stop() {
|
||||||
console.log("Stopping local deployment...");
|
console.log("Stopping local deployment...");
|
||||||
|
LocalDeployment.saveServerLogs();
|
||||||
execCommand(`docker compose -f ${LOCAL_DEPLOYMENT_PATH} down -v`);
|
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) {
|
static startContainer(containerName: string) {
|
||||||
console.log(`Starting container ${containerName}...`);
|
console.log(`Starting container ${containerName}...`);
|
||||||
execCommand(`docker compose -f ${LOCAL_DEPLOYMENT_PATH} start ${containerName}`);
|
execCommand(`docker compose -f ${LOCAL_DEPLOYMENT_PATH} start ${containerName}`);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue