kubeclient 2.5.2 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of kubeclient might be problematic. Click here for more details.

Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +13 -5
  3. data/.travis.yml +2 -10
  4. data/CHANGELOG.md +21 -2
  5. data/README.md +112 -46
  6. data/Rakefile +2 -5
  7. data/kubeclient.gemspec +9 -7
  8. data/lib/kubeclient.rb +8 -8
  9. data/lib/kubeclient/common.rb +88 -105
  10. data/lib/kubeclient/config.rb +10 -10
  11. data/lib/kubeclient/http_error.rb +25 -0
  12. data/lib/kubeclient/missing_kind_compatibility.rb +1 -1
  13. data/lib/kubeclient/resource.rb +11 -0
  14. data/lib/kubeclient/resource_not_found_error.rb +4 -0
  15. data/lib/kubeclient/version.rb +1 -1
  16. data/lib/kubeclient/watch_stream.rb +17 -10
  17. data/test/test_common.rb +3 -3
  18. data/test/test_component_status.rb +16 -14
  19. data/test/test_config.rb +11 -11
  20. data/test/test_endpoint.rb +16 -12
  21. data/test/test_guestbook_go.rb +64 -62
  22. data/test/test_helper.rb +2 -0
  23. data/test/test_kubeclient.rb +268 -282
  24. data/test/test_limit_range.rb +11 -11
  25. data/test/test_missing_methods.rb +3 -3
  26. data/test/test_namespace.rb +27 -27
  27. data/test/test_node.rb +17 -15
  28. data/test/test_persistent_volume.rb +16 -14
  29. data/test/test_persistent_volume_claim.rb +16 -14
  30. data/test/test_pod.rb +16 -14
  31. data/test/test_pod_log.rb +4 -4
  32. data/test/test_process_template.rb +7 -7
  33. data/test/test_replication_controller.rb +29 -4
  34. data/test/test_resource_list_without_kind.rb +7 -7
  35. data/test/test_resource_quota.rb +4 -4
  36. data/test/test_secret.rb +11 -10
  37. data/test/test_service.rb +36 -31
  38. data/test/test_service_account.rb +4 -4
  39. data/test/test_watch.rb +52 -29
  40. data/test/test_watch_notice.rb +1 -1
  41. metadata +35 -26
  42. data/Gemfile-rest-client-1.8.rb +0 -11
  43. data/lib/kubeclient/kube_exception.rb +0 -14
@@ -1,4 +1,6 @@
1
+ require 'bundler/setup'
1
2
  require 'minitest/autorun'
3
+ require 'minitest/rg'
2
4
  require 'webmock/minitest'
3
5
  require 'json'
4
6
  require 'kubeclient'
@@ -1,7 +1,7 @@
1
- require 'test_helper'
1
+ require_relative 'test_helper'
2
2
 
3
3
  # Kubernetes client entity tests
4
- class KubeClientTest < MiniTest::Test
4
+ class KubeclientTest < MiniTest::Test
5
5
  def test_json
6
6
  our_object = Kubeclient::Resource.new
7
7
  our_object.foo = 'bar'
@@ -10,8 +10,10 @@ class KubeClientTest < MiniTest::Test
10
10
  our_object.nested.again.again = {}
11
11
  our_object.nested.again.again.name = 'aaron'
12
12
 
13
- expected = { 'foo' => 'bar', 'nested' => { 'again' => { 'again' =>
14
- { 'name' => 'aaron' } } } }
13
+ expected = {
14
+ 'foo' => 'bar',
15
+ 'nested' => { 'again' => { 'again' => { 'name' => 'aaron' } } }
16
+ }
15
17
 
16
18
  assert_equal(expected, JSON.parse(JSON.dump(our_object.to_h)))
17
19
  end
@@ -21,33 +23,32 @@ class KubeClientTest < MiniTest::Test
21
23
  # wrap an ipv6 address in []
22
24
  uri = URI::HTTP.build(port: 8080)
23
25
  uri.hostname = 'localhost'
24
- client = Kubeclient::Client.new uri
26
+ client = Kubeclient::Client.new(uri)
25
27
  rest_client = client.rest_client
26
- assert_equal 'http://localhost:8080/api/v1', rest_client.url.to_s
28
+ assert_equal('http://localhost:8080/api/v1', rest_client.url.to_s)
27
29
  end
28
30
 
29
31
  def test_no_path_in_uri
30
- client = Kubeclient::Client.new 'http://localhost:8080', 'v1'
32
+ client = Kubeclient::Client.new('http://localhost:8080', 'v1')
31
33
  rest_client = client.rest_client
32
- assert_equal 'http://localhost:8080/api/v1', rest_client.url.to_s
34
+ assert_equal('http://localhost:8080/api/v1', rest_client.url.to_s)
33
35
  end
34
36
 
35
37
  def test_no_version_passed
36
- client = Kubeclient::Client.new 'http://localhost:8080'
38
+ client = Kubeclient::Client.new('http://localhost:8080')
37
39
  rest_client = client.rest_client
38
- assert_equal 'http://localhost:8080/api/v1', rest_client.url.to_s
40
+ assert_equal('http://localhost:8080/api/v1', rest_client.url.to_s)
39
41
  end
40
42
 
41
43
  def test_pass_proxy
42
44
  uri = URI::HTTP.build(host: 'localhost', port: 8080)
43
45
  proxy_uri = URI::HTTP.build(host: 'myproxyhost', port: 8888)
44
46
  stub_request(:get, %r{/api/v1$})
45
- .to_return(body: open_test_file('core_api_resource_list.json'),
46
- status: 200)
47
+ .to_return(body: open_test_file('core_api_resource_list.json'), status: 200)
47
48
 
48
49
  client = Kubeclient::Client.new(uri, http_proxy_uri: proxy_uri)
49
50
  rest_client = client.rest_client
50
- assert_equal proxy_uri.to_s, rest_client.options[:proxy]
51
+ assert_equal(proxy_uri.to_s, rest_client.options[:proxy])
51
52
 
52
53
  watch_client = client.watch_pods
53
54
  assert_equal(watch_client.send(:build_client_options)[:proxy][:proxy_address], proxy_uri.host)
@@ -56,11 +57,9 @@ class KubeClientTest < MiniTest::Test
56
57
 
57
58
  def test_exception
58
59
  stub_request(:get, %r{/api/v1$})
