Skip to content

Commit 3b79d68

Browse files
committed
[API] Adds manual integration tests for free test suite
To have better control over tests and reimplement ones which need very specific conditions so are skipped in the YAML test runner. In particular health report is migrated to this new setup. These will go away once we migrate to the new client yaml tests.
1 parent 811214a commit 3b79d68

File tree

4 files changed

+64
-3
lines changed

4 files changed

+64
-3
lines changed

elasticsearch-api/Rakefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,11 @@ namespace :test do
6767

6868
desc 'Run Platinum Integration Specs'
6969
RSpec::Core::RakeTask.new(:integration) do |t|
70-
exit(0) unless ENV['TEST_SUITE'] == 'platinum'
71-
72-
t.pattern = 'spec/platinum/integration/**/*_spec.rb'
70+
t.pattern = if ENV['TEST_SUITE'] == 'platinum'
71+
'spec/platinum/integration/**/*_spec.rb'
72+
else
73+
'spec/free/integration/**/*_spec.rb'
74+
end
7375
t.ruby_opts = '-W0'
7476
end
7577
end
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
# TODO: These tests won't be necessary once we migrate to the new YAML tests
18+
require_relative './spec_helper'
19+
20+
describe "Health basic test" do
21+
it 'performs the request' do
22+
response = CLIENT.health_report
23+
expect(response.status).to eq 200
24+
expect(response['cluster_name']).not_to be_nil
25+
expect(response.dig('indicators', 'master_is_stable', 'symptom')).to eq 'The cluster has a stable master node'
26+
expect(response.dig('indicators', 'master_is_stable', 'status')).to eq 'green'
27+
end
28+
end
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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 'elasticsearch'
18+
19+
host = ENV['TEST_ES_SERVER'] || 'http://localhost:9200'
20+
raise URI::InvalidURIError unless host =~ /\A#{URI::DEFAULT_PARSER.make_regexp}\z/
21+
22+
test_suite = ENV['TEST_SUITE'] || 'free'
23+
password = ENV['ELASTIC_PASSWORD'] || 'changeme'
24+
uri = URI.parse(host)
25+
transport_options = {}
26+
host = "http://elastic:#{password}@#{uri.host}:#{uri.port}".freeze
27+
28+
CLIENT = Elasticsearch::Client.new(host: host, transport_options: transport_options)

elasticsearch-api/spec/rest_api/skipped_tests_free.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,6 @@
4949
-
5050
:file: 'indices.resolve_cluster/10_basic_resolve_cluster.yml'
5151
:description: 'Resolve cluster using alias and index that does not exist'
52+
-
53+
:file: 'health/10_basic.yml' # Migrated to written manually
54+
:description: 'cluster health basic test'

0 commit comments

Comments
 (0)