kubeclient 0.5.1 → 0.6.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 (42) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +19 -11
  3. data/kubeclient.gemspec +1 -0
  4. data/lib/kubeclient.rb +1 -1
  5. data/lib/kubeclient/common.rb +3 -4
  6. data/lib/kubeclient/version.rb +1 -1
  7. data/test/cassettes/kubernetes_guestbook.yml +846 -0
  8. data/test/json/{created_namespace_b3.json → created_namespace.json} +2 -2
  9. data/test/json/{created_service_b3.json → created_service.json} +3 -3
  10. data/test/json/{empty_pod_list_b3.json → empty_pod_list.json} +2 -2
  11. data/test/json/{endpoint_list_b3.json → endpoint_list.json} +5 -5
  12. data/test/json/{entity_list_b3.json → entity_list.json} +6 -6
  13. data/test/json/{event_list_b3.json → event_list.json} +3 -3
  14. data/test/json/{namespace_b3.json → namespace.json} +2 -2
  15. data/test/json/{namespace_exception_b3.json → namespace_exception.json} +1 -1
  16. data/test/json/{namespace_list_b3.json → namespace_list.json} +4 -4
  17. data/test/json/{node_b3.json → node.json} +2 -2
  18. data/test/json/{node_list_b3.json → node_list.json} +3 -3
  19. data/test/json/persistent_volume_claims_nil_items.json +2 -2
  20. data/test/json/{pod_b3.json → pod.json} +2 -2
  21. data/test/json/{pod_list_b3.json → pod_list.json} +9 -5
  22. data/test/json/{replication_controller_b3.json → replication_controller.json} +2 -2
  23. data/test/json/{replication_controller_list_b3.json → replication_controller_list.json} +6 -4
  24. data/test/json/{secret_list_b3.json → secret_list.json} +4 -4
  25. data/test/json/{service_b3.json → service.json} +3 -3
  26. data/test/json/{service_list_b3.json → service_list.json} +8 -8
  27. data/test/json/{service_update_b3.json → service_update.json} +2 -2
  28. data/test/json/watch_stream.json +3 -0
  29. data/test/test_guestbook_go.rb +233 -0
  30. data/test/test_kubeclient.rb +37 -38
  31. data/test/test_limit_range.rb +1 -1
  32. data/test/test_namespace.rb +12 -12
  33. data/test/test_node.rb +5 -5
  34. data/test/test_persistent_volume.rb +1 -1
  35. data/test/test_persistent_volume_claim.rb +1 -1
  36. data/test/test_pod.rb +4 -4
  37. data/test/test_replication_controller.rb +4 -4
  38. data/test/test_resource_quota.rb +1 -1
  39. data/test/test_service.rb +13 -13
  40. data/test/test_watch.rb +3 -3
  41. metadata +61 -43
  42. data/test/json/watch_stream_b3.json +0 -3
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "status" : {},
3
3
  "kind" : "Service",
4
- "apiVersion" : "v1beta3",
4
+ "apiVersion" : "v1",
5
5
  "spec" : {
6
6
  "ports" : [
7
7
  {
@@ -11,7 +11,7 @@
11
11
  "protocol" : "TCP"
12
12
  }
13
13
  ],
14
- "portalIP" : "1.2.3.4"
14
+ "clusterIP" : "1.2.3.4"
15
15
  },
