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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e56c3b573a2c07c74aa8de8048af1dda5e579f8a
4
- data.tar.gz: 1e05214d7d5873ebb19c18495ed4085a66dc47aa
3
+ metadata.gz: 4683f1e62a19fc625503044618924b1af4ff86e3
4
+ data.tar.gz: c00b7d81ef2ddf4e0989a41ac672d6d60b9ce7c4
5
5
  SHA512:
6
- metadata.gz: 1a1d759639dd39f6e9fb7c21108469f50a90116f8e4cc9b3725b9fe4d3fa241945c5f5523cb99bbee922db296f7d719bde706d9cd2fb4cddfefa2866348dbd20
7
- data.tar.gz: 2fa195b4588382542a48cb80a68f161a5d609b594a4987a47fcc01edbad314b64876aa963bd78e0307f6d71a60aeaba9ef408aed3884ba61057328e1da190b40
6
+ metadata.gz: 0f59df446d480eae9100131ed724d33b1b575668a93418c5cb9846e4f41c4cabea36517231ab127b6cdb14540d8b1389b0f4eedc405bfc2fe21a75d16b63ae28
7
+ data.tar.gz: 3ab1f5980bd52ef68eb2b6e47d8a5d28e10f02a005e89f4f83f6df93933050462e766f872971dc0419f05f4b30c2e465f6a2573750e8fdc19a63e35aa70f64a8
@@ -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
@@ -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 = {
@@ -1,4 +1,4 @@
1
1
  # Kubernetes REST-API Client
2
2
  module Kubeclient
3
- VERSION = '0.1.13'
3
+ VERSION = '0.1.14'
4
4
  end
@@ -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
- assert client.api_valid?
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.13
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-05 00:00:00.000000000 Z
11
+ date: 2015-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler