Skip to content

Commit

Permalink
find execAuth in test instead of relying on order and length of auths
Browse files Browse the repository at this point in the history
  • Loading branch information
mansona committed Jul 29, 2021
1 parent 6192170 commit 1eddbe5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/config_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import * as requestlib from 'request';
import { CoreV1Api } from './api';
import { bufferFromFileOrString, findHomeDir, findObject, KubeConfig, makeAbsolutePath } from './config';
import { Cluster, newClusters, newContexts, newUsers, User, ActionOnInvalid } from './config_types';
import { ExecAuth } from './exec_auth';

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

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

0 comments on commit 1eddbe5

Please sign in to comment.