Skip to content

Commit 8f9af95

Browse files
committed
[Gem] Updates tagline tests
1 parent 90e5230 commit 8f9af95

File tree

2 files changed

+65
-6
lines changed

2 files changed

+65
-6
lines changed

elasticsearch/lib/elasticsearch.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
require 'elasticsearch/api'
2121

2222
module Elasticsearch
23-
SECURITY_PRIVILEGES_VALIDATION_WARNING = 'The client is unable to verify that the server is Elasticsearch due to security privileges on the server side.'.freeze
23+
SECURITY_PRIVILEGES_VALIDATION_WARNING = 'The client is unable to verify that the server is Elasticsearch due to security privileges on the server side. Some functionality may not be compatible if the server is running an unsupported product.'.freeze
2424
NOT_ELASTICSEARCH_WARNING = 'The client noticed that the server is not Elasticsearch and we do not support this unknown product.'.freeze
25-
YOU_KNOW_FOR_SEARCH = 'You know, for Search'.freeze
25+
YOU_KNOW_FOR_SEARCH = 'You Know, for Search'.freeze
2626

2727
class Client
2828
include Elasticsearch::API

elasticsearch/spec/unit/elasticsearch_product_validation_spec.rb

Lines changed: 63 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ def valid_requests_and_expectations
105105
'content-type' => 'json'
106106
}
107107
end
108+
108109
it 'Makes requests and passes validation' do
109110
verify_request_stub
110111
count_request_stub
@@ -134,6 +135,7 @@ def valid_requests_and_expectations
134135
'content-type' => 'json'
135136
}
136137
end
138+
137139
it 'Makes requests and passes validation' do
138140
verify_request_stub
139141
count_request_stub
@@ -242,14 +244,33 @@ def valid_requests_and_expectations
242244
end
243245
end
244246

247+
context 'When the tagline is different' do
248+
let(:body) do
249+
{
250+
'version' => {
251+
'number' => '7.4.0',
252+
'build_flavor' => 'default'
253+
},
254+
'tagline' => 'You Know, for other stuff'
255+
}.to_json
256+
end
257+
258+
it 'Fails validation' do
259+
verify_request_stub
260+
count_request_stub
261+
262+
error_requests_and_expectations
263+
end
264+
end
265+
245266
context 'With a valid Elasticsearch response' do
246267
let(:body) do
247268
{
248269
'version' => {
249270
'number' => '7.4.0',
250271
'build_flavor' => 'default'
251272
},
252-
'tagline' => Elasticsearch::YOU_KNOW_FOR_SEARCH
273+
'tagline' => 'You Know, for Search'
253274
}.to_json
254275
end
255276

@@ -286,7 +307,7 @@ def valid_requests_and_expectations
286307
'version' => {
287308
'number' => '6.8.10'
288309
},
289-
'tagline' => Elasticsearch::YOU_KNOW_FOR_SEARCH
310+
'tagline' => 'You Know, for Search'
290311
}.to_json
291312
end
292313

@@ -310,6 +331,25 @@ def valid_requests_and_expectations
310331
error_requests_and_expectations
311332
end
312333
end
334+
335+
context 'When the tagline is different' do
336+
let(:body) do
337+
{
338+
'version' => {
339+
'number' => '6.8.10',
340+
'build_flavor' => 'default'
341+
},
342+
'tagline' => 'You Know, for Stuff'
343+
}.to_json
344+
end
345+
346+
it 'Fails validation' do
347+
verify_request_stub
348+
count_request_stub
349+
350+
error_requests_and_expectations
351+
end
352+
end
313353
end
314354

315355
context 'When Elasticsearch version is between 7.0.0 and 7.14.0' do
@@ -320,7 +360,7 @@ def valid_requests_and_expectations
320360
'number' => '7.10.0',
321361
'build_flavor' => 'default'
322362
},
323-
'tagline' => Elasticsearch::YOU_KNOW_FOR_SEARCH
363+
'tagline' => 'You Know, for Search'
324364
}.to_json
325365
end
326366

@@ -350,13 +390,32 @@ def valid_requests_and_expectations
350390
end
351391
end
352392

393+
context 'When the tagline is different' do
394+
let(:body) do
395+
{
396+
'version' => {
397+
'number' => '7.10.0',
398+
'build_flavor' => 'default'
399+
},
400+
'tagline' => 'You Know, for other stuff'
401+
}.to_json
402+
end
403+
404+
it 'Fails validation' do
405+
verify_request_stub
406+
count_request_stub
407+
408+
error_requests_and_expectations
409+
end
410+
end
411+
353412
context 'When the build_flavor is not present' do
354413
let(:body) do
355414
{
356415
'version' => {
357416
'number' => '7.10.0'
358417
},
359-
'tagline' => Elasticsearch::YOU_KNOW_FOR_SEARCH
418+
'tagline' => 'You Know, for Search'
360419
}.to_json
361420
end
362421

0 commit comments

Comments
 (0)