Skip to content

Commit e8a0fc0

Browse files
committed
Merge branch 'fix/refresh-token-if-empty' of https://github.com/panter/javascript into fix/refresh-token-if-empty
2 parents 0d967ad + 62a060f commit e8a0fc0

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/config_test.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,8 +676,30 @@ describe('KubeConfig', () => {
676676
expect(opts.headers.Authorization).to.equal(`Bearer ${token}`);
677677
}
678678
});
679+
it('should exec without access-token', () => {
680+
const config = new KubeConfig();
681+
const token = 'token';
682+
const responseStr = `{ "token": { "accessToken": "${token}" } }`;
683+
config.loadFromClusterAndUser(
684+
{ skipTLSVerify: false } as Cluster,
685+
{
686+
authProvider: {
687+
name: 'azure',
688+
config: {
689+
'cmd-path': 'echo',
690+
'cmd-args': `'${responseStr}'`,
691+
'token-key': '{.token.accessToken}',
692+
},
693+
},
694+
} as User);
695+
const opts = {} as requestlib.Options;
696+
config.applyToRequest(opts);
697+
expect(opts.headers).to.not.be.undefined;
698+
if (opts.headers) {
699+
expect(opts.headers.Authorization).to.equal(`Bearer ${token}`);
700+
}
701+
});
679702
it('should exec with exec auth and env vars', () => {
680-
681703
const config = new KubeConfig();
682704
const token = 'token';
683705
const responseStr = `'{ "token": "${token}" }'`;

0 commit comments

Comments
 (0)