From fa91a37426115777480e6f096e8b90e63ef34cea Mon Sep 17 00:00:00 2001 From: cjihrig Date: Wed, 5 Mar 2025 09:21:12 -0500 Subject: [PATCH] test: handle process.env in config_test.ts The tests in #2288 can fail depending on the environment variables on the system. This commit takes the environment out of the equation. Refs: https://github.com/kubernetes-client/javascript/pull/2288 --- src/config_test.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/config_test.ts b/src/config_test.ts index 9bb31dd52c..5e082ee8bb 100644 --- a/src/config_test.ts +++ b/src/config_test.ts @@ -1613,6 +1613,19 @@ describe('KubeConfig', () => { }); describe('BufferOrFile', () => { + let originalEnv; + + before(() => { + // The code being tested here references process.env and can fail + // if run on a machine with certain environment variable settings. + originalEnv = process.env; + process.env = {}; + }); + + after(() => { + process.env = originalEnv; + }); + it('should load from root if present', () => { const data = 'some data for file'; const arg: any = {