File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -676,8 +676,30 @@ describe('KubeConfig', () => {
676
676
expect ( opts . headers . Authorization ) . to . equal ( `Bearer ${ token } ` ) ;
677
677
}
678
678
} ) ;
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
+ } ) ;
679
702
it ( 'should exec with exec auth and env vars' , ( ) => {
680
-
681
703
const config = new KubeConfig ( ) ;
682
704
const token = 'token' ;
683
705
const responseStr = `'{ "token": "${ token } " }'` ;
You can’t perform that action at this time.
0 commit comments