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.
This commit is contained in:
diegosouzapw
2026-04-26 03:49:10 -03:00
parent 72afe8fe04
commit ead269d30d
2 changed files with 6 additions and 2 deletions

View File

@@ -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();

View File

@@ -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");