From ead269d30dac99f8ba200f534c27fa6834a3d3b5 Mon Sep 17 00:00:00 2001 From: diegosouzapw Date: Sun, 26 Apr 2026 03:49:10 -0300 Subject: [PATCH] fix: clear INITIAL_PASSWORD and JWT_SECRET in integration tests CI sets INITIAL_PASSWORD and JWT_SECRET env vars, which makes isAuthRequired() return true even with a fresh temp DB. The tests call route handlers directly without session cookies, so auth must be fully disabled by clearing all auth-related env vars. --- tests/integration/_chatPipelineHarness.ts | 4 +++- tests/integration/proxy-registry-flow.test.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/integration/_chatPipelineHarness.ts b/tests/integration/_chatPipelineHarness.ts index da8ca1d13b..93588e3cc3 100644 --- a/tests/integration/_chatPipelineHarness.ts +++ b/tests/integration/_chatPipelineHarness.ts @@ -7,8 +7,10 @@ export async function createChatPipelineHarness(prefix) { process.env.DATA_DIR = testDataDir; process.env.REQUIRE_API_KEY = "false"; // Disable dashboard auth so direct route handler calls don't get 401 - // (CI postinstall auto-generates DASHBOARD_PASSWORD) + // (CI sets JWT_SECRET + INITIAL_PASSWORD, causing isAuthRequired() → true) process.env.DASHBOARD_PASSWORD = ""; + process.env.INITIAL_PASSWORD = ""; + delete process.env.JWT_SECRET; // FASE-01: API_KEY_SECRET is required for CRC operations (no hardcoded fallback) if (!process.env.API_KEY_SECRET) { process.env.API_KEY_SECRET = "test-harness-secret-" + Date.now(); diff --git a/tests/integration/proxy-registry-flow.test.ts b/tests/integration/proxy-registry-flow.test.ts index 4ee9aa511c..48510dea5d 100644 --- a/tests/integration/proxy-registry-flow.test.ts +++ b/tests/integration/proxy-registry-flow.test.ts @@ -7,8 +7,10 @@ import path from "node:path"; const TEST_DATA_DIR = fs.mkdtempSync(path.join(os.tmpdir(), "omniroute-proxy-registry-flow-")); process.env.DATA_DIR = TEST_DATA_DIR; // Disable dashboard auth for direct route handler calls in CI -// (postinstall auto-generates DASHBOARD_PASSWORD, causing 401 on management routes) +// (CI sets JWT_SECRET + INITIAL_PASSWORD, causing isAuthRequired() → true) process.env.DASHBOARD_PASSWORD = ""; +process.env.INITIAL_PASSWORD = ""; +delete process.env.JWT_SECRET; const core = await import("../../src/lib/db/core.ts"); const providersDb = await import("../../src/lib/db/providers.ts");