59
- .to_return(body: open_test_file('core_api_resource_list.json'),
60
- status: 200)
60
+ .to_return(body: open_test_file('core_api_resource_list.json'), status: 200)
61
61
  stub_request(:post, %r{/services})
62
- .to_return(body: open_test_file('namespace_exception.json'),
63
- status: 409)
62
+ .to_return(body: open_test_file('namespace_exception.json'), status: 409)
64
63
 
65
64
  service = Kubeclient::Resource.new
66
65
  service.metadata = {}
@@ -70,23 +69,37 @@ class KubeClientTest < MiniTest::Test
70
69
  # service.container_port = 6379
71
70
  # service.protocol = 'TCP'
72
71
 
73
- client = Kubeclient::Client.new 'http://localhost:8080/api/'
72
+ client = Kubeclient::Client.new('http://localhost:8080/api/')
74
73
 
75
- exception = assert_raises(KubeException) do
76
- service = client.create_service service
74
+ exception = assert_raises(Kubeclient::HttpError) do
75
+ service = client.create_service(service)
77
76
  end
78
77
 
79
- assert_instance_of(KubeException, exception)
78
+ assert_instance_of(Kubeclient::HttpError, exception)
80
79
  assert_equal("converting to : type names don't match (Pod, Namespace)",
81
80
  exception.message)
81
+
82
+ assert_includes(exception.to_s, ' for POST http://localhost:8080/api')
82
83
  assert_equal(409, exception.error_code)
83
84
  end
84
85
 
86
+ def test_deprecated_exception
87
+ error_message = 'certificate verify failed'
88
+
89
+ stub_request(:get, 'http://localhost:8080/api')
90
+ .to_raise(OpenSSL::SSL::SSLError.new(error_message))
91
+
92
+ client = Kubeclient::Client.new('http://localhost:8080/api/')
93
+
94
+ exception = assert_raises(KubeException) { client.api }
95
+ assert_equal(error_message, exception.message)
96
+ end
97
+
85
98
  def test_api
86
99
  stub_request(:get, 'http://localhost:8080/api')
87
100
  .to_return(status: 200, body: open_test_file('versions_list.json'))
88
101
 
89
- client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1'
102
+ client = Kubeclient::Client.new('http://localhost:8080/api/', 'v1')
90
103
  response = client.api
91
104
  assert_includes(response, 'versions')
92
105
  end
@@ -97,9 +110,9 @@ class KubeClientTest < MiniTest::Test
97
110
  stub_request(:get, 'http://localhost:8080/api')
98
111
  .to_raise(OpenSSL::SSL::SSLError.new(error_message))
99
112
 
100
- client = Kubeclient::Client.new 'http://localhost:8080/api/'
113
+ client = Kubeclient::Client.new('http://localhost:8080/api/')
101
114
 
102
- exception = assert_raises(KubeException) { client.api }
115
+ exception = assert_raises(Kubeclient::HttpError) { client.api }
103
116
  assert_equal(error_message, exception.message)
104
117
  end
105
118
 
@@ -108,7 +121,7 @@ class KubeClientTest < MiniTest::Test
108
121
 
109
122
  client = Kubeclient::Client.new('http://localhost:8080/api/')
110
123
 
111
- exception = assert_raises(KubeException) { client.api }
124
+ exception = assert_raises(Kubeclient::HttpError) { client.api }
112
125
  assert_match(/(timed out|timeout)/i, exception.message)
113
126
  end
114
127
 
@@ -128,7 +141,7 @@ class KubeClientTest < MiniTest::Test
128
141
  stub_request(:get, 'http://localhost:8080/api')
129
142
  .to_return(status: 200, body: open_test_file('versions_list.json'))
130
143
 
131
- client = Kubeclient::Client.new 'http://localhost:8080/api/', 'foobar1'
144
+ client = Kubeclient::Client.new('http://localhost:8080/api/', 'foobar1')
132
145
  refute client.api_valid?
133
146
  end
134
147
 
@@ -136,7 +149,7 @@ class KubeClientTest < MiniTest::Test
136
149
  stub_request(:get, 'http://localhost:8080/api')
137
150
  .to_return(status: 200, body: '{}')
138
151
 
139
- client = Kubeclient::Client.new 'http://localhost:8080/api/'
152
+ client = Kubeclient::Client.new('http://localhost:8080/api/')
140
153
  refute client.api_valid?
141
154
  end
142
155
 
@@ -144,7 +157,7 @@ class KubeClientTest < MiniTest::Test
144
157
  stub_request(:get, 'http://localhost:8080/api')
145
158
  .to_return(status: 200, body: '[]')
146
159
 
147
- client = Kubeclient::Client.new 'http://localhost:8080/api/'
160
+ client = Kubeclient::Client.new('http://localhost:8080/api/')
148
161
  refute client.api_valid?
149
162
  end
150
163
 
@@ -152,33 +165,30 @@ class KubeClientTest < MiniTest::Test
152
165
  stub_request(:get, 'http://localhost:8080/api')
153
166
  .to_return(status: [404, 'Resource Not Found'])
154
167
 
155
- client = Kubeclient::Client.new 'http://localhost:8080/api/'
156
- assert_raises(KubeException) { client.api_valid? }
168
+ client = Kubeclient::Client.new('http://localhost:8080/api/')
169
+ assert_raises(Kubeclient::HttpError) { client.api_valid? }
157
170
  end
158
171
 
159
172
  def test_api_valid_with_non_json
160
173
  stub_request(:get, 'http://localhost:8080/api')
161
174
  .to_return(status: 200, body: '<html></html>')
162
175
 
163
- client = Kubeclient::Client.new 'http://localhost:8080/api/'
176
+ client = Kubeclient::Client.new('http://localhost:8080/api/')
164
177
  assert_raises(JSON::ParserError) { client.api_valid? }
165
178
  end
166
179
 
167
180
  def test_nonjson_exception
168
181
  stub_request(:get, %r{/api/v1$})
169
- .to_return(body: open_test_file('core_api_resource_list.json'),
170
- status: 200)
182
+ .to_return(body: open_test_file('core_api_resource_list.json'), status: 200)
171
183
  stub_request(:get, %r{/servic})
172
- .to_return(body: open_test_file('service_illegal_json_404.json'),
173
- status: 404)
184
+ .to_return(body: open_test_file('service_illegal_json_404.json'), status: 404)
174
185
 
