@@ -113,18 +113,18 @@ def test_watch_pod_api_bearer_token_file_success
113113 watcher = client . watch_pods ( as : :raw )
114114
115115 begin
116- file . write ( " valid_token" )
116+ file . write ( ' valid_token' )
117117 file . rewind
118118 stub_token = stub_request ( :get , %r{/watch/pods} )
119- . with ( headers : { Authorization : 'Bearer valid_token' } )
120- . to_return ( body : open_test_file ( 'watch_stream.json' ) , status : 200 )
119+ . with ( headers : { Authorization : 'Bearer valid_token' } )
120+ . to_return ( body : open_test_file ( 'watch_stream.json' ) , status : 200 )
121121
122122 got = nil
123123 watcher . each { |notice | got = notice }
124124 assert_match ( /\A {"type":"DELETED"/ , got )
125125 remove_request_stub ( stub_token )
126126
127- file . write ( " rotated_token" )
127+ file . write ( ' rotated_token' )
128128 file . close
129129 stub_request ( :get , %r{/watch/pods} )
130130 . with ( headers : { Authorization : 'Bearer rotated_token' } )
@@ -134,8 +134,8 @@ def test_watch_pod_api_bearer_token_file_success
134134 watcher . each { |notice | got = notice }
135135 assert_match ( /\A {"type":"DELETED"/ , got )
136136 ensure
137- file . close
138- file . unlink # deletes the temp file
137+ file . close
138+ file . unlink # deletes the temp file
139139 end
140140 end
141141
@@ -145,16 +145,19 @@ def test_watch_pod_api_bearer_token_success
145145 file = Tempfile . new ( 'token' )
146146 client = Kubeclient ::Client . new (
147147 'http://localhost:8080/api/' , 'v1' ,
148- auth_options : { bearer_token : " valid_token" }
148+ auth_options : { bearer_token : ' valid_token' }
149149 )
150150
151- stub_token = stub_request ( :get , %r{/watch/pods} )
151+ stub_request ( :get , %r{/watch/pods} )
152152 . with ( headers : { Authorization : 'Bearer valid_token' } )
153153 . to_return ( body : open_test_file ( 'watch_stream.json' ) , status : 200 )
154154
155155 got = nil
156156 client . watch_pods ( as : :raw ) . each { |notice | got = notice }
157157 assert_match ( /\A {"type":"DELETED"/ , got )
158+ ensure
159+ file . close
160+ file . unlink # deletes the temp file
158161 end
159162
160163 # Ensure that WatchStream respects a format that's not JSON
0 commit comments