Skip to content

Commit 1eddbe5

Browse files
committed
find execAuth in test instead of relying on order and length of auths
1 parent 6192170 commit 1eddbe5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/config_test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import * as requestlib from 'request';
1010
import { CoreV1Api } from './api';
1111
import { bufferFromFileOrString, findHomeDir, findObject, KubeConfig, makeAbsolutePath } from './config';
1212
import { Cluster, newClusters, newContexts, newUsers, User, ActionOnInvalid } from './config_types';
13+
import { ExecAuth } from './exec_auth';
1314

1415
const kcFileName = 'testdata/kubeconfig.yaml';
1516
const kc2FileName = 'testdata/kubeconfig-2.yaml';
@@ -745,9 +746,10 @@ describe('KubeConfig', () => {
745746
// TODO: inject the exec command here?
746747
const opts = {} as requestlib.Options;
747748
await config.applyToRequest(opts);
748-
expect((KubeConfig as any).authenticators[1].tokenCache['exec']).to.deep.equal(
749-
JSON.parse(responseStr),
749+
let execAuthenticator = (KubeConfig as any).authenticators.find(
750+
(authenticator) => authenticator instanceof ExecAuth,
750751
);
752+
expect(execAuthenticator.tokenCache['exec']).to.deep.equal(JSON.parse(responseStr));
751753
});
752754

753755
it('should throw with no command.', () => {

0 commit comments

Comments
 (0)