elasticsearch 7.17.1 → 8.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,101 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ require 'spec_helper'
19
+
20
+ describe Elasticsearch::Client do
21
+ context 'when using API Key' do
22
+ let(:authorization_header) do
23
+ client.transport.connections.first.connection.headers['Authorization']
24
+ end
25
+
26
+ context 'when an encoded api_key is provided' do
27
+ let(:client) do
28
+ described_class.new(api_key: 'an_api_key')
29
+ end
30
+
31
+ it 'Adds the ApiKey header to the connection' do
32
+ expect(authorization_header).to eq('ApiKey an_api_key')
33
+ end
34
+ end
35
+
36
+ context 'when an un-encoded api_key is provided' do
37
+ let(:client) do
38
+ described_class.new(api_key: { id: 'my_id', api_key: 'my_api_key' })
39
+ end
40
+
41
+ it 'Adds the ApiKey header to the connection' do
42
+ expect(authorization_header).to eq("ApiKey #{Base64.strict_encode64('my_id:my_api_key')}")
43
+ end
44
+ end
45
+
46
+ context 'when basic auth and api_key are provided' do
47
+ let(:client) do
48
+ described_class.new(
49
+ api_key: { id: 'my_id', api_key: 'my_api_key' },
50
+ host: 'http://elastic:password@localhost:9200'
51
+ )
52
+ end
53
+
54
+ it 'removes basic auth credentials' do
55
+ expect(authorization_header).not_to match(/^Basic/)
56
+ expect(authorization_header).to match(/^ApiKey/)
57
+ end
58
+ end
59
+
60
+ context 'when other headers where specified' do
61
+ let(:client) do
62
+ described_class.new(
63
+ api_key: 'elasticsearch_api_key',
64
+ transport_options: { headers: { 'x-test-header' => 'test' } }
65
+ )
66
+ end
67
+
68
+ it 'Adds the ApiKey header to the connection and keeps the header' do
69
+ header = client.transport.connections.first.connection.headers
70
+ expect(header['Authorization']).to eq('ApiKey elasticsearch_api_key')
71
+ expect(header['X-Test-Header']).to eq('test')
72
+ end
73
+ end
74
+
75
+ context 'Metaheader' do
76
+ let(:adapter_code) { "nh=#{defined?(Net::HTTP::VERSION) ? Net::HTTP::VERSION : Net::HTTP::HTTPVersion}" }
77
+ let(:meta_header) do
78
+ if jruby?
79
+ "es=#{meta_version},rb=#{RUBY_VERSION},t=#{Elastic::Transport::VERSION},jv=#{ENV_JAVA['java.version']},jr=#{JRUBY_VERSION},fd=#{Faraday::VERSION},#{adapter_code}"
80
+ else
81
+ "es=#{meta_version},rb=#{RUBY_VERSION},t=#{Elastic::Transport::VERSION},fd=#{Faraday::VERSION},#{adapter_code}"
82
+ end
83
+ end
84
+
85
+ context 'when using API Key' do
86
+ let(:client) do
87
+ described_class.new(api_key: 'an_api_key')
88
+ end
89
+
90
+ let(:headers) do
91
+ client.transport.connections.first.connection.headers
92
+ end
93
+
94
+ it 'adds the ApiKey header to the connection' do
95
+ expect(authorization_header).to eq('ApiKey an_api_key')
96
+ expect(headers).to include('x-elastic-client-meta' => meta_header)
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,167 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ require 'spec_helper'
19
+
20
+ describe Elasticsearch::Client do
21
+ context 'when cloud credentials are provided' do
22
+ let(:client) do
23
+ described_class.new(
24
+ cloud_id: 'name:bG9jYWxob3N0JGFiY2QkZWZnaA==',
25
+ user: 'elastic',
26
+ password: 'changeme'
27
+ )
28
+ end
29
+
30
+ let(:hosts) do
31
+ client.transport.hosts
32
+ end
33
+
34
+ it 'extracts the cloud credentials' do
35
+ expect(hosts[0][:host]).to eq('abcd.localhost')
36
+ expect(hosts[0][:protocol]).to eq('https')
37
+ expect(hosts[0][:user]).to eq('elastic')
38
+ expect(hosts[0][:password]).to eq('changeme')
39
+ expect(hosts[0][:port]).to eq(443)
40
+ end
41
+
42
+ it 'creates the correct full url' do
43
+ expect(
44
+ client.transport.__full_url(client.transport.hosts[0])
45
+ ).to eq('https://elastic:changeme@abcd.localhost:443')
46
+ end
47
+
48
+ context 'when a port is specified' do
49
+ let(:client) do
50
+ described_class.new(cloud_id: 'name:bG9jYWxob3N0JGFiY2QkZWZnaA==', user: 'elastic', password: 'changeme', port: 9250)
51
+ end
52
+
53
+ it 'sets the specified port along with the cloud credentials' do
54
+ expect(hosts[0][:host]).to eq('abcd.localhost')
55
+ expect(hosts[0][:protocol]).to eq('https')
56
+ expect(hosts[0][:user]).to eq('elastic')
57
+ expect(hosts[0][:password]).to eq('changeme')
58
+ expect(hosts[0][:port]).to eq(9250)
59
+ end
60
+
61
+ it 'creates the correct full url' do
62
+ expect(client.transport.__full_url(client.transport.hosts[0])).to eq('https://elastic:changeme@abcd.localhost:9250')
63
+ end
64
+ end
65
+
66
+ context 'when the cluster has alternate names' do
67
+ let(:client) do
68
+ described_class.new(
69
+ cloud_id: 'myCluster:bG9jYWxob3N0JGFiY2QkZWZnaA==',
70
+ user: 'elasticfantastic',
71
+ password: 'tobechanged'
72
+ )
73
+ end
74
+
75
+ let(:hosts) do
76
+ client.transport.hosts
77
+ end
78
+
79
+ it 'extracts the cloud credentials' do
80
+ expect(hosts[0][:host]).to eq('abcd.localhost')
81
+ expect(hosts[0][:protocol]).to eq('https')
82
+ expect(hosts[0][:user]).to eq('elasticfantastic')
83
+ expect(hosts[0][:password]).to eq('tobechanged')
84
+ expect(hosts[0][:port]).to eq(443)
85
+ end
86
+
87
+ it 'creates the correct full url' do
88
+ expect(
89
+ client.transport.__full_url(client.transport.hosts[0])
90
+ ).to eq('https://elasticfantastic:tobechanged@abcd.localhost:443')
91
+ end
92
+ end
93
+
94
+ context 'when decoded cloud id has a trailing dollar sign' do
95
+ let(:client) do
96
+ described_class.new(
97
+ cloud_id: 'a_cluster:bG9jYWxob3N0JGFiY2Qk',
98
+ user: 'elasticfantastic',
99
+ password: 'changeme'
100
+ )
101
+ end
102
+
103
+ let(:hosts) do
104
+ client.transport.hosts
105
+ end
106
+
107
+ it 'extracts the cloud credentials' do
108
+ expect(hosts[0][:host]).to eq('abcd.localhost')
109
+ expect(hosts[0][:protocol]).to eq('https')
110
+ expect(hosts[0][:user]).to eq('elasticfantastic')
111
+ expect(hosts[0][:password]).to eq('changeme')
112
+ expect(hosts[0][:port]).to eq(443)
113
+ end
114
+
115
+ it 'creates the correct full url' do
116
+ expect(
117
+ client.transport.__full_url(client.transport.hosts[0])
118
+ ).to eq('https://elasticfantastic:changeme@abcd.localhost:443')
119
+ end
120
+ end
121
+
122
+ context 'when the cloud host provides a port' do
123
+ let(:client) do
124
+ described_class.new(
125
+ cloud_id: 'name:ZWxhc3RpY19zZXJ2ZXI6OTI0MyRlbGFzdGljX2lk',
126
+ user: 'elastic',
127
+ password: 'changeme'
128
+ )
129
+ end
130
+
131
+ let(:hosts) do
132
+ client.transport.hosts
133
+ end
134
+
135
+ it 'creates the correct full url' do
136
+ expect(hosts[0][:host]).to eq('elastic_id.elastic_server')
137
+ expect(hosts[0][:protocol]).to eq('https')
138
+ expect(hosts[0][:user]).to eq('elastic')
139
+ expect(hosts[0][:password]).to eq('changeme')
140
+ expect(hosts[0][:port]).to eq(9243)
141
+ end
142
+ end
143
+
144
+ context 'when the cloud host provides a port and the port is also specified' do
145
+ let(:client) do
146
+ described_class.new(
147
+ cloud_id: 'name:ZWxhc3RpY19zZXJ2ZXI6OTI0MyRlbGFzdGljX2lk',
148
+ user: 'elastic',
149
+ password: 'changeme',
150
+ port: 9200
151
+ )
152
+ end
153
+
154
+ let(:hosts) do
155
+ client.transport.hosts
156
+ end
157
+
158
+ it 'creates the correct full url' do
159
+ expect(hosts[0][:host]).to eq('elastic_id.elastic_server')
160
+ expect(hosts[0][:protocol]).to eq('https')
161
+ expect(hosts[0][:user]).to eq('elastic')
162
+ expect(hosts[0][:password]).to eq('changeme')
163
+ expect(hosts[0][:port]).to eq(9243)
164
+ end
165
+ end
166
+ end
167
+ end
@@ -0,0 +1,43 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+ require 'spec_helper'
18
+
19
+ describe Elasticsearch::Client do
20
+ context 'when using custom transport implementation' do
21
+ class MyTransport
22
+ include Elastic::Transport::Transport::Base
23
+ def initialize(args); end
24
+ end
25
+ let(:client) { Elasticsearch::Client.new(transport_class: MyTransport) }
26
+ let(:arguments) { client.instance_variable_get('@transport').instance_variable_get('@arguments') }
27
+ let(:subject) do
28
+ arguments[:transport_options][:headers]
29
+ end
30
+
31
+ let(:meta_header) do
32
+ if jruby?
33
+ "es=#{meta_version},rb=#{RUBY_VERSION},t=#{Elastic::Transport::VERSION},jv=#{ENV_JAVA['java.version']},jr=#{JRUBY_VERSION}"
34
+ else
35
+ "es=#{meta_version},rb=#{RUBY_VERSION},t=#{Elastic::Transport::VERSION}"
36
+ end
37
+ end
38
+
39
+ it 'doesnae set any info about the implementation in the metaheader' do
40
+ expect(subject).to include('x-elastic-client-meta' => meta_header)
41
+ end
42
+ end
43
+ end
@@ -32,13 +32,13 @@ describe 'Elasticsearch: Validation' do
32
32
  let(:body) { {}.to_json }
