Skip to content

Commit e3979c9

Browse files
committed
fix: 'expiry-key' is not set in tests
1 parent e548962 commit e3979c9

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/cloud_auth.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ export class CloudAuth implements Authenticator {
7474
const output = result.stdout.toString();
7575
const resultObj = JSON.parse(output);
7676

77-
let tokenPathKey = config['token-key'];
77+
const tokenPathKeyInConfig = config['token-key'];
78+
const expiryPathKeyInConfig = config['expiry-key'];
7879

79-
let expiryPathKey = config['expiry-key'];
8080
// Format in file is {<query>}, so slice it out and add '$'
81-
tokenPathKey = '$' + tokenPathKey.slice(1, -1);
82-
expiryPathKey = '$' + expiryPathKey.slice(1, -1);
81+
const tokenPathKey = '$' + tokenPathKeyInConfig.slice(1, -1);
82+
const expiryPathKey = '$' + expiryPathKeyInConfig.slice(1, -1);
8383

8484
config['access-token'] = jsonpath.query(resultObj, tokenPathKey);
8585
config.expiry = jsonpath.query(resultObj, expiryPathKey);

src/config_test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,7 @@ describe('KubeConfig', () => {
643643
'cmd-path': 'echo',
644644
'cmd-args': `'${responseStr}'`,
645645
'token-key': '{.token.accessToken}',
646+
'expiry-key': '{.token.token_expiry}',
646647
},
647648
},
648649
} as User);
@@ -666,6 +667,7 @@ describe('KubeConfig', () => {
666667
'cmd-path': 'echo',
667668
'cmd-args': `'${responseStr}'`,
668669
'token-key': '{.token.accessToken}',
670+
'expiry-key': '{.token.token_expiry}',
669671
},
670672
},
671673
} as User);
@@ -689,6 +691,7 @@ describe('KubeConfig', () => {
689691
'cmd-path': 'echo',
690692
'cmd-args': `'${responseStr}'`,
691693
'token-key': '{.token.accessToken}',
694+
'expiry-key': '{.token.token_expiry}',
692695
},
693696
},
694697
} as User);

0 commit comments

Comments
 (0)