175
- client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1'
186
+ client = Kubeclient::Client.new('http://localhost:8080/api/', 'v1')
176
187
 
177
- exception = assert_raises(KubeException) do
188
+ exception = assert_raises(Kubeclient::ResourceNotFoundError) do
178
189
  client.get_services
179
190
  end
180
191
 
181
- assert_instance_of(KubeException, exception)
182
192
  assert(exception.message.include?('Not Found'))
183
193
  assert_equal(404, exception.error_code)
184
194
  end
@@ -191,7 +201,7 @@ class KubeClientTest < MiniTest::Test
191
201
 
192
202
  client = Kubeclient::Client.new('http://localhost:8080/api/', 'v1')
193
203
 
194
- exception = assert_raises(KubeException) do
204
+ exception = assert_raises(Kubeclient::ResourceNotFoundError) do
195
205
  client.get_services(as: :raw)
196
206
  end
197
207
 
@@ -201,25 +211,21 @@ class KubeClientTest < MiniTest::Test
201
211
 
202
212
  def test_entity_list
203
213
  stub_request(:get, %r{/api/v1$})
204
- .to_return(body: open_test_file('core_api_resource_list.json'),
205
- status: 200)
214
+ .to_return(body: open_test_file('core_api_resource_list.json'), status: 200)
206
215
  stub_request(:get, %r{/services})
207
- .to_return(body: open_test_file('entity_list.json'),
208
- status: 200)
216
+ .to_return(body: open_test_file('entity_list.json'), status: 200)
209
217
 
210
- client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1'
218
+ client = Kubeclient::Client.new('http://localhost:8080/api/', 'v1')
211
219
  services = client.get_services
212
220
 
213
221
  refute_empty(services)
214
222
  assert_instance_of(Kubeclient::Common::EntityList, services)
215
223
  assert_equal('Service', services.kind)
216
224
  assert_equal(2, services.size)
217
- assert_instance_of(Kubeclient::Service, services[0])
218
- assert_instance_of(Kubeclient::Service, services[1])
225
+ assert_instance_of(Kubeclient::Resource, services[0])
226
+ assert_instance_of(Kubeclient::Resource, services[1])
219
227
 
220
- assert_requested(:get,
221
- 'http://localhost:8080/api/v1/services',
222
- times: 1)
228
+ assert_requested(:get, 'http://localhost:8080/api/v1/services', times: 1)
223
229
  end
224
230
 
225
231
  def test_entity_list_raw
@@ -245,7 +251,7 @@ class KubeClientTest < MiniTest::Test
245
251
 
246
252
  client = Kubeclient::Client.new('http://localhost:8080/api/', 'v1')
247
253
 
248
- exception = assert_raises(KubeException) { client.get_services(as: :raw) }
254
+ exception = assert_raises(Kubeclient::HttpError) { client.get_services(as: :raw) }
249
255
  assert_equal('500 Internal Server Error', exception.message)
250
256
  assert_equal(500, exception.error_code)
251
257
  end
@@ -254,49 +260,47 @@ class KubeClientTest < MiniTest::Test
254
260
  selector = 'component=apiserver'
255
261
 
256
262
  stub_request(:get, %r{/api/v1$})
257
- .to_return(body: open_test_file('core_api_resource_list.json'),
258
- status: 200)
263
+ .to_return(body: open_test_file('core_api_resource_list.json'), status: 200)
259
264
  stub_request(:get, %r{/services})
260
- .to_return(body: open_test_file('entity_list.json'),
261
- status: 200)
265
+ .to_return(body: open_test_file('entity_list.json'), status: 200)
262
266
 
263
- client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1'
267
+ client = Kubeclient::Client.new('http://localhost:8080/api/', 'v1')
264
268
  services = client.get_services(label_selector: selector)
265
269
 
266
270
  assert_instance_of(Kubeclient::Common::EntityList, services)
267
- assert_requested(:get,
268
- "http://localhost:8080/api/v1/services?labelSelector=#{selector}",
269
- times: 1)
271
+ assert_requested(
272
+ :get,
273
+ "http://localhost:8080/api/v1/services?labelSelector=#{selector}",
274
+ times: 1
275
+ )
270
276
  end
271
277
 
272
278
  def test_entities_with_field_selector
273
279
  selector = 'involvedObject.name=redis-master'
274
280
 
275
281
  stub_request(:get, %r{/api/v1$})
276
- .to_return(body: open_test_file('core_api_resource_list.json'),
277
- status: 200)
282
+ .to_return(body: open_test_file('core_api_resource_list.json'), status: 200)
278
283
  stub_request(:get, %r{/services})
279
- .to_return(body: open_test_file('entity_list.json'),
280
- status: 200)
284
+ .to_return(body: open_test_file('entity_list.json'), status: 200)
281
285
 
282
- client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1'
286
+ client = Kubeclient::Client.new('http://localhost:8080/api/', 'v1')
283
287
  services = client.get_services(field_selector: selector)
284
288
 
285
289
  assert_instance_of(Kubeclient::Common::EntityList, services)
286
- assert_requested(:get,
287
- "http://localhost:8080/api/v1/services?fieldSelector=#{selector}",
288
- times: 1)
290
+ assert_requested(
291
+ :get,
292
+ "http://localhost:8080/api/v1/services?fieldSelector=#{selector}",
293
+ times: 1
294
+ )
289
295
  end
290
296
 
291
297
  def test_empty_list
292
298
  stub_request(:get, %r{/api/v1$})
293
- .to_return(body: open_test_file('core_api_resource_list.json'),
294
- status: 200)
299
+ .to_return(body: open_test_file('core_api_resource_list.json'), status: 200)
295
300
  stub_request(:get, %r{/pods})
296
- .to_return(body: open_test_file('empty_pod_list.json'),
297
- status: 200)
301
+ .to_return(body: open_test_file('empty_pod_list.json'), status: 200)
298
302
 
299
- client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1'
303
+ client = Kubeclient::Client.new('http://localhost:8080/api/', 'v1')
300
304
  pods = client.get_pods
301
305
  assert_instance_of(Kubeclient::Common::EntityList, pods)
302
306
  assert_equal(0, pods.size)
@@ -304,32 +308,25 @@ class KubeClientTest < MiniTest::Test
304
308
 
305
309
  def test_get_all
306
310
  stub_request(:get, %r{/api/v1$})
307
- .to_return(body: open_test_file('core_api_resource_list.json'),
308
- status: 200)
311
+ .to_return(body: open_test_file('core_api_resource_list.json'), status: 200)
309
312
 
