kubeclient 0.1.1 → 0.1.2
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.
- checksums.yaml +5 -13
- data/.rubocop.yml +6 -0
- data/README.md +7 -0
- data/Rakefile +6 -3
- data/kubeclient.gemspec +14 -13
- data/lib/kubeclient/entity_list.rb +4 -3
- data/lib/kubeclient/event.rb +4 -0
- data/lib/kubeclient/kube_exception.rb +3 -3
- data/lib/kubeclient/node.rb +2 -2
- data/lib/kubeclient/pod.rb +1 -1
- data/lib/kubeclient/replication_controller.rb +2 -2
- data/lib/kubeclient/service.rb +0 -1
- data/lib/kubeclient/version.rb +2 -1
- data/lib/kubeclient/watch.rb +4 -0
- data/lib/kubeclient/watch_stream.rb +29 -0
- data/lib/kubeclient.rb +99 -90
- data/test/json/entity_list_b1.json +43 -0
- data/test/json/event_list_b3.json +35 -0
- data/test/json/get_all_nodes_b1.json +36 -0
- data/test/json/get_all_pods_b1.json +10 -0
- data/test/json/get_all_replication_b1.json +10 -0
- data/test/json/get_all_services_b1.json +43 -0
- data/test/json/node_b1.json +15 -0
- data/test/json/node_b3.json +27 -0
- data/test/json/pod_b1.json +27 -0
- data/test/json/pod_b3.json +92 -0
- data/test/json/replication_controller_b1.json +66 -0
- data/test/json/replication_controller_b3.json +57 -0
- data/test/json/service_b1.json +20 -0
- data/test/json/service_b3.json +27 -0
- data/test/json/service_exception_b1.json +12 -0
- data/test/json/watch_stream_b3.json +3 -0
- data/test/kubeclient_test.rb +63 -50
- data/test/node_test.rb +30 -33
- data/test/pod_test.rb +19 -24
- data/test/replication_controller_test.rb +34 -33
- data/test/service_test.rb +66 -53
- data/test/watch_test.rb +40 -0
- metadata +70 -18
data/test/watch_test.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'webmock/minitest'
|
3
|
+
require 'kubeclient/node'
|
4
|
+
require 'json'
|
5
|
+
require './lib/kubeclient'
|
6
|
+
|
7
|
+
# Watch entity tests
|
8
|
+
class WatchTest < MiniTest::Test
|
9
|
+
def test_watch_pod_success
|
10
|
+
expected = [
|
11
|
+
{ 'type' => 'ADDED', 'resourceVersion' => '1389' },
|
12
|
+
{ 'type' => 'MODIFIED', 'resourceVersion' => '1390' },
|
13
|
+
{ 'type' => 'DELETED', 'resourceVersion' => '1398' }
|
14
|
+
]
|
15
|
+
|
16
|
+
stub_request(:get, %r{.*\/watch/pods})
|
17
|
+
.to_return(body: open_test_json_file('watch_stream_b3.json'),
|
18
|
+
status: 200)
|
19
|
+
|
20
|
+
client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta3'
|
21
|
+
client.watch_pods.with_index do |message, index|
|
22
|
+
assert_instance_of(WatchNotice, message)
|
23
|
+
assert_equal(expected[index]['type'], message.type)
|
24
|
+
assert_equal('Pod', message.object.kind)
|
25
|
+
assert_equal('php', message.object.metadata.name)
|
26
|
+
assert_equal(expected[index]['resourceVersion'],
|
27
|
+
message.object.metadata.resourceVersion)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_watch_pod_failure
|
32
|
+
stub_request(:get, %r{.*\/watch/pods}).to_return(status: 404)
|
33
|
+
|
34
|
+
client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta3'
|
35
|
+
assert_raises KubeException do
|
36
|
+
client.watch_pods.each do
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
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.
|
4
|
+
version: 0.1.2
|
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-
|
11
|
+
date: 2015-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -42,84 +42,98 @@ dependencies:
|
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: webmock
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rest-client
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- -
|
87
|
+
- - '>='
|
74
88
|
- !ruby/object:Gem::Version
|
75
89
|
version: '0'
|
76
90
|
type: :runtime
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- -
|
94
|
+
- - '>='
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: activesupport
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
|
-
- -
|
101
|
+
- - '>='
|
88
102
|
- !ruby/object:Gem::Version
|
89
103
|
version: '0'
|
90
104
|
type: :runtime
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
|
-
- -
|
108
|
+
- - '>='
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: json
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
|
-
- -
|
115
|
+
- - '>='
|
102
116
|
- !ruby/object:Gem::Version
|
103
117
|
version: '0'
|
104
118
|
type: :runtime
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
|
-
- -
|
122
|
+
- - '>='
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: '0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: recursive-open-struct
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
|
-
- -
|
129
|
+
- - '>='
|
116
130
|
- !ruby/object:Gem::Version
|
117
131
|
version: '0'
|
118
132
|
type: :runtime
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
|
-
- -
|
136
|
+
- - '>='
|
123
137
|
- !ruby/object:Gem::Version
|
124
138
|
version: '0'
|
125
139
|
description: A client for Kubernetes REST api
|
@@ -130,6 +144,7 @@ extensions: []
|
|
130
144
|
extra_rdoc_files: []
|
131
145
|
files:
|
132
146
|
- .gitignore
|
147
|
+
- .rubocop.yml
|
133
148
|
- Gemfile
|
134
149
|
- LICENSE.txt
|
135
150
|
- README.md
|
@@ -137,17 +152,37 @@ files:
|
|
137
152
|
- kubeclient.gemspec
|
138
153
|
- lib/kubeclient.rb
|
139
154
|
- lib/kubeclient/entity_list.rb
|
155
|
+
- lib/kubeclient/event.rb
|
140
156
|
- lib/kubeclient/kube_exception.rb
|
141
157
|
- lib/kubeclient/node.rb
|
142
158
|
- lib/kubeclient/pod.rb
|
143
159
|
- lib/kubeclient/replication_controller.rb
|
144
160
|
- lib/kubeclient/service.rb
|
145
161
|
- lib/kubeclient/version.rb
|
162
|
+
- lib/kubeclient/watch.rb
|
163
|
+
- lib/kubeclient/watch_stream.rb
|
164
|
+
- test/json/entity_list_b1.json
|
165
|
+
- test/json/event_list_b3.json
|
166
|
+
- test/json/get_all_nodes_b1.json
|
167
|
+
- test/json/get_all_pods_b1.json
|
168
|
+
- test/json/get_all_replication_b1.json
|
169
|
+
- test/json/get_all_services_b1.json
|
170
|
+
- test/json/node_b1.json
|
171
|
+
- test/json/node_b3.json
|
172
|
+
- test/json/pod_b1.json
|
173
|
+
- test/json/pod_b3.json
|
174
|
+
- test/json/replication_controller_b1.json
|
175
|
+
- test/json/replication_controller_b3.json
|
176
|
+
- test/json/service_b1.json
|
177
|
+
- test/json/service_b3.json
|
178
|
+
- test/json/service_exception_b1.json
|
179
|
+
- test/json/watch_stream_b3.json
|
146
180
|
- test/kubeclient_test.rb
|
147
181
|
- test/node_test.rb
|
148
182
|
- test/pod_test.rb
|
149
183
|
- test/replication_controller_test.rb
|
150
184
|
- test/service_test.rb
|
185
|
+
- test/watch_test.rb
|
151
186
|
homepage: https://github.com/abonas/kubeclient
|
152
187
|
licenses:
|
153
188
|
- MIT
|
@@ -158,23 +193,40 @@ require_paths:
|
|
158
193
|
- lib
|
159
194
|
required_ruby_version: !ruby/object:Gem::Requirement
|
160
195
|
requirements:
|
161
|
-
- -
|
196
|
+
- - '>='
|
162
197
|
- !ruby/object:Gem::Version
|
163
|
-
version:
|
198
|
+
version: 2.0.0
|
164
199
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
200
|
requirements:
|
166
|
-
- -
|
201
|
+
- - '>='
|
167
202
|
- !ruby/object:Gem::Version
|
168
203
|
version: '0'
|
169
204
|
requirements: []
|
170
205
|
rubyforge_project:
|
171
|
-
rubygems_version: 2.
|
206
|
+
rubygems_version: 2.4.5
|
172
207
|
signing_key:
|
173
208
|
specification_version: 4
|
174
209
|
summary: A client for Kubernetes REST api
|
175
210
|
test_files:
|
211
|
+
- test/json/entity_list_b1.json
|
212
|
+
- test/json/event_list_b3.json
|
213
|
+
- test/json/get_all_nodes_b1.json
|
214
|
+
- test/json/get_all_pods_b1.json
|
215
|
+
- test/json/get_all_replication_b1.json
|
216
|
+
- test/json/get_all_services_b1.json
|
217
|
+
- test/json/node_b1.json
|
218
|
+
- test/json/node_b3.json
|
219
|
+
- test/json/pod_b1.json
|
220
|
+
- test/json/pod_b3.json
|
221
|
+
- test/json/replication_controller_b1.json
|
222
|
+
- test/json/replication_controller_b3.json
|
223
|
+
- test/json/service_b1.json
|
224
|
+
- test/json/service_b3.json
|
225
|
+
- test/json/service_exception_b1.json
|
226
|
+
- test/json/watch_stream_b3.json
|
176
227
|
- test/kubeclient_test.rb
|
177
228
|
- test/node_test.rb
|
178
229
|
- test/pod_test.rb
|
179
230
|
- test/replication_controller_test.rb
|
180
231
|
- test/service_test.rb
|
232
|
+
- test/watch_test.rb
|