@@ -98,18 +98,35 @@ def test_nouser
9898 def test_user_token
9999 config = Kubeclient ::Config . read ( config_file ( 'userauth.kubeconfig' ) )
100100 assert_equal (
101- [ 'localhost/system:admin:token' , 'localhost/system:admin:userpass' ] ,
101+ [ 'localhost/system:admin:token' ,
102+ 'localhost/system:admin:token-file' ,
103+ 'localhost/system:admin:userpass' ] ,
102104 config . contexts
103105 )
104106 context = config . context ( 'localhost/system:admin:token' )
105107 check_context ( context , ssl : true , custom_ca : false , client_cert : false )
106108 assert_equal ( '0123456789ABCDEF0123456789ABCDEF' , context . auth_options [ :bearer_token ] )
107109 end
108110
111+ def test_user_token_file
112+ config = Kubeclient ::Config . read ( config_file ( 'userauth.kubeconfig' ) )
113+ assert_equal (
114+ [ 'localhost/system:admin:token' ,
115+ 'localhost/system:admin:token-file' ,
116+ 'localhost/system:admin:userpass' ] ,
117+ config . contexts
118+ )
119+ context = config . context ( 'localhost/system:admin:token-file' )
120+ check_context ( context , ssl : true , custom_ca : false , client_cert : false )
121+ assert_equal ( '/path/to/secret/token' , context . auth_options [ :bearer_token_file ] )
122+ end
123+
109124 def test_user_password
110125 config = Kubeclient ::Config . read ( config_file ( 'userauth.kubeconfig' ) )
111126 assert_equal (
112- [ 'localhost/system:admin:token' , 'localhost/system:admin:userpass' ] ,
127+ [ 'localhost/system:admin:token' ,
128+ 'localhost/system:admin:token-file' ,
129+ 'localhost/system:admin:userpass' ] ,
113130 config . contexts
114131 )
115132 context = config . context ( 'localhost/system:admin:userpass' )
0 commit comments