310
313
  stub_request(:get, %r{/bindings})
311
- .to_return(body: open_test_file('bindings_list.json'),
312
- status: 404)
314
+ .to_return(body: open_test_file('bindings_list.json'), status: 404)
313
315
 
314
316
  stub_request(:get, %r{/configmaps})
315
- .to_return(body: open_test_file('config_map_list.json'),
316
- status: 200)
317
+ .to_return(body: open_test_file('config_map_list.json'), status: 200)
317
318
 
318
319
  stub_request(:get, %r{/podtemplates})
319
- .to_return(body: open_test_file('pod_template_list.json'),
320
- status: 200)
320
+ .to_return(body: open_test_file('pod_template_list.json'), status: 200)
321
321
 
322
322
  stub_request(:get, %r{/services})
323
- .to_return(body: open_test_file('service_list.json'),
324
- status: 200)
323
+ .to_return(body: open_test_file('service_list.json'), status: 200)
325
324
 
326
325
  stub_request(:get, %r{/pods})
327
- .to_return(body: open_test_file('pod_list.json'),
328
- status: 200)
326
+ .to_return(body: open_test_file('pod_list.json'), status: 200)
329
327
 
330
328
  stub_request(:get, %r{/nodes})
331
- .to_return(body: open_test_file('node_list.json'),
332
- status: 200)
329
+ .to_return(body: open_test_file('node_list.json'), status: 200)
333
330
 
334
331
  stub_request(:get, %r{/replicationcontrollers})
335
332
  .to_return(body: open_test_file('replication_controller_list.json'), status: 200)
@@ -338,64 +335,54 @@ class KubeClientTest < MiniTest::Test
338
335
  .to_return(body: open_test_file('event_list.json'), status: 200)
339
336
 
340
337
  stub_request(:get, %r{/endpoints})
341
- .to_return(body: open_test_file('endpoint_list.json'),
342
- status: 200)
338
+ .to_return(body: open_test_file('endpoint_list.json'), status: 200)
343
339
 
344
340
  stub_request(:get, %r{/namespaces})
345
- .to_return(body: open_test_file('namespace_list.json'),
346
- status: 200)
341
+ .to_return(body: open_test_file('namespace_list.json'), status: 200)
347
342
 
348
343
  stub_request(:get, %r{/secrets})
349
- .to_return(body: open_test_file('secret_list.json'),
350
- status: 200)
344
+ .to_return(body: open_test_file('secret_list.json'), status: 200)
351
345
 
352
346
  stub_request(:get, %r{/resourcequotas})
353
- .to_return(body: open_test_file('resource_quota_list.json'),
354
- status: 200)
347
+ .to_return(body: open_test_file('resource_quota_list.json'), status: 200)
355
348
 
356
349
  stub_request(:get, %r{/limitranges})
357
- .to_return(body: open_test_file('limit_range_list.json'),
358
- status: 200)
350
+ .to_return(body: open_test_file('limit_range_list.json'), status: 200)
359
351
 
360
352
  stub_request(:get, %r{/persistentvolumes})
361
- .to_return(body: open_test_file('persistent_volume_list.json'),
362
- status: 200)
353
+ .to_return(body: open_test_file('persistent_volume_list.json'), status: 200)
363
354
 
364
355
  stub_request(:get, %r{/persistentvolumeclaims})
365
- .to_return(body: open_test_file('persistent_volume_claim_list.json'),
366
- status: 200)
356
+ .to_return(body: open_test_file('persistent_volume_claim_list.json'), status: 200)
367
357
 
368
358
  stub_request(:get, %r{/componentstatuses})
369
- .to_return(body: open_test_file('component_status_list.json'),
370
- status: 200)
359
+ .to_return(body: open_test_file('component_status_list.json'), status: 200)
371
360
 
372
361
  stub_request(:get, %r{/serviceaccounts})
373
- .to_return(body: open_test_file('service_account_list.json'),
374
- status: 200)
362
+ .to_return(body: open_test_file('service_account_list.json'), status: 200)
375
363
 
376
- client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1'
364
+ client = Kubeclient::Client.new('http://localhost:8080/api/', 'v1')
377
365
  result = client.all_entities
378
366
  assert_equal(16, result.keys.size)
379
367
  assert_instance_of(Kubeclient::Common::EntityList, result['node'])
380
368
  assert_instance_of(Kubeclient::Common::EntityList, result['service'])
381
- assert_instance_of(Kubeclient::Common::EntityList,
382
- result['replication_controller'])
369
+ assert_instance_of(Kubeclient::Common::EntityList, result['replication_controller'])
383
370
  assert_instance_of(Kubeclient::Common::EntityList, result['pod'])
384
371
  assert_instance_of(Kubeclient::Common::EntityList, result['event'])
385
372
  assert_instance_of(Kubeclient::Common::EntityList, result['namespace'])
386
373
  assert_instance_of(Kubeclient::Common::EntityList, result['secret'])
387
- assert_instance_of(Kubeclient::Service, result['service'][0])
388
- assert_instance_of(Kubeclient::Node, result['node'][0])
389
- assert_instance_of(Kubeclient::Event, result['event'][0])
390
- assert_instance_of(Kubeclient::Endpoint, result['endpoint'][0])
391
- assert_instance_of(Kubeclient::Namespace, result['namespace'][0])
392
- assert_instance_of(Kubeclient::Secret, result['secret'][0])
393
- assert_instance_of(Kubeclient::ResourceQuota, result['resource_quota'][0])
394
- assert_instance_of(Kubeclient::LimitRange, result['limit_range'][0])
395
- assert_instance_of(Kubeclient::PersistentVolume, result['persistent_volume'][0])
396
- assert_instance_of(Kubeclient::PersistentVolumeClaim, result['persistent_volume_claim'][0])
397
- assert_instance_of(Kubeclient::ComponentStatus, result['component_status'][0])
398
- assert_instance_of(Kubeclient::ServiceAccount, result['service_account'][0])
374
+ assert_instance_of(Kubeclient::Resource, result['service'][0])
375
+ assert_instance_of(Kubeclient::Resource, result['node'][0])
376
+ assert_instance_of(Kubeclient::Resource, result['event'][0])
377
+ assert_instance_of(Kubeclient::Resource, result['endpoint'][0])
378
+ assert_instance_of(Kubeclient::Resource, result['namespace'][0])
379
+ assert_instance_of(Kubeclient::Resource, result['secret'][0])
380
+ assert_instance_of(Kubeclient::Resource, result['resource_quota'][0])
381
+ assert_instance_of(Kubeclient::Resource, result['limit_range'][0])
382
+ assert_instance_of(Kubeclient::Resource, result['persistent_volume'][0])
383
+ assert_instance_of(Kubeclient::Resource, result['persistent_volume_claim'][0])
384
+ assert_instance_of(Kubeclient::Resource, result['component_status'][0])
385
+ assert_instance_of(Kubeclient::Resource, result['service_account'][0])
399
386
  end