16
16
  "metadata" : {
17
17
  "name" : "my_service",
@@ -0,0 +1,3 @@
1
+ {"type":"ADDED","object":{"kind":"Pod","apiVersion":"v1","metadata":{"name":"php","namespace":"default","selfLink":"/api/v1/pods/php","uid":"e75f2c07-b047-11e4-89e4-525400c903c1","resourceVersion":"1389","creationTimestamp":"2015-02-09T05:39:19-05:00","labels":{"name":"foo"}},"spec":{"volumes":null,"containers":[{"name":"nginx","image":"dockerfile/nginx","ports":[{"hostPort":9090,"containerPort":80,"protocol":"TCP"}],"resources":{},"livenessProbe":{"httpGet":{"path":"/index.html","port":"9090"},"initialDelaySeconds":30},"terminationMessagePath":"/dev/termination-log","imagePullPolicy":"IfNotPresent","securityContext":{"capabilities":{}}}],"restartPolicy":{"always":{}},"dnsPolicy":"ClusterFirst"},"status":{"phase":"Pending"}}}
2
+ {"type":"MODIFIED","object":{"kind":"Pod","apiVersion":"v1","metadata":{"name":"php","namespace":"default","selfLink":"/api/v1/pods/php","uid":"e75f2c07-b047-11e4-89e4-525400c903c1","resourceVersion":"1390","creationTimestamp":"2015-02-09T05:39:19-05:00","labels":{"name":"foo"}},"spec":{"volumes":null,"containers":[{"name":"nginx","image":"dockerfile/nginx","ports":[{"hostPort":9090,"containerPort":80,"protocol":"TCP"}],"resources":{},"livenessProbe":{"httpGet":{"path":"/index.html","port":"9090"},"initialDelaySeconds":30},"terminationMessagePath":"/dev/termination-log","imagePullPolicy":"IfNotPresent","securityContext":{"capabilities":{}}}],"restartPolicy":{"always":{}},"dnsPolicy":"ClusterFirst"},"status":{"phase":"Pending","host":"127.0.0.1"}}}
3
+ {"type":"DELETED","object":{"kind":"Pod","apiVersion":"v1","metadata":{"name":"php","namespace":"default","selfLink":"/api/v1/pods/php","uid":"e75f2c07-b047-11e4-89e4-525400c903c1","resourceVersion":"1398","creationTimestamp":"2015-02-09T05:39:19-05:00","labels":{"name":"foo"}},"spec":{"volumes":null,"containers":[{"name":"nginx","image":"dockerfile/nginx","ports":[{"hostPort":9090,"containerPort":80,"protocol":"TCP"}],"resources":{},"livenessProbe":{"httpGet":{"path":"/index.html","port":"9090"},"initialDelaySeconds":30},"terminationMessagePath":"/dev/termination-log","imagePullPolicy":"IfNotPresent","securityContext":{"capabilities":{}}}],"restartPolicy":{"always":{}},"dnsPolicy":"ClusterFirst"},"status":{"phase":"Pending","host":"127.0.0.1"}}}
@@ -0,0 +1,233 @@
1
+ require 'test_helper'
2
+ require 'vcr'
3
+
4
+ # creation of google's example of guest book
5
+ class CreateGuestbookGo < MiniTest::Test
6
+ def test_create_guestbook_entities
7
+ VCR.configure do |c|
8
+ c.cassette_library_dir = 'test/cassettes'
9
+ c.hook_into :webmock
10
+ end
11
+
12
+ # WebMock.allow_net_connect!
13
+ VCR.use_cassette('kubernetes_guestbook') do # , record: :new_episodes) do
14
+ client = Kubeclient::Client.new 'http://10.35.0.23:8080/api/', 'v1'
15
+
16
+ testing_ns = Kubeclient::Namespace.new
17
+ testing_ns.metadata = {}
18
+ testing_ns.metadata.name = 'kubeclient-ns'
19
+
20
+ # delete in case they existed before so creation can be tested
21
+ delete_namespace(client, testing_ns.metadata.name)
22
+ delete_services(client, testing_ns.metadata.name,
23
+ ['guestbook', 'redis-master', 'redis-slave'])
24
+ delete_replication_controllers(client, testing_ns.metadata.name,
25
+ ['guestbook', 'redis-master', 'redis-slave'])
26
+
27
+ client.create_namespace testing_ns
28
+ services = create_services(client, testing_ns.metadata.name)
29
+ replicators = create_replication_controllers(client, testing_ns.metadata.name)
30
+
31
+ get_namespaces(client)
32
+ get_services(client, testing_ns.metadata.name)
33
+ get_replication_controllers(client, testing_ns.metadata.name)
34
+
35
+ delete_services(client, testing_ns.metadata.name, services)
36
+ delete_replication_controllers(client, testing_ns.metadata.name, replicators)
37
+
38
+ client.delete_namespace testing_ns.metadata.name
39
+ end
40
+ end
41
+
42
+ def delete_namespace(client, namespace_name)
43
+ client.delete_namespace namespace_name
44
+ rescue KubeException => exception
45
+ assert_instance_of(KubeException, exception)
46
+ assert_equal(404, exception.error_code)
47
+ end
48
+
49
+ def get_namespaces(client)
50
+ namespaces = client.get_namespaces
51
+ assert(true, namespaces.size > 2)
52
+ end
53
+
54
+ def get_services(client, ns)
55
+ retrieved_services = client.get_services(namespace: ns)
56
+ assert_equal(3, retrieved_services.size)
57
+ end
58
+
59
+ def get_replication_controllers(client, ns)
60
+ retrieved_replicators = client.get_replication_controllers(namespace: ns)
61
+ assert_equal(3, retrieved_replicators.size)
62
+ end
63
+
64
+ def create_services(client, ns)
65
+ guestbook_service = client.create_service guestbook_service(ns)
66
+ redis_service = client.create_service redis_service(ns)
67
+ redis_slave_service = client.create_service redis_slave_service(ns)
68
+ [guestbook_service, redis_service, redis_slave_service]
69
+ end
70
+
71
+ def create_replication_controllers(client, namespace)
72
+ rc = client.create_replication_controller guestbook_rc(namespace)
73
+ rc2 = client.create_replication_controller redis_master_rc(namespace)
74
+ rc3 = client.create_replication_controller redis_slave_rc(namespace)
75
+ [rc, rc2, rc3]
76
+ end
77
+
78
+ def delete_services(client, namespace, services)
79
+ # if the entity is not found, no need to fail the test
80
+ services.each do |service|
81
+ begin
82
+ if service.instance_of?(Kubeclient::Service)
83
+ client.delete_service service.metadata.name, namespace
84
+ else
85
+ # it's just a string - service name
86
+ client.delete_service service, namespace
87
+ end
88
+ rescue KubeException => exception
89
+ assert_instance_of(KubeException, exception)
90
+ assert_equal(404, exception.error_code)
91
+ end
92
+ end
93
+ end
94
+
95
+ def delete_replication_controllers(client, namespace, replication_controllers)
96
+ # if the entity is not found, no need to fail the test
97
+ replication_controllers.each do |rc|
98
+ begin
99
+ if rc.instance_of?(Kubeclient::ReplicationController)
100
+ client.delete_replication_controller rc.metadata.name, namespace
101
+ else
102
+ # it's just a string - rc name
103
+ client.delete_replication_controller rc, namespace
104
+ end
105
+ rescue KubeException => exception
106
+ assert_instance_of(KubeException, exception)
107
+ assert_equal(404, exception.error_code)
108
+ end
109
+ end
110
+ end
111
+
112
+ private
113
+
114
+ def construct_base_rc(namespace)
115
+ rc = Kubeclient::ReplicationController.new
116
+ rc.metadata = {}
117
+ rc.metadata.namespace = namespace
118
+ rc.metadata.labels = {}
119
+ rc.spec = {}
120
+ rc.spec.selector = {}
121
+ rc.spec.template = {}
122
+ rc.spec.template.metadata = {}
123
+ rc.spec.template.spec = {}
124
+ rc.spec.template.metadata.labels = {}
125
+ rc
126
+ end
127
+
128
+ def redis_master_rc(namespace)
129
+ rc = construct_base_rc(namespace)
130
+ rc.metadata.name = 'redis-master'
131
+ rc.metadata.labels.app = 'redis'
132
+ rc.metadata.labels.role = 'master'
133
+ rc.spec.replicas = 1
134
+ rc.spec.selector.app = 'redis'
135
+ rc.spec.selector.role = 'master'
136
+ rc.spec.template.metadata.labels.app = 'redis'
137
+ rc.spec.template.metadata.labels.role = 'master'
138
+ rc.spec.template.spec.containers = [{ 'name' => 'redis-master',
139
+ 'image' => 'redis',
140
+ 'ports' => [{ 'name' => 'redis-server',
141
+ 'containerPort' => 6379 }] }]
142
+ rc
143
+ end
144
+
145
+ def redis_slave_rc(namespace)
146
+ rc = construct_base_rc(namespace)
147
+ rc.metadata.name = 'redis-slave'
148
+ rc.metadata.labels.app = 'redis'
149
+ rc.metadata.labels.role = 'slave'
150
+ rc.spec.replicas = 2
151
+ rc.spec.selector.app = 'redis'
152
+ rc.spec.selector.role = 'slave'
153
+ rc.spec.template.metadata.labels.app = 'redis'
154
+ rc.spec.template.metadata.labels.role = 'slave'
155
+ rc.spec.template.spec.containers = [{ 'name' => 'redis-slave',
156
+ 'image' => 'kubernetes/redis-slave:v2',
157
+ 'ports' => [{ 'name' => 'redis-server',
158
+ 'containerPort' => 6379 }
159
+ ] }]
160
+ rc
161
+ end
162
+
163
+ def guestbook_rc(namespace)
164
+ rc = construct_base_rc(namespace)
165
+ rc.metadata.name = 'guestbook'
166
+ rc.metadata.labels.app = 'guestbook'
167
+ rc.metadata.labels.role = 'slave'
168
+ rc.spec.replicas = 3
169
+ rc.spec.selector.app = 'guestbook'
170
+ rc.spec.template.metadata.labels.app = 'guestbook'
171
+ rc.spec.template.spec.containers = [{ 'name' => 'guestbook',
172
+ 'image' => 'kubernetes/guestbook:v2',
173
+ 'ports' => [{ 'name' => 'http-server',
174
+ 'containerPort' => 3000 }]
175
+ }]
176
+
177
+ rc
178
+ end
179
+
180
+ def base_service(namespace)
181
+ our_service = Kubeclient::Service.new
182
+ our_service.metadata = {}
183
+ our_service.metadata.namespace = namespace
184
+ our_service.metadata.labels = {}
185
+ our_service.spec = {}
186
+ our_service.spec.selector = {}
187
+ our_service
188
+ end
189
+
190
+ def redis_slave_service(namespace)
191
+ our_service = base_service(namespace)
192
+ our_service.metadata.name = 'redis-slave'
193
+ our_service.metadata.labels.app = 'redis'
194
+ our_service.metadata.labels.role = 'slave'
195
+
196
+ our_service.spec.ports = [{ 'port' => 6379,
197
+ 'targetPort' => 'redis-server'
198
+ }]
199
+
200
+ our_service.spec.selector.app = 'redis'
201
+ our_service.spec.selector.role = 'slave'
202
+ our_service
203
+ end
204
+
205
+ def redis_service(namespace)
206
+ our_service = base_service(namespace)
207
+ our_service.metadata.name = 'redis-master'
208
+ our_service.metadata.labels.app = 'redis'
209
+ our_service.metadata.labels.role = 'master'
210
+
211
+ our_service.spec.ports = [{ 'port' => 6379,
212
+ 'targetPort' => 'redis-server'
213
+ }]
214
+
215
+ our_service.spec.selector.app = 'redis'
216
+ our_service.spec.selector.role = 'master'
217
+ our_service
218
+ end
219
+
220
+ def guestbook_service(namespace)
221
+ our_service = base_service(namespace)
222
+ our_service.metadata.name = 'guestbook'
223
+ our_service.metadata.labels.name = 'guestbook'
224
+
225
+ our_service.spec.ports = [{ 'port' => 3000,
226
+ 'targetPort' => 'http-server'
227
+ }]
228
+
229
+ our_service.spec.selector.app = 'guestbook'
230
+ our_service.type = 'LoadBalancer'
231
+ our_service
232
+ end
233
+ end
@@ -27,24 +27,24 @@ class KubeClientTest < MiniTest::Test
27
27
  uri.hostname = 'localhost'
28
28
  client = Kubeclient::Client.new uri
29
29
  rest_client = client.rest_client
30
- assert_equal 'http://localhost:8080/api/v1beta3', rest_client.url.to_s
30
+ assert_equal 'http://localhost:8080/api/v1', rest_client.url.to_s
31
31
  end
32
32
 
33
33
  def test_no_path_in_uri
34
- client = Kubeclient::Client.new 'http://localhost:8080', 'v1beta3'
34
+ client = Kubeclient::Client.new 'http://localhost:8080', 'v1'
35
35
  rest_client = client.rest_client
36
- assert_equal 'http://localhost:8080/api/v1beta3', rest_client.url.to_s
36
+ assert_equal 'http://localhost:8080/api/v1', rest_client.url.to_s
37
37
  end
38
38
 
39
39
  def test_no_version_passed
40
40
  client = Kubeclient::Client.new 'http://localhost:8080'
41
41
  rest_client = client.rest_client
42
- assert_equal 'http://localhost:8080/api/v1beta3', rest_client.url.to_s
42
+ assert_equal 'http://localhost:8080/api/v1', rest_client.url.to_s
43
43
  end
44
44
 
45
45
  def test_exception
46
46
  stub_request(:post, %r{/services})
47
- .to_return(body: open_test_json_file('namespace_exception_b3.json'),
47
+ .to_return(body: open_test_json_file('namespace_exception.json'),
48
48
  status: 409)
49
49
 
50
50
  service = Kubeclient::Service.new
@@ -71,7 +71,7 @@ class KubeClientTest < MiniTest::Test
71
71
  stub_request(:get, 'http://localhost:8080/api')
72
72
  .to_return(status: 200, body: open_test_json_file('versions_list.json'))
73
73
 
74
- client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta3'
74
+ client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1'
75
75
  response = client.api
76
76
  assert_includes(response, 'versions')
77
77
  end
@@ -145,7 +145,7 @@ class KubeClientTest < MiniTest::Test
145
145
  .to_return(body: open_test_json_file('service_illegal_json_404.json'),
146
146
  status: 404)
147
147
 
148
- client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta3'
148
+ client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1'
149
149
 
150
150
  exception = assert_raises(KubeException) do
151
151
  client.get_services
@@ -158,10 +158,10 @@ class KubeClientTest < MiniTest::Test
158
158
 
159
159
  def test_entity_list
160
160
  stub_request(:get, %r{/services})
161
- .to_return(body: open_test_json_file('entity_list_b3.json'),
161
+ .to_return(body: open_test_json_file('entity_list.json'),
162
162
  status: 200)
163
163
 
164
- client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta3'
164
+ client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1'
165
165
  services = client.get_services
166
166
 
167
167
  refute_empty(services)
@@ -172,16 +172,16 @@ class KubeClientTest < MiniTest::Test
172
172
  assert_instance_of(Kubeclient::Service, services[1])
173
173
 
174
174
  assert_requested(:get,
175
- 'http://localhost:8080/api/v1beta3/services',
175
+ 'http://localhost:8080/api/v1/services',
176
176
  times: 1)
177
177
  end
178
178
 
179
179
  def test_empty_list
180
180
  stub_request(:get, %r{/pods})
181
- .to_return(body: open_test_json_file('empty_pod_list_b3.json'),
181
+ .to_return(body: open_test_json_file('empty_pod_list.json'),
182
182
  status: 200)
183
183
 
184
- client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta3'
184
+ client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1'
185
185
  pods = client.get_pods
186
186
  assert_instance_of(Kubeclient::Common::EntityList, pods)
187
187
  assert_equal(0, pods.size)
@@ -189,34 +189,33 @@ class KubeClientTest < MiniTest::Test
189
189
 
190
190
  def test_get_all
191
191
  stub_request(:get, %r{/services})
192
- .to_return(body: open_test_json_file('service_list_b3.json'),
192
+ .to_return(body: open_test_json_file('service_list.json'),
193
193
  status: 200)
194
194
 
195
195
  stub_request(:get, %r{/pods})
196
- .to_return(body: open_test_json_file('pod_list_b3.json'),
196
+ .to_return(body: open_test_json_file('pod_list.json'),
197
197
  status: 200)
198
198
 
199
199
  stub_request(:get, %r{/nodes})
200
- .to_return(body: open_test_json_file('node_list_b3.json'),
200
+ .to_return(body: open_test_json_file('node_list.json'),
201
201
  status: 200)
202
202
 
203
203
  stub_request(:get, %r{/replicationcontrollers})
204
- .to_return(body: open_test_json_file('replication_controller_list_' \
205
- 'b3.json'), status: 200)
204
+ .to_return(body: open_test_json_file('replication_controller_list.json'), status: 200)
206
205
 
207
206
  stub_request(:get, %r{/events})
208
- .to_return(body: open_test_json_file('event_list_b3.json'), status: 200)
207
+ .to_return(body: open_test_json_file('event_list.json'), status: 200)
209
208
 
210
209
  stub_request(:get, %r{/endpoints})
211
- .to_return(body: open_test_json_file('endpoint_list_b3.json'),
210
+ .to_return(body: open_test_json_file('endpoint_list.json'),
212
211
  status: 200)
213
212
 
214
213
  stub_request(:get, %r{/namespaces})
215
- .to_return(body: open_test_json_file('namespace_list_b3.json'),
214
+ .to_return(body: open_test_json_file('namespace_list.json'),
216
215
  status: 200)
217
216
 
218
217
  stub_request(:get, %r{/secrets})
219
- .to_return(body: open_test_json_file('secret_list_b3.json'),
218
+ .to_return(body: open_test_json_file('secret_list.json'),
220
219
  status: 200)
221
220
 
222
221
  stub_request(:get, %r{/resourcequotas})
@@ -235,7 +234,7 @@ class KubeClientTest < MiniTest::Test
235
234
  .to_return(body: open_test_json_file('persistent_volume_claim_list.json'),
236
235
  status: 200)
237
236
 
238
- client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta3'
237
+ client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1'
239
238
  result = client.all_entities
240
239
  assert_equal(12, result.keys.size)
241
240
  assert_instance_of(Kubeclient::Common::EntityList, result['node'])
@@ -259,9 +258,9 @@ class KubeClientTest < MiniTest::Test
259
258
  end
260
259
 
261
260
  def test_api_bearer_token_with_params_success
262
- stub_request(:get, 'http://localhost:8080/api/v1beta3/pods?labelSelector=name=redis-master')
261
+ stub_request(:get, 'http://localhost:8080/api/v1/pods?labelSelector=name=redis-master')
263
262
  .with(headers: { Authorization: 'Bearer valid_token' })
264
- .to_return(body: open_test_json_file('pod_list_b3.json'),
263
+ .to_return(body: open_test_json_file('pod_list.json'),
265
264
  status: 200)
266
265
 
267
266
  client = Kubeclient::Client.new 'http://localhost:8080/api/',
@@ -276,9 +275,9 @@ class KubeClientTest < MiniTest::Test
276
275
  end
277
276
 
278
277
  def test_api_bearer_token_success
279
- stub_request(:get, 'http://localhost:8080/api/v1beta3/pods')
278
+ stub_request(:get, 'http://localhost:8080/api/v1/pods')
280
279
  .with(headers: { Authorization: 'Bearer valid_token' })
281
- .to_return(body: open_test_json_file('pod_list_b3.json'),
280
+ .to_return(body: open_test_json_file('pod_list.json'),
282
281
  status: 200)
283
282
 
284
283
  client = Kubeclient::Client.new 'http://localhost:8080/api/',
@@ -293,10 +292,10 @@ class KubeClientTest < MiniTest::Test
293
292
  end
294
293
 
295
294
  def test_api_bearer_token_failure
296
- error_message = '"/api/v1beta3/pods" is forbidden because ' \
295
+ error_message = '"/api/v1/pods" is forbidden because ' \
297
296
  'system:anonymous cannot list on pods in'
298
297
 
299
- stub_request(:get, 'http://localhost:8080/api/v1beta3/pods')
298
+ stub_request(:get, 'http://localhost:8080/api/v1/pods')
300
299
  .with(headers: { Authorization: 'Bearer invalid_token' })
301
300
  .to_raise(KubeException.new(403, error_message))
302
301
 
@@ -311,8 +310,8 @@ class KubeClientTest < MiniTest::Test
311
310
  end
312
311
 
313
312
  def test_api_basic_auth_success
314
- stub_request(:get, 'http://username:password@localhost:8080/api/v1beta3/pods')
315
- .to_return(body: open_test_json_file('pod_list_b3.json'),
313
+ stub_request(:get, 'http://username:password@localhost:8080/api/v1/pods')
314
+ .to_return(body: open_test_json_file('pod_list.json'),
316
315
  status: 200)
317
316
 
318
317
  client = Kubeclient::Client.new 'http://localhost:8080/api/',
@@ -326,13 +325,13 @@ class KubeClientTest < MiniTest::Test
326
325
  assert_equal('Pod', pods.kind)
327
326
  assert_equal(1, pods.size)
328
327
  assert_requested(:get,
329
- 'http://username:password@localhost:8080/api/v1beta3/pods',
328
+ 'http://username:password@localhost:8080/api/v1/pods',
330
329
  times: 1)
331
330
  end
332
331
 
333
332
  def test_api_basic_auth_back_comp_success
334
- stub_request(:get, 'http://username:password@localhost:8080/api/v1beta3/pods')
335
- .to_return(body: open_test_json_file('pod_list_b3.json'),
333
+ stub_request(:get, 'http://username:password@localhost:8080/api/v1/pods')
334
+ .to_return(body: open_test_json_file('pod_list.json'),
336
335
  status: 200)
337
336
 
338
337
  client = Kubeclient::Client.new 'http://localhost:8080/api/',
@@ -346,14 +345,14 @@ class KubeClientTest < MiniTest::Test
346
345
  assert_equal('Pod', pods.kind)
347
346
  assert_equal(1, pods.size)
348
347
  assert_requested(:get,
349
- 'http://username:password@localhost:8080/api/v1beta3/pods',
348
+ 'http://username:password@localhost:8080/api/v1/pods',
350
349
  times: 1)
351
350
  end
352
351
 
353
352
  def test_api_basic_auth_failure
354
353
  error_message = 'HTTP status code 401, 401 Unauthorized'
355
354
 
356
- stub_request(:get, 'http://username:password@localhost:8080/api/v1beta3/pods')
355
+ stub_request(:get, 'http://username:password@localhost:8080/api/v1/pods')
357
356
  .to_raise(KubeException.new(401, error_message))
358
357
 
359
358
  client = Kubeclient::Client.new 'http://localhost:8080/api/',
@@ -366,7 +365,7 @@ class KubeClientTest < MiniTest::Test
366
365
  assert_equal(401, exception.error_code)
367
366
  assert_equal(error_message, exception.message)
368
367
  assert_requested(:get,
369
- 'http://username:password@localhost:8080/api/v1beta3/pods',
368
+ 'http://username:password@localhost:8080/api/v1/pods',
370
369
  times: 1)
371
370
  end
372
371
 
@@ -443,9 +442,9 @@ class KubeClientTest < MiniTest::Test
443
442
  end
444
443
 
445
444
  def test_api_bearer_token_file_success
446
- stub_request(:get, 'http://localhost:8080/api/v1beta3/pods')
445
+ stub_request(:get, 'http://localhost:8080/api/v1/pods')
447
446
  .with(headers: { Authorization: 'Bearer valid_token' })
448
- .to_return(body: open_test_json_file('pod_list_b3.json'),
447
+ .to_return(body: open_test_json_file('pod_list.json'),
449
448
  status: 200)
450
449
 
451
450
  file = File.join(File.dirname(__FILE__), 'valid_token_file')