33
33
  let(:client) { Elasticsearch::Client.new }
34
34
  let(:headers) do
35
- { 'content-type' => 'json' }
35
+ { 'content-type' => 'application/json' }
36
36
  end
37
37
 
38
38
  def error_requests_and_expectations(message = Elasticsearch::NOT_ELASTICSEARCH_WARNING)
39
39
  expect { client.count }.to raise_error Elasticsearch::UnsupportedProductError, message
40
40
  assert_requested :get, host
41
- assert_not_requested :get, "#{host}/_count"
41
+ assert_not_requested :post, "#{host}/_count"
42
42
  expect { client.cluster.health }.to raise_error Elasticsearch::UnsupportedProductError, message
43
43
  expect(client.instance_variable_get('@verified')).to be false
44
44
  expect { client.cluster.health }.to raise_error Elasticsearch::UnsupportedProductError, message
@@ -65,7 +65,6 @@ describe 'Elasticsearch: Validation' do
65
65
 
66
66
  verify_request_stub
67
67
  count_request_stub
68
-
69
68
  valid_requests_and_expectations
70
69
 
71
70
  fake_stderr.rewind
@@ -86,7 +85,6 @@ describe 'Elasticsearch: Validation' do
86
85
 
87
86
  verify_request_stub
88
87
  count_request_stub
