kubeclient 0.1.13 → 0.1.14
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 +4 -4
- data/lib/kubeclient.rb +0 -12
- data/lib/kubeclient/common.rb +12 -0
- data/lib/kubeclient/version.rb +1 -1
- data/test/test_kubeclient.rb +22 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4683f1e62a19fc625503044618924b1af4ff86e3
|
4
|
+
data.tar.gz: c00b7d81ef2ddf4e0989a41ac672d6d60b9ce7c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f59df446d480eae9100131ed724d33b1b575668a93418c5cb9846e4f41c4cabea36517231ab127b6cdb14540d8b1389b0f4eedc405bfc2fe21a75d16b63ae28
|
7
|
+
data.tar.gz: 3ab1f5980bd52ef68eb2b6e47d8a5d28e10f02a005e89f4f83f6df93933050462e766f872971dc0419f05f4b30c2e465f6a2573750e8fdc19a63e35aa70f64a8
|
data/lib/kubeclient.rb
CHANGED
@@ -39,18 +39,6 @@ module Kubeclient
|
|
39
39
|
retrieve_all_entities(ENTITY_TYPES)
|
40
40
|
end
|
41
41
|
|
42
|
-
def api
|
43
|
-
response = handle_exception do
|
44
|
-
create_rest_client.get
|
45
|
-
end
|
46
|
-
JSON.parse(response)
|
47
|
-
end
|
48
|
-
|
49
|
-
def api_valid?
|
50
|
-
result = api
|
51
|
-
result.is_a?(Hash) && result['versions'].is_a?(Array)
|
52
|
-
end
|
53
|
-
|
54
42
|
define_entity_methods(ENTITY_TYPES)
|
55
43
|
end
|
56
44
|
end
|
data/lib/kubeclient/common.rb
CHANGED
@@ -194,6 +194,18 @@ module Kubeclient
|
|
194
194
|
entity_type.pluralize.downcase
|
195
195
|
end
|
196
196
|
|
197
|
+
def api_valid?
|
198
|
+
result = api
|
199
|
+
result.is_a?(Hash) && (result['versions'] || []).include?(@api_version)
|
200
|
+
end
|
201
|
+
|
202
|
+
def api
|
203
|
+
response = handle_exception do
|
204
|
+
create_rest_client.get
|
205
|
+
end
|
206
|
+
JSON.parse(response)
|
207
|
+
end
|
208
|
+
|
197
209
|
def ssl_options(client_cert: nil, client_key: nil, ca_file: nil,
|
198
210
|
verify_ssl: OpenSSL::SSL::VERIFY_PEER)
|
199
211
|
@ssl_options = {
|
data/lib/kubeclient/version.rb
CHANGED
data/test/test_kubeclient.rb
CHANGED
@@ -92,13 +92,33 @@ class KubeClientTest < MiniTest::Test
|
|
92
92
|
stub_request(:get, 'http://localhost:8080/api')
|
93
93
|
.to_return(status: 200, body: open_test_json_file('versions_list.json'))
|
94
94
|
|
95
|
+
args = ['http://localhost:8080/api/']
|
96
|
+
|
97
|
+
[nil, 'v1beta1', 'v1beta2', 'v1beta3'].each do |version|
|
98
|
+
client = Kubeclient::Client.new(*(version ? args + [version] : args))
|
99
|
+
assert client.api_valid?
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def test_api_valid_with_invalid_version
|
104
|
+
stub_request(:get, 'http://localhost:8080/api')
|
105
|
+
.to_return(status: 200, body: open_test_json_file('versions_list.json'))
|
106
|
+
|
107
|
+
client = Kubeclient::Client.new 'http://localhost:8080/api/', 'foobar1'
|
108
|
+
refute client.api_valid?
|
109
|
+
end
|
110
|
+
|
111
|
+
def test_api_valid_with_unreported_versions
|
112
|
+
stub_request(:get, 'http://localhost:8080/api')
|
113
|
+
.to_return(status: 200, body: '{}')
|
114
|
+
|
95
115
|
client = Kubeclient::Client.new 'http://localhost:8080/api/'
|
96
|
-
|
116
|
+
refute client.api_valid?
|
97
117
|
end
|
98
118
|
|
99
119
|
def test_api_valid_with_invalid_json
|
100
120
|
stub_request(:get, 'http://localhost:8080/api')
|
101
|
-
.to_return(status: 200, body: '
|
121
|
+
.to_return(status: 200, body: '[]')
|
102
122
|
|
103
123
|
client = Kubeclient::Client.new 'http://localhost:8080/api/'
|
104
124
|
refute client.api_valid?
|
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.14
|
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-05-
|
11
|
+
date: 2015-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|