kubeclient 0.1.7 → 0.1.8

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.

data/test/test_node.rb CHANGED
@@ -2,26 +2,6 @@ require 'test_helper'
2
2
 
3
3
  # Node entity tests
4
4
  class TestNode < MiniTest::Test
5
- def test_get_from_json_v1
6
- stub_request(:get, /\/nodes/)
7
- .to_return(body: open_test_json_file('node_b1.json'),
8
- status: 200)
9
-
10
- client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta1'
11
- node = client.get_node('127.0.0.1')
12
-
13
- assert_instance_of(Node, node)
14
- assert_respond_to(node, 'creationTimestamp')
15
- assert_respond_to(node, 'uid')
16
- assert_respond_to(node, 'id')
17
- assert_respond_to(node, 'resources')
18
- assert_respond_to(node, 'resourceVersion')
19
- assert_respond_to(node, 'apiVersion')
20
-
21
- assert_equal(7, node.resourceVersion)
22
- assert_equal(1000, node.resources.capacity.cpu)
23
- end
24
-
25
5
  def test_get_from_json_v3
26
6
  stub_request(:get, /\/nodes/)
27
7
  .to_return(body: open_test_json_file('node_b3.json'),
@@ -30,12 +10,12 @@ class TestNode < MiniTest::Test
30
10
  client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta3'
31
11
  node = client.get_node('127.0.0.1')
32
12
 
33
- assert_instance_of(Node, node)
13
+ assert_instance_of(Kubeclient::Node, node)
34
14
 
35
- assert_equal('01018013-a231-11e4-a36b-3c970e4a436a', node.metadata.uid)
15
+ assert_equal('041143c5-ce39-11e4-ac24-3c970e4a436a', node.metadata.uid)
36
16
  assert_equal('127.0.0.1', node.metadata.name)
37
- assert_equal('7', node.metadata.resourceVersion)
17
+ assert_equal('1724', node.metadata.resourceVersion)
38
18
  assert_equal('v1beta3', node.apiVersion)
39
- assert_equal('2015-01-22T14:20:08+02:00', node.metadata.creationTimestamp)
19
+ assert_equal('2015-03-19T15:08:20+02:00', node.metadata.creationTimestamp)
40
20
  end
41
21
  end
data/test/test_pod.rb CHANGED
@@ -2,20 +2,6 @@ require 'test_helper'
2
2
 
3
3
  # Pod entity tests
4
4
  class TestPod < MiniTest::Test
5
- def test_get_from_json_v1
6
- stub_request(:get, /\/pods/)
7
- .to_return(body: open_test_json_file('pod_b1.json'),
8
- status: 200)
9
-
10
- client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta1'
11
- pod = client.get_pod 'redis-master-pod'
12
-
13
- assert_instance_of(Pod, pod)
14
- assert_equal('redis-master-pod', pod.id)
15
- assert_equal('redis-master',
16
- pod.desiredState.manifest.containers[0]['name'])
17
- end
18
-
19
5
  def test_get_from_json_v3
20
6
  stub_request(:get, /\/pods/)
21
7
  .to_return(body: open_test_json_file('pod_b3.json'),
@@ -24,7 +10,7 @@ class TestPod < MiniTest::Test
24
10
  client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta3'
25
11
  pod = client.get_pod 'redis-master-pod'
26
12
 
27
- assert_instance_of(Pod, pod)
13
+ assert_instance_of(Kubeclient::Pod, pod)
28
14
  assert_equal('redis-master3', pod.metadata.name)
29
15
  assert_equal('dockerfile/redis', pod.spec.containers[0]['image'])
30
16
  end
@@ -2,28 +2,6 @@ require 'test_helper'
2
2
 
3
3
  # Replication Controller entity tests
4
4
  class TestReplicationController < MiniTest::Test
5
- def test_get_from_json_v1
6
- stub_request(:get, /\/replicationControllers/)
7
- .to_return(body: open_test_json_file('replication_controller_b1.json'),
8
- status: 200)
9
-
10
- client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta1'
11
- rc = client.get_replication_controller 'frontendController'
12
-
13
- assert_instance_of(ReplicationController, rc)
14
- assert_equal('frontendController', rc.id)
15
- assert_equal('f4e5966c-8eb2-11e4-a6e7-3c970e4a436a', rc.uid)
16
- assert_equal('default', rc.namespace)
17
- assert_equal(3, rc.desiredState.replicas)
18
- assert_equal('frontend', rc.desiredState.replicaSelector.name)
19
- # the access to containers is not as nice as rest of the properties,
20
- # but it's about to change in beta v3, hence it can significantly
21
- # impact the design of the client. to be revisited after beta v3 api
22
- # is released.
23
- assert_equal('php-redis', rc.desiredState.podTemplate
24
- .desiredState.manifest.containers[0]['name'])
25
- end
26
-
27
5
  def test_get_from_json_v3
28
6
  stub_request(:get, /\/replicationcontrollers/)
29
7
  .to_return(body: open_test_json_file('replication_controller_b3.json'),
@@ -32,7 +10,7 @@ class TestReplicationController < MiniTest::Test
32
10
  client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta3'
33
11
  rc = client.get_replication_controller 'frontendController'
34
12
 
35
- assert_instance_of(ReplicationController, rc)
13
+ assert_instance_of(Kubeclient::ReplicationController, rc)
36
14
  assert_equal('guestbook-controller', rc.metadata.name)
37
15
  assert_equal('c71aa4c0-a240-11e4-a265-3c970e4a436a', rc.metadata.uid)
38
16
  assert_equal('default', rc.metadata.namespace)
data/test/test_service.rb CHANGED
@@ -2,33 +2,8 @@ require 'test_helper'
2
2
 
3
3
  # Service entity tests
4
4
  class TestService < MiniTest::Test
5
- def test_get_from_json_v1
6
- mock = Service.new(
7
- 'kind' => 'Service',
8
- 'id' => 'redis-service',
9
- 'uid' => 'fb01a69c-8ae2-11e4-acc5-3c970e4a436a',
10
- 'namespace' => 'default',
11
- 'port' => 80,
12
- 'protocol' => 'TCP',
13
- 'labels' => {
14
- 'component' => 'apiserver',
15
- 'provider' => 'kubernetes'
16
- },
17
- 'selector' => nil,
18
- 'creation_timestamp' => '2014-12-23T22:33:40+02:00',
19
- 'self_link' => '/api/v1beta1/services/kubernetes-ro?namespace=default',
20
- 'resource_version' => 4,
21
- 'api_version' => 'v1beta1',
22
- 'container_port' => 0,
23
- 'portal_ip' => '10.0.0.54'
24
- )
25
-
26
- assert_equal 'redis-service', mock.id
27
- assert_equal 'apiserver', mock.labels.component
28
- end
29
-
30
5
  def test_construct_our_own_service
31
- our_service = Service.new
6
+ our_service = Kubeclient::Service.new
32
7
  our_service.id = 'redis-service'
33
8
  our_service.port = 80
34
9
  our_service.protocol = 'TCP'
@@ -44,28 +19,6 @@ class TestService < MiniTest::Test
44
19
  assert_equal our_service.labels.provider, hash[:labels][:provider]
45
20
  end
46
21
 
47
- def test_conversion_from_json_v1
48
- stub_request(:get, /\/services/)
49
- .to_return(body: open_test_json_file('service_b1.json'),
50
- status: 200)
51
-
52
- client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta1'
53
- service = client.get_service 'redisslave'
54
-
55
- assert_instance_of(Service, service)
56
- # checking that creationTimestamp was renamed properly
57
- assert_equal('2014-12-28T17:37:21+02:00', service.creationTimestamp)
58
- assert_equal('6a022e83-8ea7-11e4-a6e7-3c970e4a436a', service.uid)
59
- assert_equal('redisslave', service.id)
60
- assert_equal(8, service.resourceVersion)
61
- assert_equal('v1beta1', service.apiVersion)
62
- assert_equal('10.0.0.248', service.portalIP)
63
- assert_equal(6379, service.containerPort)
64
- assert_equal('TCP', service.protocol)
65
- assert_equal(10_001, service.port)
66
- assert_equal('default', service.namespace)
67
- end
68
-
69
22
  def test_conversion_from_json_v3
70
23
  stub_request(:get, /\/services/)
71
24
  .to_return(body: open_test_json_file('service_b3.json'),
@@ -74,7 +27,7 @@ class TestService < MiniTest::Test
74
27
  client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta3'
75
28
  service = client.get_service 'redisslave'
76
29
 
77
- assert_instance_of(Service, service)
30
+ assert_instance_of(Kubeclient::Service, service)
78
31
  # checking that creationTimestamp was renamed properly
79
32
  assert_equal('2015-01-22T14:20:05+02:00',
80
33
  service.metadata.creationTimestamp)
@@ -90,7 +43,7 @@ class TestService < MiniTest::Test
90
43
  end
91
44
 
92
45
  def test_delete_service
93
- our_service = Service.new
46
+ our_service = Kubeclient::Service.new
94
47
  our_service.id = 'redis-service'
95
48
  our_service.port = 80
96
49
  our_service.protocol = 'TCP'
@@ -101,7 +54,7 @@ class TestService < MiniTest::Test
101
54
  stub_request(:delete, /\/services/)
102
55
  .to_return(status: 200)
103
56
 
104
- client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta1'
57
+ client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta3'
105
58
  client.delete_service our_service.id
106
59
  end
107
60
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kubeclient
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alissa Bonas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-10 00:00:00.000000000 Z
11
+ date: 2015-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -159,23 +159,21 @@ files:
159
159
  - lib/kubeclient/watch_stream.rb
160
160
  - test/json/empty_pod_list_b3.json
161
161
  - test/json/endpoint_list_b3.json
162
- - test/json/entity_list_b1.json
162
+ - test/json/entity_list_b3.json
163
163
  - test/json/event_list_b3.json
164
- - test/json/get_all_nodes_b1.json
165
- - test/json/get_all_pods_b1.json
166
- - test/json/get_all_replication_b1.json
167
- - test/json/get_all_services_b1.json
164
+ - test/json/get_all_services_b3.json
168
165
  - test/json/namespace_b3.json
166
+ - test/json/namespace_exception_b3.json
169
167
  - test/json/namespace_list_b3.json
170
- - test/json/node_b1.json
171
168
  - test/json/node_b3.json
172
- - test/json/pod_b1.json
169
+ - test/json/node_list_b3.json
173
170
  - test/json/pod_b3.json
174
- - test/json/replication_controller_b1.json
171
+ - test/json/pod_list_b3.json
175
172
  - test/json/replication_controller_b3.json
176
- - test/json/service_b1.json
173
+ - test/json/replication_controller_list_b3.json
177
174
  - test/json/service_b3.json
178
- - test/json/service_exception_b1.json
175
+ - test/json/service_illegal_json_404.json
176
+ - test/json/versions_list.json
179
177
  - test/json/watch_stream_b3.json
180
178
  - test/test_helper.rb
181
179
  - test/test_kubeclient.rb
@@ -212,23 +210,21 @@ summary: A client for Kubernetes REST api
212
210
  test_files:
213
211
  - test/json/empty_pod_list_b3.json
214
212
  - test/json/endpoint_list_b3.json
215
- - test/json/entity_list_b1.json
213
+ - test/json/entity_list_b3.json
216
214
  - test/json/event_list_b3.json
217
- - test/json/get_all_nodes_b1.json
218
- - test/json/get_all_pods_b1.json
219
- - test/json/get_all_replication_b1.json
220
- - test/json/get_all_services_b1.json
215
+ - test/json/get_all_services_b3.json
221
216
  - test/json/namespace_b3.json
217
+ - test/json/namespace_exception_b3.json
222
218
  - test/json/namespace_list_b3.json
223
- - test/json/node_b1.json
224
219
  - test/json/node_b3.json
225
- - test/json/pod_b1.json
220
+ - test/json/node_list_b3.json
226
221
  - test/json/pod_b3.json
227
- - test/json/replication_controller_b1.json
222
+ - test/json/pod_list_b3.json
228
223
  - test/json/replication_controller_b3.json
229
- - test/json/service_b1.json
224
+ - test/json/replication_controller_list_b3.json
230
225
  - test/json/service_b3.json
231
- - test/json/service_exception_b1.json
226
+ - test/json/service_illegal_json_404.json
227
+ - test/json/versions_list.json
232
228
  - test/json/watch_stream_b3.json
233
229
  - test/test_helper.rb
234
230
  - test/test_kubeclient.rb
@@ -1,43 +0,0 @@
1
- {
2
- "kind": "ServiceList",
3
- "creationTimestamp": null,
4
- "selfLink": "/api/v1beta1/services",
5
- "resourceVersion": 8,
6
- "apiVersion": "v1beta1",
7
- "items": [
8
- {
9
- "id": "kubernetes",
10
- "uid": "be10c0ba-8f4e-11e4-814c-3c970e4a436a",
11
- "creationTimestamp": "2014-12-29T13:35:08+02:00",
12
- "selfLink": "/api/v1beta1/services/kubernetes?namespace=default",
13
- "resourceVersion": 4,
14
- "namespace": "default",
15
- "port": 443,
16
- "protocol": "TCP",
17
- "labels": {
18
- "component": "apiserver",
19
- "provider": "kubernetes"
20
- },
21
- "selector": null,
22
- "containerPort": 0,
23
- "portalIP": "10.0.0.151"
24
- },
25
- {
26
- "id": "kubernetes-ro",
27
- "uid": "be106b89-8f4e-11e4-814c-3c970e4a436a",
28
- "creationTimestamp": "2014-12-29T13:35:08+02:00",
29
- "selfLink": "/api/v1beta1/services/kubernetes-ro?namespace=default",
30
- "resourceVersion": 3,
31
- "namespace": "default",
32
- "port": 80,
33
- "protocol": "TCP",
34
- "labels": {
35
- "component": "apiserver",
36
- "provider": "kubernetes"
37
- },
38
- "selector": null,
39
- "containerPort": 0,
40
- "portalIP": "10.0.0.171"
41
- }
42
- ]
43
- }
@@ -1,36 +0,0 @@
1
- {
2
- "kind": "NodeList",
3
- "creationTimestamp": null,
4
- "selfLink": "/api/v1beta1/nodes",
5
- "apiVersion": "v1beta1",
6
- "minions": [
7
- {
8
- "id": "127.0.0.1",
9
- "uid": "a7b13504-9402-11e4-9a08-3c970e4a436a",
10
- "creationTimestamp": "2015-01-04T13:13:05+02:00",
11
- "selfLink": "/api/v1beta1/nodes/127.0.0.1",
12
- "resourceVersion": 7,
13
- "resources": {
14
- "capacity": {
15
- "cpu": 1000,
16
- "memory": 3221225472
17
- }
18
- }
19
- }
20
- ],
21
- "items": [
22
- {
23
- "id": "127.0.0.1",
24
- "uid": "a7b13504-9402-11e4-9a08-3c970e4a436a",
25
- "creationTimestamp": "2015-01-04T13:13:05+02:00",
26
- "selfLink": "/api/v1beta1/nodes/127.0.0.1",
27
- "resourceVersion": 7,
28
- "resources": {
29
- "capacity": {
30
- "cpu": 1000,
31
- "memory": 3221225472
32
- }
33
- }
34
- }
35
- ]
36
- }
@@ -1,10 +0,0 @@
1
- {
2
- "kind": "PodList",
3
- "creationTimestamp": null,
4
- "selfLink": "/api/v1beta1/pods",
5
- "resourceVersion": 7,
6
- "apiVersion": "v1beta1",
7
- "items": [
8
-
9
- ]
10
- }
@@ -1,10 +0,0 @@
1
- {
2
- "kind": "ReplicationControllerList",
3
- "creationTimestamp": null,
4
- "selfLink": "/api/v1beta1/replicationControllers",
5
- "resourceVersion": 7,
6
- "apiVersion": "v1beta1",
7
- "items": [
8
-
9
- ]
10
- }
@@ -1,43 +0,0 @@
1
- {
2
- "kind": "ServiceList",
3
- "creationTimestamp": null,
4
- "selfLink": "/api/v1beta1/services",
5
- "resourceVersion": 8,
6
- "apiVersion": "v1beta1",
7
- "items": [
8
- {
9
- "id": "kubernetes",
10
- "uid": "be10c0ba-8f4e-11e4-814c-3c970e4a436a",
11
- "creationTimestamp": "2014-12-29T13:35:08+02:00",
12
- "selfLink": "/api/v1beta1/services/kubernetes?namespace=default",
13
- "resourceVersion": 4,
14
- "namespace": "default",
15
- "port": 443,
16
- "protocol": "TCP",
17
- "labels": {
18
- "component": "apiserver",
19
- "provider": "kubernetes"
20
- },
21
- "selector": null,
22
- "containerPort": 0,
23
- "portalIP": "10.0.0.151"
24
- },
25
- {
26
- "id": "kubernetes-ro",
27
- "uid": "be106b89-8f4e-11e4-814c-3c970e4a436a",
28
- "creationTimestamp": "2014-12-29T13:35:08+02:00",
29
- "selfLink": "/api/v1beta1/services/kubernetes-ro?namespace=default",
30
- "resourceVersion": 3,
31
- "namespace": "default",
32
- "port": 80,
33
- "protocol": "TCP",
34
- "labels": {
35
- "component": "apiserver",
36
- "provider": "kubernetes"
37
- },
38
- "selector": null,
39
- "containerPort": 0,
40
- "portalIP": "10.0.0.171"
41
- }
42
- ]
43
- }
@@ -1,15 +0,0 @@
1
- {
2
- "kind": "Node",
3
- "id": "127.0.0.1",
4
- "uid": "b0ddfa00-8b5b-11e4-a8c4-3c970e4a436a",
5
- "creationTimestamp": "2014-12-24T12:57:45+02:00",
6
- "selfLink": "/api/v1beta1/nodes/127.0.0.1",
7
- "resourceVersion": 7,
8
- "apiVersion": "v1beta1",
9
- "resources": {
10
- "capacity": {
11
- "cpu": 1000,
12
- "memory": 3221225472
13
- }
14
- }
15
- }