89
-
90
88
  valid_requests_and_expectations
91
89
 
92
90
  fake_stderr.rewind
@@ -96,30 +94,63 @@ describe 'Elasticsearch: Validation' do
96
94
  end
97
95
  end
98
96
 
99
- context 'When Elasticsearch replies with status 403' do
97
+ context 'When Elasticsearch replies with status 413' do
100
98
  let(:status) { 413 }
101
99
  let(:body) { {}.to_json }
102
100
 
103
- it 'Verifies the request but shows a warning' do
101
+ it 'Verifies the request and shows a warning' do
104
102
  stderr = $stderr
105
103
  fake_stderr = StringIO.new
106
104
  $stderr = fake_stderr
107
105
 
106
+ expect(client.instance_variable_get('@verified')).to be false
107
+ assert_not_requested :get, host
108
108
  verify_request_stub
109
- count_request_stub
109
+ expect { client.info }.to raise_error Elastic::Transport::Transport::Errors::RequestEntityTooLarge
110
+ expect(client.instance_variable_get('@verified')).to be true
110
111
 
111
- valid_requests_and_expectations
112
+ fake_stderr.rewind
113
+ expect(fake_stderr.string.delete("\n"))
114
+ .to eq(Elasticsearch::SECURITY_PRIVILEGES_VALIDATION_WARNING)
115
+ ensure
116
+ $stderr = stderr
117
+ end
118
+ end
119
+
120
+ context 'When Elasticsearch replies with status 503' do
121
+ let(:status) { 503 }
122
+ let(:body) { {}.to_json }
123
+
124
+ it 'Does not verify the request and shows a warning' do
125
+ stderr = $stderr
126
+ fake_stderr = StringIO.new
127
+ $stderr = fake_stderr
128
+
129
+ expect(client.instance_variable_get('@verified')).to be false
130
+ assert_not_requested :get, host
131
+ verify_request_stub
132
+ expect { client.info }.to raise_error Elastic::Transport::Transport::Errors::ServiceUnavailable
133
+ assert_not_requested :post, "#{host}/_count"
134
+ expect(client.instance_variable_get('@verified')).to be false
112
135
 