400
387
 
401
388
  def test_get_all_raw
@@ -457,11 +444,11 @@ class KubeClientTest < MiniTest::Test
457
444
  result = client.all_entities(as: :raw)
458
445
  assert_equal(16, result.keys.size)
459
446
 
460
- %w(
447
+ %w[
461
448
  component_status config_map endpoint event limit_range namespace node
462
449
  persistent_volume persistent_volume_claim pod replication_controller
463
450
  resource_quota secret service service_account
464
- ).each do |entity|
451
+ ].each do |entity|
465
452
  assert_equal(open_test_file("#{entity}_list.json").read, result[entity])
466
453
  end
467
454
  end
@@ -469,17 +456,15 @@ class KubeClientTest < MiniTest::Test
469
456
  def test_api_bearer_token_with_params_success
470
457
  stub_request(:get, 'http://localhost:8080/api/v1/pods?labelSelector=name=redis-master')
471
458
  .with(headers: { Authorization: 'Bearer valid_token' })
472
- .to_return(body: open_test_file('pod_list.json'),
473
- status: 200)
459
+ .to_return(body: open_test_file('pod_list.json'), status: 200)
474
460
  stub_request(:get, %r{/api/v1$})
475
461
  .with(headers: { Authorization: 'Bearer valid_token' })
476
- .to_return(body: open_test_file('core_api_resource_list.json'),
477
- status: 200)
462
+ .to_return(body: open_test_file('core_api_resource_list.json'), status: 200)
478
463
 
479
- client = Kubeclient::Client.new 'http://localhost:8080/api/',
480
- auth_options: {
481
- bearer_token: 'valid_token'
482
- }
464
+ client = Kubeclient::Client.new(
465
+ 'http://localhost:8080/api/',
466
+ auth_options: { bearer_token: 'valid_token' }
467
+ )
483
468
 
484
469
  pods = client.get_pods(label_selector: 'name=redis-master')
485
470
 
@@ -489,17 +474,19 @@ class KubeClientTest < MiniTest::Test
489
474
 
490
475
  def test_api_bearer_token_success
491
476
  stub_request(:get, %r{/api/v1$})
492
- .to_return(body: open_test_file('core_api_resource_list.json'),
493
- status: 200)
477
+ .to_return(
478
+ body: open_test_file('core_api_resource_list.json'), status: 200
479
+ )
494
480
  stub_request(:get, 'http://localhost:8080/api/v1/pods')
495
481
  .with(headers: { Authorization: 'Bearer valid_token' })
496
- .to_return(body: open_test_file('pod_list.json'),
497
- status: 200)
482
+ .to_return(
483
+ body: open_test_file('pod_list.json'), status: 200
484
+ )
498
485
 
499
- client = Kubeclient::Client.new 'http://localhost:8080/api/',
500
- auth_options: {
501
- bearer_token: 'valid_token'
502
- }
486
+ client = Kubeclient::Client.new(
487
+ 'http://localhost:8080/api/',
488
+ auth_options: { bearer_token: 'valid_token' }
489
+ )
503
490
 
504
491
  pods = client.get_pods
505
492
 
@@ -508,20 +495,21 @@ class KubeClientTest < MiniTest::Test
508
495
  end
509
496
 
510
497
  def test_api_bearer_token_failure
511
- error_message = '"/api/v1" is forbidden because ' \
512
- 'system:anonymous cannot list on pods in'
498
+ error_message =
499
+ '"/api/v1" is forbidden because ' \
500
+ 'system:anonymous cannot list on pods in'
513
501
  response = OpenStruct.new(code: 401, message: error_message)
514
502
 
515
503
  stub_request(:get, 'http://localhost:8080/api/v1')
516
504
  .with(headers: { Authorization: 'Bearer invalid_token' })
517
- .to_raise(KubeException.new(403, error_message, response))
505
+ .to_raise(Kubeclient::HttpError.new(403, error_message, response))
518
506
 
519
- client = Kubeclient::Client.new 'http://localhost:8080/api/',
520
- auth_options: {
521
- bearer_token: 'invalid_token'
522
- }
507
+ client = Kubeclient::Client.new(
508
+ 'http://localhost:8080/api/',
509
+ auth_options: { bearer_token: 'invalid_token' }
510
+ )
523
511
 
524
- exception = assert_raises(KubeException) { client.get_pods }
512
+ exception = assert_raises(Kubeclient::HttpError) { client.get_pods }
525
513
  assert_equal(403, exception.error_code)
526
514
  assert_equal(error_message, exception.message)
527
515
  assert_equal(response, exception.response)
@@ -535,195 +523,186 @@ class KubeClientTest < MiniTest::Test
535
523
 
536
524
  stub_request(:get, 'http://localhost:8080/api/v1')
537
525
  .with(headers: { Authorization: 'Bearer invalid_token' })
538
- .to_raise(KubeException.new(403, error_message, response))
526
+ .to_raise(Kubeclient::HttpError.new(403, error_message, response))
539
527
 
540
528
  client = Kubeclient::Client.new(
541
529
  'http://localhost:8080/api/',
542
530
  auth_options: { bearer_token: 'invalid_token' }
543
531
  )
544
532
 
545
- exception = assert_raises(KubeException) { client.get_pods(as: :raw) }
533
+ exception = assert_raises(Kubeclient::HttpError) { client.get_pods(as: :raw) }
546
534
  assert_equal(403, exception.error_code)
547
535
  assert_equal(error_message, exception.message)
548
536
  assert_equal(response, exception.response)
549
537
  end
550
538
 
551
539
  def test_api_basic_auth_success
