ci: streamline E2E test workflows and remove redundant logging in testapp

This commit is contained in:
juancarmore 2025-09-22 18:12:32 +02:00
parent dd8c5638df
commit 38093f0116
3 changed files with 91 additions and 235 deletions

View File

@ -12,7 +12,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22.13.1'
node-version: '22.13'
- name: Setup OpenVidu Local Deployment
uses: OpenVidu/actions/start-openvidu-local-deployment@main
with:
@ -29,7 +29,8 @@ jobs:
- name: Setup OpenVidu Meet
uses: OpenVidu/actions/start-openvidu-meet@main
env:
MEET_WEBHOOK_ENABLED: true
MEET_INITIAL_WEBHOOK_ENABLED: true
MEET_INITIAL_WEBHOOK_URL: "http://localhost:5080/webhook"
- name: Start OpenVidu Meet Testapp
uses: OpenVidu/actions/start-openvidu-meet-testapp@main
- name: Run tests
@ -37,18 +38,31 @@ jobs:
cd frontend/webcomponent
# Install Playwright browsers
mkdir -p /tmp/ms-playwright
PLAYWRIGHT_BROWSERS_PATH=/tmp/ms-playwright npx playwright install --with-deps chromium
npx playwright install --with-deps chromium
npm run test:e2e-core-room
env:
RUN_MODE: CI
PLAYWRIGHT_BROWSERS_PATH: /tmp/ms-playwright
- name: Upload failed test videos
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-videos-room-functionality
path: |
frontend/webcomponent/test-results/
name: room-test-results
path: frontend/webcomponent/test-results/
retention-days: 2
- name: Upload TestApp logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: room-test-testapp-logs
path: testapp/testapp.log
retention-days: 2
- name: Upload OpenVidu Meet logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: room-test-openvidu-meet-logs
path: backend/meet_backend.log
retention-days: 2
- name: Clean up
if: always()
@ -78,7 +92,8 @@ jobs:
- name: Setup OpenVidu Meet
uses: OpenVidu/actions/start-openvidu-meet@main
env:
MEET_WEBHOOK_ENABLED: true
MEET_INITIAL_WEBHOOK_ENABLED: true
MEET_INITIAL_WEBHOOK_URL: "http://localhost:5080/webhook"
- name: Start OpenVidu Meet Testapp
uses: OpenVidu/actions/start-openvidu-meet-testapp@main
- name: Run tests
@ -86,18 +101,31 @@ jobs:
cd frontend/webcomponent
# Install Playwright browsers
mkdir -p /tmp/ms-playwright
PLAYWRIGHT_BROWSERS_PATH=/tmp/ms-playwright npx playwright install --with-deps chromium
npx playwright install --with-deps chromium
npm run test:e2e-core-events
env:
RUN_MODE: CI
PLAYWRIGHT_BROWSERS_PATH: /tmp/ms-playwright
- name: Upload failed test videos
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-videos-events-functionality
path: |
frontend/webcomponent/test-results/
name: events-test-results
path: frontend/webcomponent/test-results/
retention-days: 2
- name: Upload TestApp logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: events-test-testapp-logs
path: testapp/testapp.log
retention-days: 2
- name: Upload OpenVidu Meet logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: events-test-openvidu-meet-logs
path: backend/meet_backend.log
retention-days: 2
- name: Clean up
if: always()
@ -127,7 +155,8 @@ jobs:
- name: Setup OpenVidu Meet
uses: OpenVidu/actions/start-openvidu-meet@main
env:
MEET_WEBHOOK_ENABLED: true
MEET_INITIAL_WEBHOOK_ENABLED: true
MEET_INITIAL_WEBHOOK_URL: "http://localhost:5080/webhook"
- name: Start OpenVidu Meet Testapp
uses: OpenVidu/actions/start-openvidu-meet-testapp@main
- name: Run tests
@ -135,64 +164,36 @@ jobs:
cd frontend/webcomponent
# Install Playwright browsers
mkdir -p /tmp/ms-playwright
PLAYWRIGHT_BROWSERS_PATH=/tmp/ms-playwright npx playwright install --with-deps chromium
npx playwright install --with-deps chromium
npm run test:e2e-core-webhooks
env:
RUN_MODE: CI
PLAYWRIGHT_BROWSERS_PATH: /tmp/ms-playwright
- name: Collect TestApp logs
if: always()
run: |
echo "=== Collecting TestApp logs ==="
echo "Current directory: $(pwd)"
echo "Looking for log files..."
find . -name "testapp.log" -type f 2>/dev/null | head -10
# Try multiple possible locations
if [ -f testapp.log ]; then
echo "TestApp log file found at ./testapp.log"
cp testapp.log testapp-logs-webhooks.log
elif [ -f testapp/testapp.log ]; then
echo "TestApp log file found at testapp/testapp.log"
cp testapp/testapp.log testapp-logs-webhooks.log
elif [ -f testapp/dist/testapp/testapp.log ]; then
echo "TestApp log file found at testapp/dist/testapp/testapp.log"
cp testapp/dist/testapp/testapp.log testapp-logs-webhooks.log
elif [ -f testapp/dist/testapp.log ]; then
echo "TestApp log file found at testapp/dist/testapp.log"
cp testapp/dist/testapp.log testapp-logs-webhooks.log
else
echo "TestApp log file not found in any expected locations"
echo "Root directory contents:"
ls -la | head -10
echo "Testapp directory contents:"
ls -la testapp/ 2>/dev/null || echo "testapp directory not found"
ls -la testapp/dist/ 2>/dev/null || echo "testapp/dist directory not found"
echo "Creating empty log file for artifact upload"
echo "TestApp log file not found during CI run at $(date)" > testapp-logs-webhooks.log
echo "Process information that might be helpful:"
ps aux | grep -i testapp || echo "No testapp processes found"
fi
- name: Upload failed test videos
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-videos-webhooks-functionality
path: |
frontend/webcomponent/test-results/
name: webhooks-test-results
path: frontend/webcomponent/test-results/
retention-days: 2
- name: Upload TestApp logs
if: always()
- name: Upload TestApp logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: testapp-logs-webhooks-functionality
path: testapp-logs-webhooks.log
name: webhooks-test-testapp-logs
path: testapp/testapp.log
retention-days: 2
- name: Upload OpenVidu Meet logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: webhooks-test-openvidu-meet-logs
path: backend/meet_backend.log
retention-days: 2
- name: Clean up
if: always()
uses: OpenVidu/actions/cleanup@main
e2e-ui-features-test:
name: E2E UI Features Tests
runs-on: ov-actions-runner
@ -217,7 +218,8 @@ jobs:
- name: Setup OpenVidu Meet
uses: OpenVidu/actions/start-openvidu-meet@main
env:
MEET_WEBHOOK_ENABLED: true
MEET_INITIAL_WEBHOOK_ENABLED: true
MEET_INITIAL_WEBHOOK_URL: "http://localhost:5080/webhook"
- name: Start OpenVidu Meet Testapp
uses: OpenVidu/actions/start-openvidu-meet-testapp@main
- name: Run tests
@ -225,58 +227,31 @@ jobs:
cd frontend/webcomponent
# Install Playwright browsers
mkdir -p /tmp/ms-playwright
PLAYWRIGHT_BROWSERS_PATH=/tmp/ms-playwright npx playwright install --with-deps chromium
npx playwright install --with-deps chromium
npm run test:e2e-ui-features
env:
RUN_MODE: CI
PLAYWRIGHT_BROWSERS_PATH: /tmp/ms-playwright
- name: Collect TestApp logs
if: always()
run: |
echo "=== Collecting TestApp logs ==="
echo "Current directory: $(pwd)"
echo "Looking for log files..."
find . -name "testapp.log" -type f 2>/dev/null | head -10
# Try multiple possible locations
if [ -f testapp.log ]; then
echo "TestApp log file found at ./testapp.log"
cp testapp.log testapp-logs-ui-features.log
elif [ -f testapp/testapp.log ]; then
echo "TestApp log file found at testapp/testapp.log"
cp testapp/testapp.log testapp-logs-ui-features.log
elif [ -f testapp/dist/testapp/testapp.log ]; then
echo "TestApp log file found at testapp/dist/testapp/testapp.log"
cp testapp/dist/testapp/testapp.log testapp-logs-ui-features.log
elif [ -f testapp/dist/testapp.log ]; then
echo "TestApp log file found at testapp/dist/testapp.log"
cp testapp/dist/testapp.log testapp-logs-ui-features.log
else
echo "TestApp log file not found in any expected locations"
echo "Root directory contents:"
ls -la | head -10
echo "Testapp directory contents:"
ls -la testapp/ 2>/dev/null || echo "testapp directory not found"
ls -la testapp/dist/ 2>/dev/null || echo "testapp/dist directory not found"
echo "Creating empty log file for artifact upload"
echo "TestApp log file not found during CI run at $(date)" > testapp-logs-ui-features.log
echo "Process information that might be helpful:"
ps aux | grep -i testapp || echo "No testapp processes found"
fi
- name: Upload failed test videos
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-videos-ui-features
path: |
frontend/webcomponent/test-results/
name: ui-features-test-results
path: frontend/webcomponent/test-results/
retention-days: 2
- name: Upload TestApp logs
if: always()
- name: Upload TestApp logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: testapp-logs-ui-features
path: testapp-logs-ui-features.log
name: ui-features-test-testapp-logs
path: testapp/testapp.log
retention-days: 2
- name: Upload OpenVidu Meet logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: ui-features-test-openvidu-meet-logs
path: backend/meet_backend.log
retention-days: 2
- name: Clean up
if: always()
@ -306,7 +281,8 @@ jobs:
- name: Setup OpenVidu Meet
uses: OpenVidu/actions/start-openvidu-meet@main
env:
MEET_WEBHOOK_ENABLED: true
MEET_INITIAL_WEBHOOK_ENABLED: true
MEET_INITIAL_WEBHOOK_URL: "http://localhost:5080/webhook"
- name: Start OpenVidu Meet Testapp
uses: OpenVidu/actions/start-openvidu-meet-testapp@main
- name: Run tests
@ -315,81 +291,31 @@ jobs:
cd frontend/webcomponent
# Install Playwright browsers
mkdir -p /tmp/ms-playwright
PLAYWRIGHT_BROWSERS_PATH=/tmp/ms-playwright npx playwright install --with-deps chromium
npx playwright install --with-deps chromium
npm run test:e2e-recording-access
env:
RUN_MODE: CI
PLAYWRIGHT_BROWSERS_PATH: /tmp/ms-playwright
- name: Collect TestApp logs
- name: Upload test results
if: always()
run: |
echo "=== Collecting TestApp logs ==="
echo "Current directory: $(pwd)"
echo "Looking for log files..."
find . -name "testapp.log" -type f 2>/dev/null | head -10
# Try multiple possible locations
if [ -f testapp.log ]; then
echo "TestApp log file found at ./testapp.log"
cp testapp.log testapp-logs-recording-access.log
elif [ -f testapp/testapp.log ]; then
echo "TestApp log file found at testapp/testapp.log"
cp testapp/testapp.log testapp-logs-recording-access.log
elif [ -f testapp/dist/testapp/testapp.log ]; then
echo "TestApp log file found at testapp/dist/testapp/testapp.log"
cp testapp/dist/testapp/testapp.log testapp-logs-recording-access.log
elif [ -f testapp/dist/testapp.log ]; then
echo "TestApp log file found at testapp/dist/testapp.log"
cp testapp/dist/testapp.log testapp-logs-recording-access.log
else
echo "TestApp log file not found in any expected locations"
echo "Root directory contents:"
ls -la | head -10
echo "Testapp directory contents:"
ls -la testapp/ 2>/dev/null || echo "testapp directory not found"
ls -la testapp/dist/ 2>/dev/null || echo "testapp/dist directory not found"
echo "Creating empty log file for artifact upload"
echo "TestApp log file not found during CI run at $(date)" > testapp-logs-recording-access.log
echo "Process information that might be helpful:"
ps aux | grep -i testapp || echo "No testapp processes found"
fi
- name: Dump TestApp logs on failure
uses: actions/upload-artifact@v4
with:
name: recording-access-test-results
path: frontend/webcomponent/test-results/
retention-days: 2
- name: Upload TestApp logs on failure
if: failure()
run: |
echo "=== TestApp logs ==="
docker logs testapp || echo "TestApp container logs not available"
echo "=== OpenVidu Meet Backend logs ==="
docker logs openvidu-meet || echo "OpenVidu Meet container logs not available"
- name: Upload failed test videos
if: always()
uses: actions/upload-artifact@v4
with:
name: test-videos-recording-access
path: |
frontend/webcomponent/test-results/
name: recording-access-test-testapp-logs
path: testapp/testapp.log
retention-days: 2
- name: Upload TestApp logs
if: always()
- name: Upload OpenVidu Meet logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: testapp-logs-recording-access
path: testapp-logs-recording-access.log
retention-days: 2
- name: Dump OpenVidu Local Deployment logs
if: always()
shell: bash
run: |
docker logs openvidu &> openvidu-server.logs
docker logs egress &> egress.logs
- name: Upload OpenVidu Local Deployment logs
if: always()
uses: actions/upload-artifact@v4
with:
name: openvidu-local-deployment-logs
path: |
openvidu-server.logs
egress.logs
name: recording-access-test-openvidu-meet-logs
path: backend/meet_backend.log
retention-days: 2
- name: Clean up
if: always()

View File

@ -108,8 +108,6 @@ fi
if [ "$BUILD_BACKEND" = true ]; then
echo -e "${GREEN}Building backend...${NC}"
cd backend
rm -rf node_modules package-lock.json
npm cache clean --force
npm install
npm run build:prod
cd ..

View File

@ -1,7 +1,6 @@
import express from 'express';
import http from 'http';
import path from 'path';
import fs from 'fs';
import { Server as IOServer } from 'socket.io';
import {
deleteAllRecordingsCtrl,
@ -13,46 +12,6 @@ import {
import { handleWebhook, joinRoom } from './controllers/roomController';
import { configService } from './services/configService';
// Setup log file for CI debugging - always write to current working directory
const logPath = path.join(process.cwd(), 'testapp.log');
console.log(`Setting up log file at: ${logPath}`);
console.log(`Current working directory: ${process.cwd()}`);
const logStream = fs.createWriteStream(logPath, { flags: 'a' });
// Override console methods to also write to log file
const originalConsoleLog = console.log;
const originalConsoleError = console.error;
const originalConsoleWarn = console.warn;
console.log = (...args: any[]) => {
const message = args.map(arg => typeof arg === 'object' ? JSON.stringify(arg, null, 2) : arg).join(' ');
const timestamp = new Date().toISOString();
logStream.write(`[${timestamp}] LOG: ${message}\n`);
originalConsoleLog.apply(console, args);
};
console.error = (...args: any[]) => {
const message = args.map(arg => typeof arg === 'object' ? JSON.stringify(arg, null, 2) : arg).join(' ');
const timestamp = new Date().toISOString();
logStream.write(`[${timestamp}] ERROR: ${message}\n`);
originalConsoleError.apply(console, args);
};
console.warn = (...args: any[]) => {
const message = args.map(arg => typeof arg === 'object' ? JSON.stringify(arg, null, 2) : arg).join(' ');
const timestamp = new Date().toISOString();
logStream.write(`[${timestamp}] WARN: ${message}\n`);
originalConsoleWarn.apply(console, args);
};
console.log('=== TESTAPP STARTUP ===');
console.log('Testapp initializing at:', new Date().toISOString());
console.log('Environment variables:');
console.log('MEET_API_URL:', process.env.MEET_API_URL);
console.log('MEET_API_KEY:', process.env.MEET_API_KEY ? '***SET***' : 'NOT SET');
console.log('NODE_ENV:', process.env.NODE_ENV);
console.log('PORT:', process.env.PORT);
const app = express();
const server = http.createServer(app);
const io = new IOServer(server);
@ -87,36 +46,9 @@ server.listen(PORT, () => {
console.log(`Server running on port ${PORT}`);
console.log(`Visit http://localhost:${PORT}/ to access the app`);
console.log('-----------------------------------------');
console.log('Configuration:');
console.log(` MEET_API_URL: ${configService.meetApiUrl}`);
console.log(` MEET_API_KEY: ${configService.meetApiKey ? '[SET]' : '[NOT SET]'}`);
console.log(` MEET_WEBCOMPONENT_SRC: ${configService.meetWebhookSrc}`);
console.log(` SERVER_PORT: ${configService.serverPort}`);
console.log('-----------------------------------------');
console.log('');
console.log('OpenVidu Meet Configuration:');
console.log(`Meet API URL: ${configService.meetApiUrl}`);
console.log(`Meet API key: ${configService.meetApiKey}`);
console.log(`Meet Webcomponent Source: ${configService.meetWebhookSrc}`);
console.log('=== TESTAPP STARTUP COMPLETE ===');
});
// Handle graceful shutdown
process.on('SIGTERM', () => {
console.log('=== TESTAPP SHUTDOWN ===');
console.log('Received SIGTERM, shutting down gracefully');
logStream.end();
server.close(() => {
process.exit(0);
});
});
process.on('SIGINT', () => {
console.log('=== TESTAPP SHUTDOWN ===');
console.log('Received SIGINT, shutting down gracefully');
logStream.end();
server.close(() => {
process.exit(0);
});
});