@@ -5,6 +5,7 @@ import os from "node:os";
|
5 | 5 | import path from "node:path"; |
6 | 6 | import { afterAll, beforeAll, beforeEach, describe, expect, it } from "vitest"; |
7 | 7 | import { WebSocket } from "ws"; |
| 8 | +import { deleteTestEnvValue, setTestEnvValue } from "../test-utils/env.js"; |
8 | 9 | import { |
9 | 10 | loadGatewayConfig, |
10 | 11 | openAuthenticatedGatewayWs, |
@@ -339,7 +340,7 @@ describe("gateway shared auth rotation with unchanged SecretRefs", () => {
|
339 | 340 | } |
340 | 341 | secretRefPort = await getFreePort(); |
341 | 342 | testState.gatewayAuth = undefined; |
342 | | -process.env[SECRET_REF_TOKEN_ID] = OLD_TOKEN; |
| 343 | +setTestEnvValue(SECRET_REF_TOKEN_ID, OLD_TOKEN); |
343 | 344 | await fs.mkdir(path.dirname(configPath), { recursive: true }); |
344 | 345 | await fs.writeFile( |
345 | 346 | configPath, |
@@ -362,11 +363,11 @@ describe("gateway shared auth rotation with unchanged SecretRefs", () => {
|
362 | 363 | |
363 | 364 | beforeEach(() => { |
364 | 365 | testState.gatewayAuth = undefined; |
365 | | -process.env[SECRET_REF_TOKEN_ID] = OLD_TOKEN; |
| 366 | +setTestEnvValue(SECRET_REF_TOKEN_ID, OLD_TOKEN); |
366 | 367 | }); |
367 | 368 | |
368 | 369 | afterAll(async () => { |
369 | | -delete process.env[SECRET_REF_TOKEN_ID]; |
| 370 | +deleteTestEnvValue(SECRET_REF_TOKEN_ID); |
370 | 371 | testState.gatewayAuth = ORIGINAL_GATEWAY_AUTH; |
371 | 372 | await secretRefServer.close(); |
372 | 373 | }); |
@@ -379,7 +380,7 @@ describe("gateway shared auth rotation with unchanged SecretRefs", () => {
|
379 | 380 | const ws = await openSecretRefAuthenticatedWs(); |
380 | 381 | try { |
381 | 382 | const closed = waitForGatewayWsClose(ws, 30_000); |
382 | | -process.env[SECRET_REF_TOKEN_ID] = NEW_TOKEN; |
| 383 | +setTestEnvValue(SECRET_REF_TOKEN_ID, NEW_TOKEN); |
383 | 384 | const res = await applyCurrentConfig(ws); |
384 | 385 | expect(res.ok).toBe(true); |
385 | 386 | await expectGatewayAuthChangedClose(closed); |
|