From d993a086647489ae400b1bfaa958b9122abab56b Mon Sep 17 00:00:00 2001 From: Eric P Green Date: Wed, 26 Feb 2025 14:03:01 +0100 Subject: [PATCH 1/2] Save `admin` and `runtime` output to `playwright/logs/admin-runtime.log` --- web-admin/tests/setup/setup.ts | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/web-admin/tests/setup/setup.ts b/web-admin/tests/setup/setup.ts index ce4974e1f95..a43852046ea 100644 --- a/web-admin/tests/setup/setup.ts +++ b/web-admin/tests/setup/setup.ts @@ -1,14 +1,16 @@ import { chromium, expect } from "@playwright/test"; +import { + execAsync, + spawnAndMatch, +} from "@rilldata/web-common/tests/utils/spawn"; import axios from "axios"; import { spawn } from "child_process"; import dotenv from "dotenv"; +import { openSync } from "fs"; +import { mkdir } from "fs/promises"; import path from "path"; import { fileURLToPath } from "url"; import { writeFileEnsuringDir } from "../utils/fs"; -import { - execAsync, - spawnAndMatch, -} from "@rilldata/web-common/tests/utils/spawn"; import type { StorageState } from "../utils/storage-state"; import { test as setup } from "./base"; import { @@ -61,6 +63,11 @@ setup.describe("global setup", () => { ); } + // Setup a log file to capture the output of the admin and runtime services + await mkdir("playwright/logs", { recursive: true }); + const logPath = path.resolve("playwright/logs/admin-runtime.log"); + const logFd = openSync(logPath, "w"); + // Start the admin and runtime services in a detached background process. // A detached process ensures they are not cleaned up when this setup project completes. // However, we need to be sure to clean-up the processes manually in the teardown project. @@ -69,10 +76,12 @@ setup.describe("global setup", () => { ["devtool", "start", "e2e", "--only", "admin,runtime"], { detached: true, - stdio: "ignore", + stdio: ["ignore", logFd, logFd], cwd: repoRoot, }, ); + child.unref(); + // Write the pid to a file, so I can kill it later if (child.pid) { writeFileEnsuringDir( From 3d600032a8566b05012a07b4a585774a45f380a5 Mon Sep 17 00:00:00 2001 From: Eric P Green Date: Wed, 26 Feb 2025 14:04:45 +0100 Subject: [PATCH 2/2] Upload logfile in GitHub Action --- .github/workflows/web-test-e2e.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/web-test-e2e.yml b/.github/workflows/web-test-e2e.yml index 21725bc3f21..44fad0ee20a 100644 --- a/.github/workflows/web-test-e2e.yml +++ b/.github/workflows/web-test-e2e.yml @@ -129,3 +129,10 @@ jobs: name: ${{ matrix.name }}-playwright-report path: ${{ matrix.name }}/playwright-report/ retention-days: 30 + + - uses: actions/upload-artifact@v4 + if: always() && matrix.name == 'web-admin' + with: + name: web-admin-services-log + path: web-admin/playwright/logs/admin-runtime.log + retention-days: 30