@@ -5,6 +5,7 @@ import os from "node:os";
55import path from "node:path" ;
66import { afterAll , beforeAll , beforeEach , describe , expect , it } from "vitest" ;
77import { WebSocket } from "ws" ;
8+ import { deleteTestEnvValue , setTestEnvValue } from "../test-utils/env.js" ;
89import {
910 loadGatewayConfig ,
1011 openAuthenticatedGatewayWs ,
@@ -339,7 +340,7 @@ describe("gateway shared auth rotation with unchanged SecretRefs", () => {
339340 }
340341 secretRefPort = await getFreePort ( ) ;
341342 testState . gatewayAuth = undefined ;
342- process . env [ SECRET_REF_TOKEN_ID ] = OLD_TOKEN ;
343+ setTestEnvValue ( SECRET_REF_TOKEN_ID , OLD_TOKEN ) ;
343344 await fs . mkdir ( path . dirname ( configPath ) , { recursive : true } ) ;
344345 await fs . writeFile (
345346 configPath ,
@@ -362,11 +363,11 @@ describe("gateway shared auth rotation with unchanged SecretRefs", () => {
362363
363364 beforeEach ( ( ) => {
364365 testState . gatewayAuth = undefined ;
365- process . env [ SECRET_REF_TOKEN_ID ] = OLD_TOKEN ;
366+ setTestEnvValue ( SECRET_REF_TOKEN_ID , OLD_TOKEN ) ;
366367 } ) ;
367368
368369 afterAll ( async ( ) => {
369- delete process . env [ SECRET_REF_TOKEN_ID ] ;
370+ deleteTestEnvValue ( SECRET_REF_TOKEN_ID ) ;
370371 testState . gatewayAuth = ORIGINAL_GATEWAY_AUTH ;
371372 await secretRefServer . close ( ) ;
372373 } ) ;
@@ -379,7 +380,7 @@ describe("gateway shared auth rotation with unchanged SecretRefs", () => {
379380 const ws = await openSecretRefAuthenticatedWs ( ) ;
380381 try {
381382 const closed = waitForGatewayWsClose ( ws , 30_000 ) ;
382- process . env [ SECRET_REF_TOKEN_ID ] = NEW_TOKEN ;
383+ setTestEnvValue ( SECRET_REF_TOKEN_ID , NEW_TOKEN ) ;
383384 const res = await applyCurrentConfig ( ws ) ;
384385 expect ( res . ok ) . toBe ( true ) ;
385386 await expectGatewayAuthChangedClose ( closed ) ;
0 commit comments