552
- stub_request(:get, 'http://username:password@localhost:8080/api/v1')
553
- .to_return(body: open_test_file('core_api_resource_list.json'),
554
- status: 200)
555
- stub_request(:get, 'http://username:password@localhost:8080/api/v1/pods')
556
- .to_return(body: open_test_file('pod_list.json'),
557
- status: 200)
558
-
559
- client = Kubeclient::Client.new 'http://localhost:8080/api/',
560
- auth_options: {
561
- username: 'username',
562
- password: 'password'
563
- }
540
+ stub_request(:get, 'http://localhost:8080/api/v1')
541
+ .with(basic_auth: %w[username password])
542
+ .to_return(body: open_test_file('core_api_resource_list.json'), status: 200)
543
+ stub_request(:get, 'http://localhost:8080/api/v1/pods')
544
+ .with(basic_auth: %w[username password])
545
+ .to_return(body: open_test_file('pod_list.json'), status: 200)
546
+
547
+ client = Kubeclient::Client.new(
548
+ 'http://localhost:8080/api/',
549
+ auth_options: { username: 'username', password: 'password' }
550
+ )
564
551
 
565
552
  pods = client.get_pods
566
553
 
567
554
  assert_equal('Pod', pods.kind)
568
555
  assert_equal(1, pods.size)
569
- assert_requested(:get,
570
- 'http://username:password@localhost:8080/api/v1/pods',
571
- times: 1)
556
+ assert_requested(
557
+ :get,
558
+ 'http://localhost:8080/api/v1/pods',
559
+ times: 1
560
+ )
572
561
  end
573
562
 
574
563
  def test_api_basic_auth_back_comp_success
575
- stub_request(:get, 'http://username:password@localhost:8080/api/v1')
576
- .to_return(body: open_test_file('core_api_resource_list.json'),
577
- status: 200)
578
- stub_request(:get, 'http://username:password@localhost:8080/api/v1/pods')
579
- .to_return(body: open_test_file('pod_list.json'),
580
- status: 200)
581
-
582
- client = Kubeclient::Client.new 'http://localhost:8080/api/',
583
- auth_options: {
584
- user: 'username',
585
- password: 'password'
586
- }
564
+ stub_request(:get, 'http://localhost:8080/api/v1')
565
+ .with(basic_auth: %w[username password])
566
+ .to_return(body: open_test_file('core_api_resource_list.json'), status: 200)
567
+ stub_request(:get, 'http://localhost:8080/api/v1/pods')
568
+ .with(basic_auth: %w[username password])
569
+ .to_return(body: open_test_file('pod_list.json'), status: 200)
570
+
571
+ client = Kubeclient::Client.new(
572
+ 'http://localhost:8080/api/',
573
+ auth_options: { user: 'username', password: 'password' }
574
+ )
587
575
 
588
576
  pods = client.get_pods
589
577
 
590
578
  assert_equal('Pod', pods.kind)
591
579
  assert_equal(1, pods.size)
592
- assert_requested(:get,
593
- 'http://username:password@localhost:8080/api/v1/pods',
594
- times: 1)
580
+ assert_requested(:get, 'http://localhost:8080/api/v1/pods', times: 1)
595
581
  end
596
582
 
597
583
  def test_api_basic_auth_failure
598
584
  error_message = 'HTTP status code 401, 401 Unauthorized'
599
585
  response = OpenStruct.new(code: 401, message: '401 Unauthorized')
600
586
 
601
- stub_request(:get, 'http://username:password@localhost:8080/api/v1')
602
- .to_raise(KubeException.new(401, error_message, response))
587
+ stub_request(:get, 'http://localhost:8080/api/v1')
588
+ .with(basic_auth: %w[username password])
589
+ .to_raise(Kubeclient::HttpError.new(401, error_message, response))
603
590
 
604
- client = Kubeclient::Client.new 'http://localhost:8080/api/',
605
- auth_options: {
606
- username: 'username',
607
- password: 'password'
608
- }
591
+ client = Kubeclient::Client.new(
592
+ 'http://localhost:8080/api/',
593
+ auth_options: { username: 'username', password: 'password' }
594
+ )
609
595
 
610
- exception = assert_raises(KubeException) { client.get_pods }
596
+ exception = assert_raises(Kubeclient::HttpError) { client.get_pods }
611
597
  assert_equal(401, exception.error_code)
612
598
  assert_equal(error_message, exception.message)
613
599
  assert_equal(response, exception.response)
614
- assert_requested(:get,
615
- 'http://username:password@localhost:8080/api/v1',
616
- times: 1)
600
+ assert_requested(:get, 'http://localhost:8080/api/v1', times: 1)
617
601
  end
618
602
 
619
603
  def test_api_basic_auth_failure_raw
620
604
  error_message = 'HTTP status code 401, 401 Unauthorized'
621
605
  response = OpenStruct.new(code: 401, message: '401 Unauthorized')
622
606
 
623
- stub_request(:get, 'http://username:password@localhost:8080/api/v1')
624
- .to_raise(KubeException.new(401, error_message, response))
607
+ stub_request(:get, 'http://localhost:8080/api/v1')
608
+ .with(basic_auth: %w[username password])
609
+ .to_raise(Kubeclient::HttpError.new(401, error_message, response))
625
610
 
626
611
  client = Kubeclient::Client.new(
627
612
  'http://localhost:8080/api/',
628
613
  auth_options: { username: 'username', password: 'password' }
629
614
  )
630
615
 
631
- exception = assert_raises(KubeException) { client.get_pods(as: :raw) }
616
+ exception = assert_raises(Kubeclient::HttpError) { client.get_pods(as: :raw) }
632
617
  assert_equal(401, exception.error_code)
633
618
  assert_equal(error_message, exception.message)
634
619
  assert_equal(response, exception.response)
635
620
 
636
- assert_requested(:get,
637
- 'http://username:password@localhost:8080/api/v1',
638
- times: 1)
621
+ assert_requested(:get, 'http://localhost:8080/api/v1', times: 1)
639
622
  end
640
623
 
641
624
  def test_init_username_no_password
642
625
  expected_msg = 'Basic auth requires both username & password'
643
626
  exception = assert_raises(ArgumentError) do
644
- Kubeclient::Client.new 'http://localhost:8080',
645
- auth_options: {
646
- username: 'username'
647
- }
627
+ Kubeclient::Client.new(
628
+ 'http://localhost:8080',
629
+ auth_options: { username: 'username' }
630
+ )
648
631
  end
649
- assert_equal expected_msg, exception.message
632
+ assert_equal(expected_msg, exception.message)
650
633
  end