113
136
  fake_stderr.rewind
114
- expect(fake_stderr.string).to eq("#{Elasticsearch::SECURITY_PRIVILEGES_VALIDATION_WARNING}\n")
137
+ expect(fake_stderr.string)
138
+ .to eq(
139
+ <<~MSG
140
+ The client is unable to verify that the server is \
141
+ Elasticsearch. Some functionality may not be compatible \
142
+ if the server is running an unsupported product.
143
+ MSG
144
+ )
115
145
  ensure
116
146
  $stderr = stderr
117
147
  end
118
148
  end
119
149
 
120
- context 'When the Elasticsearch version is >= 7.14' do
150
+
151
+ context 'When the Elasticsearch version is >= 8.0.0' do
121
152
  context 'With a valid Elasticsearch response' do
122
- let(:body) { { 'version' => { 'number' => '7.14.0' } }.to_json }
153
+ let(:body) { { 'version' => { 'number' => '8.0.0' } }.to_json }
123
154
  let(:headers) do
124
155
  {
125
156
  'X-Elastic-Product' => 'Elasticsearch',
@@ -147,9 +178,9 @@ describe 'Elasticsearch: Validation' do
147
178
  end
148
179
  end
149
180
 
150
- context 'When the Elasticsearch version is >= 7.14-SNAPSHOT' do
181
+ context 'When the Elasticsearch version is >= 8.1.0' do
151
182
  context 'With a valid Elasticsearch response' do
152
- let(:body) { { 'version' => { 'number' => '7.14-SNAPSHOT' } }.to_json }
183
+ let(:body) { { 'version' => { 'number' => '8.1.0' } }.to_json }
153
184
  let(:headers) do
154
185
  {
155
186
  'X-Elastic-Product' => 'Elasticsearch',
@@ -177,15 +208,17 @@ describe 'Elasticsearch: Validation' do
177
208
  end
178
209
  end
179
210
 
180
- context 'When the Elasticsearch version is >= 7.15-SNAPSHOT' do
211
+
212
+ context 'When the Elasticsearch version is 8.0.0.pre' do
181
213
  context 'With a valid Elasticsearch response' do
182
- let(:body) { { 'version' => { 'number' => '7.15-SNAPSHOT' } }.to_json }
214
+ let(:body) { { 'version' => { 'number' => '8.0.0.pre' } }.to_json }
183
215
  let(:headers) do
184
216
  {
185
217
  'X-Elastic-Product' => 'Elasticsearch',
186
218
  'content-type' => 'json'
187
219
  }
188
220
  end
221
+
189
222
  it 'Makes requests and passes validation' do
190
223
  verify_request_stub
191
224
  count_request_stub
@@ -206,8 +239,8 @@ describe 'Elasticsearch: Validation' do
206
239
  end
207
240
  end
208
241
 
209
- context 'When the version is 7.x-SNAPSHOT' do
210
- let(:body) { { 'version' => { 'number' => '7.x-SNAPSHOT' } }.to_json }
242
+ context 'When the version is 8.0.0-SNAPSHOT' do
243
+ let(:body) { { 'version' => { 'number' => '8.0.0-SNAPSHOT' } }.to_json }
211
244
 
212
245
  context 'When the header is not present' do
213
246
  it 'Fails validation' do
@@ -235,77 +268,8 @@ describe 'Elasticsearch: Validation' do
235
268
  end
236
269
  end
237
270
 
238
- context 'When Elasticsearch version is 7.4.0' do
239
- context 'When tagline is not present' do
240
- let(:body) { { 'version' => { 'number' => '7.4.0', 'build_flavor' => 'default' } }.to_json }
241
-
242
- it 'Fails validation' do
243
- verify_request_stub
244
- count_request_stub
245
-
246
- error_requests_and_expectations
247
- end
248
- end
249
-
250
- context 'When build flavor is not present' do
251
- let(:body) do
252
- {
253
- 'version' => {
254
- 'number' => '7.4.0'
255
- },
256
- 'tagline' => Elasticsearch::YOU_KNOW_FOR_SEARCH
257
- }.to_json
258
- end
259
-
260
- it 'Fails validation' do
261
- verify_request_stub
262
- count_request_stub
263
-
264
- error_requests_and_expectations(Elasticsearch::NOT_SUPPORTED_ELASTICSEARCH_WARNING)
265
- end
266
- end
267
-
268
- context 'When the tagline is different' do
269
- let(:body) do
270
- {
271
- 'version' => {
272
- 'number' => '7.4.0',
273
- 'build_flavor' => 'default'
274
- },
275
- 'tagline' => 'You Know, for other stuff'
276
- }.to_json
277
- end
278
-
279
- it 'Fails validation' do
280
- verify_request_stub
281
- count_request_stub
282
-
283
- error_requests_and_expectations
284
- end
285
- end
286
-
287
- context 'With a valid Elasticsearch response' do
288
- let(:body) do
289
- {
290
- 'version' => {
291
- 'number' => '7.4.0',
292
- 'build_flavor' => 'default'
293
- },
294
- 'tagline' => 'You Know, for Search'
295
- }.to_json
296
- end
297
-
298
- it 'Makes requests and passes validation' do
299
- verify_request_stub
300
- count_request_stub
301
-
302
- valid_requests_and_expectations
303
- end
304
- end
305
- end
306
-
307
- context 'When Elasticsearch version is < 6.0.0' do
308
- let(:body) { { 'version' => { 'number' => '5.0.0' } }.to_json }
271
+ context 'When Elasticsearch version is < 8.0.0' do
272
+ let(:body) { { 'version' => { 'number' => '7.16.0' } }.to_json }
309
273
 
310
274
  it 'Raises an exception and client doesnae work' do
311
275
  verify_request_stub
@@ -321,141 +285,13 @@ describe 'Elasticsearch: Validation' do
321
285
  end
322
286
  end
323
287
 
324
- context 'When Elasticsearch version is between 6.0.0 and 7.0.0' do
325
- context 'With an Elasticsearch valid response' do
326
- let(:body) do
327
- {
328
- 'version' => {
329
- 'number' => '6.8.10'
330
- },
331
- 'tagline' => 'You Know, for Search'
332
- }.to_json
333
- end
334
-
335
- it 'Makes requests and passes validation' do
336
- verify_request_stub
337
- count_request_stub
338
-
339
- valid_requests_and_expectations
340
- end
341
- end
342
-
343
- context 'With no tagline' do
344
- let(:body) do
345
- { 'version' => { 'number' => '6.8.10' } }.to_json
346
- end
347
-
348
- it 'Fails validation' do
349
- verify_request_stub
350
- count_request_stub
351
-
352
- error_requests_and_expectations
353
- end
354
- end
355
-
356
- context 'When the tagline is different' do
357
- let(:body) do
358
- {
359
- 'version' => {
360
- 'number' => '6.8.10',
361
- 'build_flavor' => 'default'
362
- },
363
- 'tagline' => 'You Know, for Stuff'
364
- }.to_json
365
- end
366
-
367
- it 'Fails validation' do
368
- verify_request_stub
369
- count_request_stub
370
-
371
- error_requests_and_expectations
372
- end
373
- end
374
- end
375
-
376
- context 'When Elasticsearch version is between 7.0.0 and 7.14.0' do
377
- context 'With a valid Elasticsearch response' do
378
- let(:body) do
379
- {
380
- 'version' => {
381
- 'number' => '7.10.0',
382
- 'build_flavor' => 'default'
383
- },
384
- 'tagline' => 'You Know, for Search'
385
- }.to_json
386
- end
387
-
388
- it 'Makes requests and passes validation' do
389
- verify_request_stub
390
- count_request_stub
391
-
392
- valid_requests_and_expectations
393
- end
394
- end
395
-
396
- context 'When the tagline is not present' do
397
- let(:body) do
398
- {
399
- 'version' => {
400
- 'number' => '7.10.0',
401
- 'build_flavor' => 'default'
402
- }
403
- }.to_json
404
- end
405
-
406
- it 'Fails validation' do
407
- verify_request_stub
408
- count_request_stub
409
-
410
- error_requests_and_expectations
411
- end
412
- end
413
-
414
- context 'When the tagline is different' do
415
- let(:body) do
416
- {
417
- 'version' => {
418
- 'number' => '7.10.0',
419
- 'build_flavor' => 'default'
420
- },
421
- 'tagline' => 'You Know, for other stuff'
422
- }.to_json
423
- end
424
-
425
- it 'Fails validation' do
426
- verify_request_stub
427
- count_request_stub
428
-
429
- error_requests_and_expectations
430
- end
431
- end
432
-
433
- context 'When the build_flavor is not present' do
434
- let(:body) do
435
- {
436
- 'version' => {
437
- 'number' => '7.10.0'
438
- },
439
- 'tagline' => 'You Know, for Search'
440
- }.to_json
441
- end
442
-
443
- it 'Fails validation' do
444
- verify_request_stub
445
- count_request_stub
446
-
447
- error_requests_and_expectations(Elasticsearch::NOT_SUPPORTED_ELASTICSEARCH_WARNING)
448
- end
449
- end
450
- end
451
-
452
288
  context 'When doing a yaml content-type request' do
453
289
  let(:client) do
454
290
  Elasticsearch::Client.new(transport_options: {headers: { accept: 'application/yaml', content_type: 'application/yaml' }})
455
291
  end
456
292
 
457
293
  let(:headers) { { 'content-type' => 'application/yaml', 'X-Elastic-Product' => 'Elasticsearch' } }
458
- let(:body) { "---\nversion:\n number: \"7.14.0-SNAPSHOT\"\n" }
294
+ let(:body) { "---\nversion:\n number: \"8.0.0-SNAPSHOT\"\n" }
459
295
 
460
296
  it 'validates' do
461
297
  verify_request_stub