Skip to content

Commit e1d6a11

Browse files
committed
test(config): add test for preserving starting file context
1 parent 3d00471 commit e1d6a11

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/config_test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,6 +1036,14 @@ describe('KubeConfig', () => {
10361036
expect(kc.contexts.length).to.equal(4);
10371037
expect(kc.getCurrentContext()).to.equal('contextA');
10381038
});
1039+
it('should preserve starting file context', () => {
1040+
process.env.KUBECONFIG = kcFileName + path.delimiter + kc2FileName;
1041+
1042+
const kc = new KubeConfig();
1043+
kc.loadFromDefault({}, true);
1044+
1045+
expect(kc.getCurrentContext()).to.equal('context2');
1046+
});
10391047
it('should throw with duplicate clusters', () => {
10401048
process.env.KUBECONFIG = kcFileName + path.delimiter + kcDupeCluster;
10411049

0 commit comments

Comments
 (0)