651
634
 
652
635
  def test_init_user_no_password
653
636
  expected_msg = 'Basic auth requires both username & password'
654
637
  exception = assert_raises(ArgumentError) do
655
- Kubeclient::Client.new 'http://localhost:8080',
656
- auth_options: {
657
- user: 'username'
658
- }
638
+ Kubeclient::Client.new(
639
+ 'http://localhost:8080',
640
+ auth_options: { user: 'username' }
641
+ )
659
642
  end
660
- assert_equal expected_msg, exception.message
643
+ assert_equal(expected_msg, exception.message)
661
644
  end
662
645
 
663
646
  def test_init_username_and_bearer_token
664
647
  expected_msg = 'Invalid auth options: specify only one of username/password,' \
665
- ' bearer_token or bearer_token_file'
648
+ ' bearer_token or bearer_token_file'
666
649
  exception = assert_raises(ArgumentError) do
667
- Kubeclient::Client.new 'http://localhost:8080',
668
- auth_options: {
669
- username: 'username',
670
- bearer_token: 'token'
671
- }
650
+ Kubeclient::Client.new(
651
+ 'http://localhost:8080',
652
+ auth_options: { username: 'username', bearer_token: 'token' }
653
+ )
672
654
  end
673
- assert_equal expected_msg, exception.message
655
+ assert_equal(expected_msg, exception.message)
674
656
  end
675
657
 
676
658
  def test_init_user_and_bearer_token
677
659
  expected_msg = 'Invalid auth options: specify only one of username/password,' \
678
- ' bearer_token or bearer_token_file'
660
+ ' bearer_token or bearer_token_file'
679
661
  exception = assert_raises(ArgumentError) do
680
- Kubeclient::Client.new 'http://localhost:8080',
681
- auth_options: {
682
- username: 'username',
683
- bearer_token: 'token'
684
- }
662
+ Kubeclient::Client.new(
663
+ 'http://localhost:8080',
664
+ auth_options: { username: 'username', bearer_token: 'token' }
665
+ )
685
666
  end
686
- assert_equal expected_msg, exception.message
667
+ assert_equal(expected_msg, exception.message)
687
668
  end
688
669
 
689
670
  def test_bearer_token_and_bearer_token_file
690
- expected_msg = 'Invalid auth options: specify only one of username/password,' \
691
- ' bearer_token or bearer_token_file'
671
+ expected_msg =
672
+ 'Invalid auth options: specify only one of username/password,' \
673
+ ' bearer_token or bearer_token_file'
692
674
  exception = assert_raises(ArgumentError) do
693
- Kubeclient::Client.new 'http://localhost:8080',
694
- auth_options: {
695
- bearer_token: 'token',
696
- bearer_token_file: 'token-file'
697
- }
675
+ Kubeclient::Client.new(
676
+ 'http://localhost:8080',
677
+ auth_options: { bearer_token: 'token', bearer_token_file: 'token-file' }
678
+ )
698
679
  end
699
- assert_equal expected_msg, exception.message
680
+ assert_equal(expected_msg, exception.message)
700
681
  end
701
682
 
702
683
  def test_bearer_token_file_not_exist
703
684
  expected_msg = 'Token file token-file does not exist'
704
685
  exception = assert_raises(ArgumentError) do
705
- Kubeclient::Client.new 'http://localhost:8080',
706
- auth_options: {
707
- bearer_token_file: 'token-file'
708
- }
686
+ Kubeclient::Client.new(
687
+ 'http://localhost:8080',
688
+ auth_options: { bearer_token_file: 'token-file' }
689
+ )
709
690
  end
710
- assert_equal expected_msg, exception.message
691
+ assert_equal(expected_msg, exception.message)
711
692
  end
712
693
 
713
694
  def test_api_bearer_token_file_success
714
695
  stub_request(:get, %r{/api/v1$})
715
- .to_return(body: open_test_file('core_api_resource_list.json'),
716
- status: 200)
696
+ .to_return(body: open_test_file('core_api_resource_list.json'), status: 200)
717
697
  stub_request(:get, 'http://localhost:8080/api/v1/pods')
718
698
  .with(headers: { Authorization: 'Bearer valid_token' })
719
- .to_return(body: open_test_file('pod_list.json'),
720
- status: 200)
699
+ .to_return(body: open_test_file('pod_list.json'), status: 200)
721
700
 
722
701
  file = File.join(File.dirname(__FILE__), 'valid_token_file')
723
- client = Kubeclient::Client.new 'http://localhost:8080/api/',
724
- auth_options: {
725
- bearer_token_file: file
726
- }
702
+ client = Kubeclient::Client.new(
703
+ 'http://localhost:8080/api/',
704
+ auth_options: { bearer_token_file: file }
705
+ )
727
706
 
728
707
  pods = client.get_pods
729
708
 
@@ -733,61 +712,72 @@ class KubeClientTest < MiniTest::Test
733
712
 
734
713
  def test_proxy_url
735
714
  stub_request(:get, %r{/api/v1$})
736
- .to_return(body: open_test_file('core_api_resource_list.json'),
737
- status: 200)
715
+ .to_return(body: open_test_file('core_api_resource_list.json'), status: 200)
738
716
 
739
- client = Kubeclient::Client.new 'http://host:8080', 'v1'
740
- assert_equal('http://host:8080/api/v1/proxy/namespaces/ns/services/srvname:srvportname',
741
- client.proxy_url('service', 'srvname', 'srvportname', 'ns'))
717
+ client = Kubeclient::Client.new('http://host:8080', 'v1')
718
+ assert_equal(
719
+ 'http://host:8080/api/v1/proxy/namespaces/ns/services/srvname:srvportname',
720
+ client.proxy_url('service', 'srvname', 'srvportname', 'ns')
721
+ )
742
722
 
743
- assert_equal('http://host:8080/api/v1/proxy/namespaces/ns/services/srvname:srvportname',
744
- client.proxy_url('services', 'srvname', 'srvportname', 'ns'))
723
+ assert_equal(
724
+ 'http://host:8080/api/v1/proxy/namespaces/ns/services/srvname:srvportname',
725
+ client.proxy_url('services', 'srvname', 'srvportname', 'ns')
726
+ )
745
727
 
746
- assert_equal('http://host:8080/api/v1/namespaces/ns/pods/srvname:srvportname/proxy',
747
- client.proxy_url('pod', 'srvname', 'srvportname', 'ns'))
728
+ assert_equal(
729
+ 'http://host:8080/api/v1/namespaces/ns/pods/srvname:srvportname/proxy',
730
+ client.proxy_url('pod', 'srvname', 'srvportname', 'ns')
731
+ )
748
732
 
749
- assert_equal('http://host:8080/api/v1/namespaces/ns/pods/srvname:srvportname/proxy',
750
- client.proxy_url('pods', 'srvname', 'srvportname', 'ns'))
733
+ assert_equal(
734
+ 'http://host:8080/api/v1/namespaces/ns/pods/srvname:srvportname/proxy',
735
+ client.proxy_url('pods', 'srvname', 'srvportname', 'ns')
736
+ )
751
737
 
752
738
  # Check no namespace provided
753
- assert_equal('http://host:8080/api/v1/proxy/nodes/srvname:srvportname',
754
- client.proxy_url('nodes', 'srvname', 'srvportname'))
739
+ assert_equal(
740
+ 'http://host:8080/api/v1/proxy/nodes/srvname:srvportname',
741
+ client.proxy_url('nodes', 'srvname', 'srvportname')
742
+ )
755
743
 
756
- assert_equal('http://host:8080/api/v1/proxy/nodes/srvname:srvportname',
757
- client.proxy_url('node', 'srvname', 'srvportname'))
744
+ assert_equal(
745
+ 'http://host:8080/api/v1/proxy/nodes/srvname:srvportname',
746
+ client.proxy_url('node', 'srvname', 'srvportname')
747
+ )
758
748
 
759
749
  # Check integer port
760
- assert_equal('http://host:8080/api/v1/proxy/nodes/srvname:5001',
761
- client.proxy_url('nodes', 'srvname', 5001))
750
+ assert_equal(
751
+ 'http://host:8080/api/v1/proxy/nodes/srvname:5001',
752
+ client.proxy_url('nodes', 'srvname', 5001)
753
+ )
762
754
 
763
- assert_equal('http://host:8080/api/v1/proxy/nodes/srvname:5001',
764
- client.proxy_url('node', 'srvname', 5001))
755
+ assert_equal(
756
+ 'http://host:8080/api/v1/proxy/nodes/srvname:5001',
757
+ client.proxy_url('node', 'srvname', 5001)
758
+ )
765
759
  end
766
760
 
767
761
  def test_attr_readers
768
- client = Kubeclient::Client.new 'http://localhost:8080/api/',
769
- ssl_options: {
770
- client_key: 'secret'
771
- },
772
- auth_options: {
773
- bearer_token: 'token'
774
- }
775
- assert_equal '/api', client.api_endpoint.path
776
- assert_equal 'secret', client.ssl_options[:client_key]
777
- assert_equal 'token', client.auth_options[:bearer_token]
778
- assert_equal 'Bearer token', client.headers[:Authorization]
762
+ client = Kubeclient::Client.new(
763
+ 'http://localhost:8080/api/',
764
+ ssl_options: { client_key: 'secret' },
765
+ auth_options: { bearer_token: 'token' }
766
+ )
767
+ assert_equal('/api', client.api_endpoint.path)
768
+ assert_equal('secret', client.ssl_options[:client_key])
769
+ assert_equal('token', client.auth_options[:bearer_token])
770
+ assert_equal('Bearer token', client.headers[:Authorization])
779
771
  end
780
772
 
781
773
  def test_nil_items
782
774
  # handle https://github.com/kubernetes/kubernetes/issues/13096
783
775
  stub_request(:get, %r{/api/v1$})
784
- .to_return(body: open_test_file('core_api_resource_list.json'),
785
- status: 200)
776
+ .to_return(body: open_test_file('core_api_resource_list.json'), status: 200)
786
777
  stub_request(:get, %r{/persistentvolumeclaims})
787
- .to_return(body: open_test_file('persistent_volume_claims_nil_items.json'),
788
- status: 200)
778
+ .to_return(body: open_test_file('persistent_volume_claims_nil_items.json'), status: 200)
789
779
 
790
- client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1'
780
+ client = Kubeclient::Client.new('http://localhost:8080/api/', 'v1')
791
781
  client.get_persistent_volume_claims
792
782
  end
793
783
 
@@ -799,7 +789,7 @@ class KubeClientTest < MiniTest::Test
799
789
  )
800
790
  rest_client = client.rest_client
801
791
  assert_default_open_timeout(rest_client.open_timeout)
802
- assert_equal(60, read_timeout(rest_client))
792
+ assert_equal(60, rest_client.read_timeout)
803
793
  end
804
794
 
805
795
  def test_timeouts_open
@@ -809,7 +799,7 @@ class KubeClientTest < MiniTest::Test
809
799
  )
810
800
  rest_client = client.rest_client
811
801
  assert_equal(10, rest_client.open_timeout)
812
- assert_equal(60, read_timeout(rest_client))
802
+ assert_equal(60, rest_client.read_timeout)
813
803
  end
814
804
 
815
805
  def test_timeouts_read
@@ -819,7 +809,7 @@ class KubeClientTest < MiniTest::Test
819
809
  )
820
810
  rest_client = client.rest_client
821
811
  assert_default_open_timeout(rest_client.open_timeout)
822
- assert_equal(300, read_timeout(rest_client))
812
+ assert_equal(300, rest_client.read_timeout)
823
813
  end
824
814
 
825
815
  def test_timeouts_both
@@ -829,7 +819,7 @@ class KubeClientTest < MiniTest::Test
829
819
  )
830
820
  rest_client = client.rest_client
831
821
  assert_equal(10, rest_client.open_timeout)
832
- assert_equal(300, read_timeout(rest_client))
822
+ assert_equal(300, rest_client.read_timeout)
833
823
  end
834
824
 
835
825
  def test_timeouts_infinite
@@ -839,11 +829,7 @@ class KubeClientTest < MiniTest::Test
839
829
  )
840
830
  rest_client = client.rest_client
841
831
  assert_nil(rest_client.open_timeout)
842
- assert_nil(read_timeout(rest_client))
843
- end
844
-
845
- def read_timeout(rest_client)
846
- rest_client.send(Kubeclient::ClientMixin.restclient_read_timeout_option)
832
+ assert_nil(rest_client.read_timeout)
847
833
  end
848
834
 
849
835
  def assert_default_open_timeout(actual)