diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e2c29dc2d2..c72072a437 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,7 +27,6 @@ jobs: - uses: elastic/elastic-github-actions/elasticsearch@master with: stack-version: 9.0.0-SNAPSHOT - security-enabled: false - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} @@ -40,4 +39,4 @@ jobs: - name: elasticsearch run: cd elasticsearch && bundle exec rake test:all - name: elasticsearch-api - run: rake es:download_artifacts[9.0.0-SNAPSHOT] && cd elasticsearch-api && bundle exec rake test:spec test:platinum:unit + run: rake es:download_artifacts[9.0.0-SNAPSHOT] && cd elasticsearch-api && bundle exec rake test:all diff --git a/.github/workflows/otel.yml b/.github/workflows/otel.yml index c78dea09d9..fd17c34acb 100644 --- a/.github/workflows/otel.yml +++ b/.github/workflows/otel.yml @@ -29,7 +29,6 @@ jobs: - uses: elastic/elastic-github-actions/elasticsearch@master with: stack-version: 9.0.0-SNAPSHOT - security-enabled: false - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} @@ -42,4 +41,4 @@ jobs: - name: elasticsearch run: cd elasticsearch && bundle exec rake test:all - name: elasticsearch-api - run: rake es:download_artifacts[9.0.0-SNAPSHOT] && cd elasticsearch-api && bundle exec rake test:spec test:platinum:unit + run: rake es:download_artifacts[9.0.0-SNAPSHOT] && cd elasticsearch-api && bundle exec rake test:all diff --git a/CHANGELOG-9.x.md b/CHANGELOG-9.x.md index c94e5aa0d6..ef1d09842f 100644 --- a/CHANGELOG-9.x.md +++ b/CHANGELOG-9.x.md @@ -21,4 +21,4 @@ The gem migrated away from the Elasticsearch REST API tests and test runner in C #### Rake tasks * Some old rake tasks that were not being used have been removed. The rest were streamlined, the `es` namespace has been streamlined to make it easier to run Elasticsearch with Docker during development. The `docker` namespace was merged into `es`. -* Elasticsearch's REST API Spec tests can still be ran with `rake test:es_free` and `rake test:es_platinum`. +* Elasticsearch's REST API Spec tests can still be ran with `rake test:deprecated:rest_api` and setting the corresponding value for the environment variable `TEST_SUITE` ('platinum' or 'free'). diff --git a/elasticsearch-api/Rakefile b/elasticsearch-api/Rakefile index 8903d68c92..1583729010 100644 --- a/elasticsearch-api/Rakefile +++ b/elasticsearch-api/Rakefile @@ -32,16 +32,10 @@ namespace :test do end desc 'Run unit tests' - task unit: :spec - RSpec::Core::RakeTask.new(:spec) do |t| - t.pattern = 'spec/elasticsearch/api/**/*_spec.rb' - t.exclude_pattern = 'spec/platinum/**/*_spec.rb' - end - - desc 'Run Elasticsearch test suite free tests.' - RSpec::Core::RakeTask.new(:rest_api) do |t| - test_dir = Rake.application.original_dir - t.pattern = "#{test_dir}/spec/rest_api/rest_api_yaml_spec.rb" + task :unit + RSpec::Core::RakeTask.new(:unit) do |t| + t.pattern = 'spec/unit/**/*_spec.rb' + t.ruby_opts = '-W0' end desc 'Run unit and integration tests' @@ -55,29 +49,23 @@ namespace :test do ruby './spec/yaml-test-runner/run.rb' end - namespace :platinum do - desc 'Run Platinum Rest API Spec tests' - RSpec::Core::RakeTask.new(:api) do - ENV['TEST_SUITE'] = 'platinum' - Rake::Task['test:rest_api'].invoke - end - - desc 'Run Platinum Unit tests - DEPRECATED: Will be migrated to RSpec' - Rake::TestTask.new(:unit) do |test| - test.libs << 'spec/platinum/unit' - test.test_files = FileList['spec/platinum/unit/**/*_test.rb'] - test.verbose = false - test.warning = false - end + desc 'Run Integration tests' + RSpec::Core::RakeTask.new(:integration) do |t| + t.pattern = 'spec/integration/**/*_spec.rb' + t.ruby_opts = '-W0' + end - desc 'Run Platinum Integration Specs' - RSpec::Core::RakeTask.new(:integration) do |t| - t.pattern = if ENV['TEST_SUITE'] == 'platinum' - 'spec/platinum/integration/**/*_spec.rb' - else - 'spec/free/integration/**/*_spec.rb' - end - t.ruby_opts = '-W0' + # This is the task to run the Elasticsearch REST tests which we stopped using for 9.x. + # Use the environment variable TEST_SUITE to choose between 'free' and 'platinum' tests. For + # platinum, the test cluster needs to have the license activated and run with security enabled. + # For 'free', security must be disabled in the test cluster. + # + namespace :deprecated do + # TODO: TEST_SUITE + desc 'Run Elasticsearch test suite free tests.' + RSpec::Core::RakeTask.new(:rest_api) do |t| + test_dir = Rake.application.original_dir + t.pattern = "#{test_dir}/spec/rest_api/rest_api_yaml_spec.rb" end end end diff --git a/elasticsearch-api/elasticsearch-api.gemspec b/elasticsearch-api/elasticsearch-api.gemspec index f576910773..b0376cb87d 100644 --- a/elasticsearch-api/elasticsearch-api.gemspec +++ b/elasticsearch-api/elasticsearch-api.gemspec @@ -48,12 +48,8 @@ Gem::Specification.new do |s| s.add_development_dependency 'bundler' s.add_development_dependency 'elasticsearch' s.add_development_dependency 'elasticsearch-test-runner' unless defined?(JRUBY_VERSION) && JRUBY_VERSION <= '9.4' - s.add_development_dependency 'minitest' - s.add_development_dependency 'minitest-reporters', '>= 1.6' - s.add_development_dependency 'mocha' s.add_development_dependency 'pry' s.add_development_dependency 'rake' - s.add_development_dependency 'shoulda-context' s.add_development_dependency 'yard' # Gems for testing integrations @@ -68,7 +64,6 @@ Gem::Specification.new do |s| s.add_development_dependency 'require-prof' unless defined?(JRUBY_VERSION) || defined?(Rubinius) s.add_development_dependency 'ruby-prof' unless defined?(JRUBY_VERSION) || defined?(Rubinius) s.add_development_dependency 'simplecov' - s.add_development_dependency 'test-unit', '~> 2' s.description = <<-DESC.gsub(/^ /, '') Ruby API for Elasticsearch. See the `elasticsearch` gem for full integration. DESC diff --git a/elasticsearch-api/spec/platinum/integration/api_key/admin_user_query_api_keys_spec.rb b/elasticsearch-api/spec/integration/api_key_spec.rb similarity index 64% rename from elasticsearch-api/spec/platinum/integration/api_key/admin_user_query_api_keys_spec.rb rename to elasticsearch-api/spec/integration/api_key_spec.rb index 5939b2ac2b..55c9d977af 100644 --- a/elasticsearch-api/spec/platinum/integration/api_key/admin_user_query_api_keys_spec.rb +++ b/elasticsearch-api/spec/integration/api_key_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Licensed to Elasticsearch B.V. under one or more contributor # license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright @@ -16,21 +18,21 @@ # under the License. require 'base64' -require_relative '../platinum_helper' +require_relative './spec_helper' describe 'API keys' do before do - ADMIN_CLIENT.security.put_user( + CLIENT.security.put_user( username: client_username, body: { password: 'test-password', roles: ['superuser'] } ) end after do - ADMIN_CLIENT.security.delete_user(username: client_username) + CLIENT.security.delete_user(username: client_username) end - let(:client_username) { "query_api_keys_#{Time.new.to_i}"} + let(:client_username) { "query_api_keys_#{Time.new.to_i}" } let(:credentials) { Base64.strict_encode64("#{client_username}:test-password") } let(:client) do @@ -41,71 +43,71 @@ end it 'queries API keys' do - key_name_1 = "query-key-1-#{Time.new.to_i}" + key_name1 = "query-key-1-#{Time.new.to_i}" response = client.security.create_api_key( body: { - name: key_name_1, + name: key_name1, role_descriptors: {}, - expiration: "1d", - metadata: { search: "this" } + expiration: '1d', + metadata: { search: 'this' } } ) - expect(response['name']).to eq key_name_1 + expect(response['name']).to eq key_name1 expect(response['api_key']).not_to be nil - api_key_id_1 = response['id'] + api_key_id1 = response['id'] - key_name_2 = "query-key-2-#{Time.new.to_i}" + key_name2 = "query-key-2-#{Time.new.to_i}" response = client.security.create_api_key( body: { - name: key_name_2, - expiration: "2d", - role_descriptors: { "role-a" => { "cluster": [ "monitor"] } }, + name: key_name2, + expiration: '2d', + role_descriptors: { 'role-a' => { "cluster": ['monitor'] } }, metadata: { search: false } } ) - expect(response['name']).to eq key_name_2 + expect(response['name']).to eq key_name2 expect(response['api_key']).not_to be nil - api_key_id_2 = response['id'] + api_key_id2 = response['id'] - key_name_3 = "query-key-3#{Time.new.to_i}" + key_name3 = "query-key-3#{Time.new.to_i}" response = client.security.create_api_key( body: { - name: key_name_3, - expiration: "3d", + name: key_name3, + expiration: '3d' } ) - expect(response['name']).to eq key_name_3 + expect(response['name']).to eq key_name3 expect(response['api_key']).not_to be nil - api_key_id_3 = response['id'] + api_key_id3 = response['id'] response = client.security.authenticate - owner_name = response['username'] + response['username'] response = client.security.query_api_keys( body: { - query: { wildcard: { name: key_name_1 }} + query: { wildcard: { name: key_name1 } } } ) expect(response['total']).to eq 1 expect(response['count']).to eq 1 - expect(response['api_keys'].first['id']).to eq api_key_id_1 + expect(response['api_keys'].first['id']).to eq api_key_id1 response = client.security.query_api_keys( body: { - query: { wildcard: { name: key_name_2 }} + query: { wildcard: { name: key_name2 } } } ) expect(response['total']).to eq 1 expect(response['count']).to eq 1 - expect(response['api_keys'].first['id']).to eq api_key_id_2 + expect(response['api_keys'].first['id']).to eq api_key_id2 response = client.security.query_api_keys( body: { - query: { wildcard: { name: key_name_3 }} + query: { wildcard: { name: key_name3 } } } ) expect(response['total']).to eq 1 expect(response['count']).to eq 1 - expect(response['api_keys'].first['id']).to eq api_key_id_3 + expect(response['api_keys'].first['id']).to eq api_key_id3 end end diff --git a/elasticsearch-api/spec/platinum/integration/health/health_spec.rb b/elasticsearch-api/spec/integration/health_spec.rb similarity index 67% rename from elasticsearch-api/spec/platinum/integration/health/health_spec.rb rename to elasticsearch-api/spec/integration/health_spec.rb index eefa5f6237..8abad8dcc7 100644 --- a/elasticsearch-api/spec/platinum/integration/health/health_spec.rb +++ b/elasticsearch-api/spec/integration/health_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Licensed to Elasticsearch B.V. under one or more contributor # license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright @@ -15,12 +17,20 @@ # specific language governing permissions and limitations # under the License. -require_relative '../platinum_helper' +require_relative './spec_helper' + +describe 'Health basic test' do + it 'performs the request' do + response = CLIENT.health_report + expect(response.status).to eq 200 + expect(response['cluster_name']).not_to be_nil + expect(response.dig('indicators', 'master_is_stable', 'symptom')).to eq 'The cluster has a stable master node' + expect(response.dig('indicators', 'master_is_stable', 'status')).to eq 'green' + end -describe 'Health API' do context 'Usage stats on the health API' do before do - ADMIN_CLIENT.indices.create( + CLIENT.indices.create( index: 'red_index', body: { settings: { @@ -33,13 +43,13 @@ end after do - ADMIN_CLIENT.indices.delete(index: 'red_index') + CLIENT.indices.delete(index: 'red_index') end it 'responds with health report' do - expect(ADMIN_CLIENT.health_report.status).to eq 200 - expect(ADMIN_CLIENT.health_report(feature: 'disk').status).to eq 200 - response = ADMIN_CLIENT.xpack.usage + expect(CLIENT.health_report.status).to eq 200 + expect(CLIENT.health_report(feature: 'disk').status).to eq 200 + response = CLIENT.xpack.usage expect(response['health_api']['available']).to eq true expect(response['health_api']['enabled']).to eq true expect(response['health_api']['invocations']['total']).to be >= 2 diff --git a/elasticsearch-api/spec/platinum/integration/platinum_helper.rb b/elasticsearch-api/spec/integration/spec_helper.rb similarity index 83% rename from elasticsearch-api/spec/platinum/integration/platinum_helper.rb rename to elasticsearch-api/spec/integration/spec_helper.rb index d74421d63a..343f1dc4a8 100644 --- a/elasticsearch-api/spec/platinum/integration/platinum_helper.rb +++ b/elasticsearch-api/spec/integration/spec_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Licensed to Elasticsearch B.V. under one or more contributor # license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright @@ -14,13 +16,11 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. - require 'openssl' require 'elasticsearch' -CERTS_PATH = File.expand_path('./../.buildkite/certs') - -host = ENV['TEST_ES_SERVER'] || 'https://localhost:9200' +CERTS_PATH = File.expand_path('./../../../.buildkite/certs', __dir__) +host = ENV['TEST_ES_SERVER'] || 'http://localhost:9200' raise URI::InvalidURIError unless host =~ /\A#{URI::DEFAULT_PARSER.make_regexp}\z/ password = ENV['ELASTIC_PASSWORD'] || 'changeme' @@ -31,12 +31,11 @@ key = OpenSSL::PKey::RSA.new(raw_key) ca_file = File.expand_path("#{CERTS_PATH}/ca.crt") TRANSPORT_OPTIONS = { ssl: { verify: false, client_cert: certificate, client_key: key, ca_file: ca_file } } -HOST = "https://elastic:#{password}@#{HOST_URI.host}:#{HOST_URI.port}".freeze - -ADMIN_CLIENT = Elasticsearch::Client.new(host: HOST, transport_options: TRANSPORT_OPTIONS) +HOST = "https://elastic:#{password}@#{HOST_URI.host}:#{HOST_URI.port}" +CLIENT = Elasticsearch::Client.new(host: HOST, transport_options: TRANSPORT_OPTIONS) RSpec.configure do |config| config.add_formatter('documentation') - config.add_formatter('RSpec::Core::Formatters::HtmlFormatter', "tmp/platinum-#{ENV['RUBY_VERSION']}-manual-integration.html") + config.add_formatter('RSpec::Core::Formatters::HtmlFormatter', "tmp/#{ENV['RUBY_VERSION']}-manual-integration.html") config.color_mode = :on end diff --git a/elasticsearch-api/spec/platinum/integration/analytics/usage_spec.rb b/elasticsearch-api/spec/platinum/integration/analytics/usage_spec.rb deleted file mode 100644 index 2f88973d9e..0000000000 --- a/elasticsearch-api/spec/platinum/integration/analytics/usage_spec.rb +++ /dev/null @@ -1,56 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require_relative '../platinum_helper' - -describe 'analytics/usage stats API' do - let(:index) { 'analytics_test' } - before do - body = [ - {"index": {}}, - {"timestamp": "2017-01-01T05:00:00Z", "s": 1, "v1": 3.1415, "v2": 2.1415, "str": "a"}, - {"index": {}}, - {"timestamp": "2017-01-01T05:00:00Z", "s": 2, "v1": 1.0, "v2": 2.0, "str": "a"}, - {"index": {}}, - {"timestamp": "2017-01-01T05:00:00Z", "s": 3, "v1": 2.71828, "v2": 3.71828, "str": "b"}, - ] - ADMIN_CLIENT.bulk(body: body, index: index, refresh: true) - end - - after do - ADMIN_CLIENT.indices.delete(index: index) - end - - it 'gets memory for all nodes' do - response = ADMIN_CLIENT.xpack.usage - expect(response['analytics']['available']).to eq true - expect(response['analytics']['enabled']).to eq true - - boxplot_usage = response['analytics']['stats']['boxplot_usage'] - - response = ADMIN_CLIENT.search( - index: index, - body: { size: 0, aggs: { plot: { boxplot: { field: 's' } } } } - ) - expect(response['aggregations']['plot']['q2']).to eq 2.0 - - response = ADMIN_CLIENT.xpack.usage - expect(response['analytics']['available']).to eq true - expect(response['analytics']['enabled']).to eq true - expect(response['analytics']['stats']['boxplot_usage']).to be > boxplot_usage - end -end diff --git a/elasticsearch-api/spec/platinum/integration/api_key/api_key_admin_user_spec.rb b/elasticsearch-api/spec/platinum/integration/api_key/api_key_admin_user_spec.rb deleted file mode 100644 index b5ca398a5e..0000000000 --- a/elasticsearch-api/spec/platinum/integration/api_key/api_key_admin_user_spec.rb +++ /dev/null @@ -1,127 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'base64' -require_relative '../platinum_helper' - -describe 'API keys' do - before do - ADMIN_CLIENT.security.put_user( - username: client_username, - body: { password: 'test-password', roles: ['superuser'] } - ) - end - - after do - ADMIN_CLIENT.security.delete_user(username: client_username) - end - - let(:client_username) { "superuser#{Time.now.to_i}"} - - let(:client) do - Elasticsearch::Client.new( - host: "https://#{HOST_URI.host}:#{HOST_URI.port}", - user: client_username, - password: 'test-password', - transport_options: TRANSPORT_OPTIONS - ) - end - - it 'gets api key (with role descriptors + metadata)' do - response = client.security.create_api_key( - body: { - name: "api-key-role", - expiration: "1d", - role_descriptors: { - 'role-a': { - cluster: ["all"], - index: [ - { - names: ["index-a"], - privileges: ["read"] - } - ] - } - }, - metadata: { - string: "bean", - number: 5, - boolean: true - } - } - ) - expect(response['name']).to eq 'api-key-role' - expect(response['id']).not_to be nil - expect(response['api_key']).not_to be nil - expect(response['expiration']).not_to be nil - api_key_id = response['id'] - api_key_name = response['name'] - credentials = response['encoded'] - - response = client.security.authenticate - owner_name = response['username'] - - response = client.security.get_api_key(id: api_key_id) - expect(response['api_keys'].first['id']).to eq api_key_id - expect(response['api_keys'].first['name']).to eq api_key_name - expect(response['api_keys'].first['username']).to eq owner_name - expect(response['api_keys'].first['invalidated']).to eq false - expect(response['api_keys'].first['creation']).not_to be nil - expect(response['api_keys'].first['metadata']['string']).to eq 'bean' - expect(response['api_keys'].first['metadata']['number']).to eq 5 - expect(response['api_keys'].first['metadata']['boolean']).to eq true - expect(response['api_keys'].first['role_descriptors']) - .to eq( - { - 'role-a' => { - 'cluster' => ['all'], - 'indices' => [ - { - 'names' => ['index-a'], - 'privileges' => ['read'], - 'allow_restricted_indices' => false - } - ], - 'applications' => [ ], - 'run_as' => [ ], - 'metadata' => { }, - 'transient_metadata' => { 'enabled' => true } - } - } - ) - - response = client.security.get_api_key(owner: true) - expect(response['api_keys'].length).to eq 1 - expect(response['api_keys'].first['id']).to eq api_key_id - expect(response['api_keys'].first['name']).to eq api_key_name - expect(response['api_keys'].first['username']).to eq owner_name - expect(response['api_keys'].first['invalidated']).to eq false - expect(response['api_keys'].first['creation']).not_to be nil - - client = Elasticsearch::Client.new( - host: "https://#{HOST_URI.host}:#{HOST_URI.port}", - api_key: credentials, - transport_options: TRANSPORT_OPTIONS - ) - - response = client.security.get_api_key(id: api_key_id) - expect(response['api_keys'].length).to eq 1 - expect(response['api_keys'].first['id']).to eq api_key_id - expect(response['api_keys'].first['name']).to eq api_key_name - expect(response['api_keys'].first['username']).to eq owner_name - end -end diff --git a/elasticsearch-api/spec/platinum/integration/api_key/api_key_cross_cluster_spec.rb b/elasticsearch-api/spec/platinum/integration/api_key/api_key_cross_cluster_spec.rb deleted file mode 100644 index 5b1ee7e7f7..0000000000 --- a/elasticsearch-api/spec/platinum/integration/api_key/api_key_cross_cluster_spec.rb +++ /dev/null @@ -1,113 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'base64' -require_relative '../platinum_helper' - -describe 'API keys API' do - let(:user) { 'admin_user' } - let(:password) { 'x-pack-test-password' } - before do - ADMIN_CLIENT.security.put_role( - name: 'admin_role', - body: { cluster: ['manage_security'] } - ) - ADMIN_CLIENT.security.put_user( - username: user, - body: { - password: password, - roles: ['admin_role'], - full_name: 'Admin user' - } - ) - end - - after do - ADMIN_CLIENT.security.delete_role(name: 'admin_role', ignore: 404) - ADMIN_CLIENT.security.delete_user(username: user, ignore: 404) - end - - describe 'Cross Cluster API Key' do - it 'updates api key' do - response = ADMIN_CLIENT.security.create_cross_cluster_api_key( - body: { - name: 'my-cc-api-key', - expiration: '1d', - access: { - search: [ - { names: ['logs*'] } - ], - replication: [ - { - names: ['archive'], - allow_restricted_indices: false - } - ] - }, - metadata: { - answer: 42, - tag: 'dev' - } - } - ) - expect(response.status).to eq 200 - expect(response['name']).to eq 'my-cc-api-key' - id = response['id'] - expect(id).not_to be nil - expect(response['api_key']).not_to be nil - expect(response['expiration']).not_to be nil - credentials = Base64.strict_encode64("#{response['id']}:#{response['api_key']}") - expect(credentials).to eq response['encoded'] - - new_client = Elasticsearch::Client.new( - host: "https://#{HOST_URI.host}:#{HOST_URI.port}", - transport_options: TRANSPORT_OPTIONS - ) - expect do - new_client.security.authenticate(headers: { authorization: "ApiKey #{credentials}" }) - end.to raise_error(Elastic::Transport::Transport::Errors::Unauthorized) - - response = ADMIN_CLIENT.security.get_api_key(id: id, with_limited_by: true) - expect(response.status).to eq 200 - api_key = response['api_keys'].first - expect(api_key['name']) == 'my-cc-api-key' - expect(api_key['type']) == 'cross_cluster' - expect(api_key['invalidated']).to be false - expect(api_key['metadata']).to eq({'answer' => 42, 'tag' => 'dev'}) - - # Tests update cc api_key - response = ADMIN_CLIENT.security.update_cross_cluster_api_key( - id: id, - body: { - access: { - replication: [{ names: ["archive"] }] - }, - metadata: { "tag": "prod" } - } - ) - expect(response['updated']).to be true - - response = ADMIN_CLIENT.security.get_api_key(id: id, with_limited_by: true) - expect(response['api_keys'].length).to eq 1 - api_key = response['api_keys'].first - expect(api_key['name']) == 'my-cc-api-key' - expect(api_key['type']) == 'cross_cluster' - expect(api_key['invalidated']).to be false - expect(api_key['metadata']).to eq({'tag' => 'prod'}) - end - end -end diff --git a/elasticsearch-api/spec/platinum/integration/api_key/api_key_invalidation_spec.rb b/elasticsearch-api/spec/platinum/integration/api_key/api_key_invalidation_spec.rb deleted file mode 100644 index 5464412f4d..0000000000 --- a/elasticsearch-api/spec/platinum/integration/api_key/api_key_invalidation_spec.rb +++ /dev/null @@ -1,105 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'base64' -require_relative '../platinum_helper' - -describe 'API keys API invalidation' do - before do - ADMIN_CLIENT.security.put_role( - name: 'admin_role', - body: { - cluster: ['manage_api_key'] - } - ) - ADMIN_CLIENT.security.put_role( - name: 'user_role', - body: { - cluster: ['manage_own_api_key'] - } - ) - ADMIN_CLIENT.security.put_user( - username: 'api_key_manager', - body: { - password: 'changeme', - roles: [ 'admin_role' ], - full_name: 'API key manager' - } - ) - ADMIN_CLIENT.security.put_user( - username: 'api_key_test_user1', - body: { - password: 'x-pack-test-password', - roles: [ 'user_role' ], - full_name: 'API key user' - } - ) - end - - after do - ADMIN_CLIENT.security.delete_role(name: "admin_role", ignore: 404) - ADMIN_CLIENT.security.delete_role(name: "user_role", ignore: 404) - ADMIN_CLIENT.security.delete_user(username: "api_key_user1", ignore: 404) - ADMIN_CLIENT.security.delete_user(username: "api_key_manager", ignore: 404) - end - - let(:credentials) { Base64.strict_encode64("api_key_manager:changeme") } - - let(:client) do - Elasticsearch::Client.new( - host: HOST, - transport_options: TRANSPORT_OPTIONS.merge(headers: { Authorization: "Basic #{credentials}" }) - ) - end - - it 'invalidates by realm name' do - response = client.security.create_api_key( - body: { - name: "manager-api-key", - expiration: "1d", - role_descriptors: {} - } - ) - expect(response['name']).to eq 'manager-api-key' - id = response['id'] - expect(id).not_to be nil - expect(response['api_key']).not_to be nil - expect(response['expiration']).not_to be nil - - user_credentials = Base64.strict_encode64('api_key_test_user1:x-pack-test-password') - user_client = Elasticsearch::Client.new( - host: HOST, - transport_options: TRANSPORT_OPTIONS.merge(headers: { Authentication: "Basic #{user_credentials}" }) - ) - response = user_client.security.create_api_key( - body: { - name: "user1-api-key", - expiration: "1d", - role_descriptors: {} - } - ) - expect(response['name']).to eq 'user1-api-key' - id = response['id'] - expect(id).not_to be nil - expect(response['api_key']).not_to be nil - expect(response['expiration']).not_to be nil - - response = client.security.invalidate_api_key(body: { realm_name: 'default_native'}) - expect(response['invalidated_api_keys'].count).to be >= 2 - expect(response['error_count']).to eq 0 - end -end diff --git a/elasticsearch-api/spec/platinum/integration/api_key/api_key_query_spec.rb b/elasticsearch-api/spec/platinum/integration/api_key/api_key_query_spec.rb deleted file mode 100644 index 238d1aa4bb..0000000000 --- a/elasticsearch-api/spec/platinum/integration/api_key/api_key_query_spec.rb +++ /dev/null @@ -1,149 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require_relative '../platinum_helper' - -describe 'API keys' do - before do - ADMIN_CLIENT.security.put_role( - name: 'admin_role', - body: { cluster: ['manage_api_key'] } - ) - ADMIN_CLIENT.security.put_role( - name: 'user_role', - body: { - cluster: ['manage_own_api_key'], - } - ) - ADMIN_CLIENT.security.put_user( - username: 'api_key_manager', - body: { - password: 'x-pack-test-password', - roles: [ 'admin_role' ], - full_name: 'API key manager' - } - ) - ADMIN_CLIENT.security.put_user( - username: 'api_key_user_1', - body: { - password: 'x-pack-test-password', - roles: [ 'user_role' ], - full_name: 'API key user 1' - } - ) - ADMIN_CLIENT.security.put_user( - username: 'api_key_user_2', - body: { - password: 'x-pack-test-password', - roles: [ 'user_role' ], - full_name: 'API key user 2' - } - ) - end - - after do - ADMIN_CLIENT.security.delete_role(name: "admin_role", ignore: 404) - ADMIN_CLIENT.security.delete_role(name: "user_role", ignore: 404) - ADMIN_CLIENT.security.delete_user(username: "api_key_user_1", ignore: 404) - ADMIN_CLIENT.security.delete_user(username: "api_key_user_2", ignore: 404) - ADMIN_CLIENT.security.delete_user(username: "api_key_manager", ignore: 404) - end - - def client(headers) - Elasticsearch::Client.new( - host: "https://#{HOST_URI.host}:#{HOST_URI.port}", - transport_options: TRANSPORT_OPTIONS.merge(headers: headers) - ) - end - - let(:manager_auth) do - { Authorization: "Basic YXBpX2tleV9tYW5hZ2VyOngtcGFjay10ZXN0LXBhc3N3b3Jk" } - end - let(:user1_auth) do - { Authorization: "Basic YXBpX2tleV91c2VyXzE6eC1wYWNrLXRlc3QtcGFzc3dvcmQ=" } - end - let(:user2_auth) do - { Authorization: "Basic YXBpX2tleV91c2VyXzI6eC1wYWNrLXRlc3QtcGFzc3dvcmQ=" } - end - - it 'queries api key' do - # api_key_manager authorization: - client = client(manager_auth) - response = client.security.create_api_key( - body: { - name: 'manager-api-key', - expiration: '10d', - metadata: { - letter: 'a', - number: 42 - } - } - ) - expect(response.status).to eq 200 - manager_key_id = response['id'] - - # api_key_user1 authorization: - client = client(user1_auth) - response = client.security.create_api_key( - body: { - name: 'user1-api-key', - expiration: '1d', - metadata: { - letter: 'a', - number: 1 - } - } - ) - expect(response.status).to eq 200 - user1_key_id = response['id'] - - # api_key_user2 authorization - client = client(user2_auth) - response = client.security.create_api_key( - body: { - name: 'user2-api-key', - expiration: '1d', - metadata: { - letter: 'b', - number: 42 - } - } - ) - expect(response.status).to eq 200 - user1_key_id = response['id'] - - client = client(manager_auth) - response = client.security.query_api_keys - expect(response.status).to eq 200 - manager_total = response['total'] - expect(manager_total).to be >= 3 - - client = client(user1_auth) - response = client.security.query_api_keys - expect(response.status).to eq 200 - user_1_total = response['total'] - expect(user_1_total).to be >= 1 - expect(user_1_total).to be < manager_total - - client = client(user2_auth) - response = client.security.query_api_keys - expect(response.status).to eq 200 - user_2_total = response['total'] - expect(user_2_total).to be >= 1 - expect(user_2_total).to be < manager_total - end -end diff --git a/elasticsearch-api/spec/platinum/integration/api_key/api_key_query_with_aggs_spec.rb b/elasticsearch-api/spec/platinum/integration/api_key/api_key_query_with_aggs_spec.rb deleted file mode 100644 index c17120d444..0000000000 --- a/elasticsearch-api/spec/platinum/integration/api_key/api_key_query_with_aggs_spec.rb +++ /dev/null @@ -1,120 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require_relative '../platinum_helper' - -describe 'API keys' do - before do - ADMIN_CLIENT.security.put_role( - name: 'admin_role', - body: { cluster: ['manage_api_key'] } - ) - ADMIN_CLIENT.security.put_role( - name: 'user_role', - body: { - cluster: ['manage_own_api_key'], - } - ) - ADMIN_CLIENT.security.put_user( - username: 'api_key_manager', - body: { - password: 'x-pack-test-password', - roles: [ 'admin_role' ], - full_name: 'API key manager' - } - ) - - ADMIN_CLIENT.security.put_user( - username: 'api_key_user', - body: { - password: 'x-pack-test-password', - roles: [ 'user_role' ], - full_name: 'API key user' - } - ) - end - after do - ADMIN_CLIENT.security.delete_role(name: "admin_role", ignore: 404) - ADMIN_CLIENT.security.delete_role(name: "user_role", ignore: 404) - ADMIN_CLIENT.security.delete_user(username: "api_key_user", ignore: 404) - ADMIN_CLIENT.security.delete_user(username: "api_key_manager", ignore: 404) - end - - def client(headers) - Elasticsearch::Client.new( - host: "https://#{HOST_URI.host}:#{HOST_URI.port}", - transport_options: TRANSPORT_OPTIONS.merge(headers: headers) - ) - end - - let(:manager_auth) do - { Authorization: "Basic YXBpX2tleV9tYW5hZ2VyOngtcGFjay10ZXN0LXBhc3N3b3Jk" } - end - let(:user_auth) do - { Authorization: "Basic YXBpX2tleV9tYW5hZ2VyOngtcGFjay10ZXN0LXBhc3N3b3Jk" } - end - - it 'queries api key with args' do - # api_key_manager authorization: - client = client(manager_auth) - response = client.security.create_api_key( - body: { - name: 'manager-api-key', - expiration: '10d', - metadata: { - letter: 'a', - number: 42 - } - } - ) - expect(response.status).to eq 200 - id = response['id'] - api_key = response['api_key'] - expect(response['encoded']).to eq Base64.strict_encode64("#{id}:#{api_key}") - - client = client(user_auth) - response = client.security.create_api_key( - body: { - name: 'user-api-key', - expiration: '1d', - metadata: { - letter: 'a', - number: 1 - } - } - ) - expect(response.status).to eq 200 - id = response['id'] - api_key = response['api_key'] - expect(response['encoded']).to eq Base64.strict_encode64("#{id}:#{api_key}") - - response = client.security.query_api_keys( - body: { - size: 0, - aggs: { - my_buckets: { - composite: { - sources: [{ key_name: { terms: { field: "name" } } } ] - } - } - } - } - ) - expect(response.dig('aggregations', 'my_buckets', 'buckets').find { |a| a.dig('key', 'key_name') == 'manager-api-key'}) - expect(response.dig('aggregations', 'my_buckets', 'buckets').find { |a| a.dig('key', 'key_name') == 'user-api-key'}) - end -end diff --git a/elasticsearch-api/spec/platinum/integration/api_key/api_key_spec.rb b/elasticsearch-api/spec/platinum/integration/api_key/api_key_spec.rb deleted file mode 100644 index 8b5c829f32..0000000000 --- a/elasticsearch-api/spec/platinum/integration/api_key/api_key_spec.rb +++ /dev/null @@ -1,156 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'base64' -require_relative '../platinum_helper' - -describe 'API keys' do - before do - ADMIN_CLIENT.security.put_role( - name: 'admin_role', - body: { - cluster: ['manage_api_key'], - indices: [ - { - names: '*', - privileges: ['all'] - } - ], - applications: [ - { - application: 'myapp', - privileges: ['*'], - resources: ['*'] - } - ] - } - ) - ADMIN_CLIENT.security.put_user( - username: 'api_key_user', - body: { - password: 'test-password', - roles: [ 'admin_role' ], - full_name: 'API key user' - } - ) - ADMIN_CLIENT.security.put_privileges( - body: - { - myapp: { - read: { - application: 'myapp', - name: 'read', - actions: [ 'data:read/*' ] - }, - write: { - application: 'myapp', - name: 'write', - actions: [ 'data:write/*' ] - } - } - } - ) - end - - after do - ADMIN_CLIENT.security.delete_role(name: "admin_role", ignore: 404) - ADMIN_CLIENT.security.delete_user(username: "api_key_user", ignore: 404) - ADMIN_CLIENT.security.delete_privileges(application: 'myapp', name: "read,write", ignore: 404) - end - - let(:credentials) { Base64.strict_encode64("api_key_user:test-password") } - let(:client) do - Elasticsearch::Client.new( - host: HOST, - transport_options: TRANSPORT_OPTIONS.merge(headers: { Authorization: "Basic #{credentials}" }) - ) - end - - it 'creates api key' do - response = client.security.create_api_key( - body: { - name: "my-api-key", - expiration: "1d", - role_descriptors: { - 'role-a' => { - cluster: ["all"], - index: [ - { - names: ["index-a"], - privileges: ["read"] - } - ] - }, - 'role-b' => { - cluster: ["manage"], - index: [ - { - names: ["index-b"], - privileges: ["all"] - } - ] - } - } - } - ) - expect(response['name']).to eq 'my-api-key' - id = response['id'] - expect(id).not_to be nil - expect(response['api_key']).not_to be nil - expect(response['expiration']).not_to be nil - credentials = Base64.strict_encode64("#{response['id']}:#{response['api_key']}") - expect(credentials).to eq response['encoded'] - new_client = Elasticsearch::Client.new( - host: "https://#{HOST_URI.host}:#{HOST_URI.port}", - transport_options: TRANSPORT_OPTIONS, - api_key: credentials - ) - response = new_client.security.authenticate - expect(response['username']).to eq 'api_key_user' - expect(response['roles'].length).to eq 0 - expect(response['authentication_realm']['name']).to eq '_es_api_key' - expect(response['authentication_realm']['type']).to eq '_es_api_key' - expect(response['api_key']['id']).to eq id - expect(response['api_key']['name']).to eq 'my-api-key' - response = ADMIN_CLIENT.security.clear_api_key_cache(ids: id) - expect(response['_nodes']['failed']).to eq 0 - end - - context 'Test get api key' do - let(:name) { 'my-api-key-2'} - - it 'gets api key' do - response = ADMIN_CLIENT.security.create_api_key( - body: { name: name, expiration: '1d' } - ) - expect(response['name']).to eq name - id = response['id'] - expect(id).not_to be nil - expect(response['api_key']).not_to be nil - expect(response['expiration']).not_to be nil - - response = ADMIN_CLIENT.security.get_api_key(id: id) - expect(response['api_keys'].first['id']).to eq id - expect(response['api_keys'].first['name']).to eq name - expect(response['api_keys'].first['username']).to eq 'elastic' - expect(response['api_keys'].first['invalidated']).to eq false - expect(response['api_keys'].first['creation']).not_to be nil - response = ADMIN_CLIENT.security.get_api_key(owner: true) - expect(response['api_keys'].length).to be > 0 - end - end -end diff --git a/elasticsearch-api/spec/platinum/integration/api_key/api_key_update_spec.rb b/elasticsearch-api/spec/platinum/integration/api_key/api_key_update_spec.rb deleted file mode 100644 index f37eeae8fe..0000000000 --- a/elasticsearch-api/spec/platinum/integration/api_key/api_key_update_spec.rb +++ /dev/null @@ -1,134 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'base64' -require_relative '../platinum_helper' - -describe 'API keys API' do - before do - ADMIN_CLIENT.security.put_role( - name: 'user_role', - body: { - cluster: ['manage_own_api_key'], - indices: [ - { - names: '*', - privileges: ['all'] - } - ] - } - ) - ADMIN_CLIENT.security.put_user( - username: 'api_key_user_1', - body: { - password: 'x-pack-test-password', - roles: [ 'user_role' ], - full_name: 'API key user 1' - } - ) - end - - after do - ADMIN_CLIENT.security.delete_role(name: "user_role", ignore: 404) - ADMIN_CLIENT.security.delete_user(username: "api_key_user_1", ignore: 404) - end - - let(:client) do - Elasticsearch::Client.new( - host: "https://#{HOST_URI.host}:#{HOST_URI.port}", - transport_options: TRANSPORT_OPTIONS.merge( - headers: { Authorization: "Basic YXBpX2tleV91c2VyXzE6eC1wYWNrLXRlc3QtcGFzc3dvcmQ=" } - ) - ) - end - - it 'updates api key' do - response = client.security.create_api_key( - body: { - name: 'user1-api-key', - role_descriptors: { - "role-a" => { - cluster: ["none"], - index: [ - { - names: ["index-a"], - privileges: ["read"] - } - ] - } - } - } - ) - expect(response.status).to eq 200 - expect(response['name']).to eq 'user1-api-key' - id = response['id'] - expect(id).not_to be nil - expect(response['api_key']).not_to be nil - credentials = Base64.strict_encode64("#{response['id']}:#{response['api_key']}") - expect(credentials).to eq response['encoded'] - - new_client = Elasticsearch::Client.new( - host: "https://#{HOST_URI.host}:#{HOST_URI.port}", - transport_options: TRANSPORT_OPTIONS, - api_key: credentials - ) - privileges_body = { - cluster: ['manage_own_api_key'], - index: [ - { - names: ['index-a'], - privileges: ['write'] - }, - { - names: ['index-b'], - privileges: ['read'] - } - ] - } - response = new_client.security.has_privileges(body: privileges_body) - expect(response['has_all_requested']).to eq false - - response = client.security.update_api_key( - id: id, - body: { - role_descriptors: { - "role-a" => { - cluster: ["all"], - index: [ - { - names: ["index-a"], - privileges: ["write"] - }, - { - names: ["index-b"], - privileges: ["read"] - } - ] - } - }, - metadata: { - letter: "a", - number: 42 - } - } - ) - expect(response['updated']).to eq true - - response = new_client.security.has_privileges(user: nil, body: privileges_body) - expect(response['has_all_requested']).to eq true - end -end diff --git a/elasticsearch-api/spec/platinum/integration/eql/eql_async_spec.rb b/elasticsearch-api/spec/platinum/integration/eql/eql_async_spec.rb deleted file mode 100644 index 9149a1c3b6..0000000000 --- a/elasticsearch-api/spec/platinum/integration/eql/eql_async_spec.rb +++ /dev/null @@ -1,72 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require_relative '../platinum_helper' - -describe 'eql/Executes async EQL with missing events' do - let(:index) { 'eql_test_m' } - before do - ADMIN_CLIENT.indices.create( - index: index, - body: { - mappings: { - properties: { - '@timestamp' => { type: 'date' }, - 'event.category' => { type: 'keyword' }, - user: { type: 'keyword' } - } - } - } - ) - ADMIN_CLIENT.bulk( - refresh: true, - body: [ - { index: { _index: 'eql_test_m', _id: '1' } }, - { event: [{ category: 'process' }], '@timestamp' => '2023-07-11T11:09:05.529Z', user: 'foo' }, - { index: { _index: 'eql_test_m', _id: '2'} }, - { event: [{ category: 'process' }], '@timestamp' => '2023-07-11T11:09:06.529Z', user: 'bar' } - ] - ) - end - - after do - ADMIN_CLIENT.indices.delete(index: index) - end - - it 'Executes async EQL with missing events' do - response = ADMIN_CLIENT.eql.search( - index: 'eql_test_m', - wait_for_completion_timeout: '0ms', - keep_on_completion: true, - body: { query: 'sequence with maxspan=24h [ process where true ] ![ process where true ]' } - ) - expect(response.status).to eq 200 - expect(response['id']).not_to be_nil - id = response['id'] - - response = ADMIN_CLIENT.eql.get(id: id, wait_for_completion_timeout: '10s') - expect(response.status).to eq 200 - expect(response['is_running']).to be false - expect(response['is_partial']).to be false - expect(response['timed_out']).to be false - expect(response['hits']['total']['value']).to eq 1 - expect(response['hits']['total']['relation']).to eq 'eq' - expect(response['hits']['total']['relation']).to eq 'eq' - expect(response['hits']['sequences'].first['events'].first['_source']['user']).to eq 'bar' - expect(response['hits']['sequences'].first['events'].last['missing']).to be true - end -end diff --git a/elasticsearch-api/spec/platinum/integration/ml/get_memory_stats_spec.rb b/elasticsearch-api/spec/platinum/integration/ml/get_memory_stats_spec.rb deleted file mode 100644 index a2932733f6..0000000000 --- a/elasticsearch-api/spec/platinum/integration/ml/get_memory_stats_spec.rb +++ /dev/null @@ -1,47 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require_relative '../platinum_helper' - -describe 'ML/Get Memory Stats API' do - it 'gets memory for all nodes' do - response = ADMIN_CLIENT.ml.get_memory_stats - expect(response.status).to eq 200 - expect(response['cluster_name']).not_to be_nil - expect(response['_nodes']['total']).to be >= 1 - expect(response['nodes'].first[1]['mem']['total_in_bytes']).to be > 1 - end - - it 'gets memory for ML nodes' do - response = ADMIN_CLIENT.ml.get_memory_stats - expect(response.status).to eq 200 - expect(response['cluster_name']).not_to be_nil - expect(response['nodes'].first[1]['mem']['total_in_bytes']).to be > 1 - end - - it 'gets memory for specific node' do - response = ADMIN_CLIENT.ml.get_memory_stats - expect(response.status).to eq 200 - node_id = response['nodes'].keys.first - - response = ADMIN_CLIENT.ml.get_memory_stats(node_id: node_id, timeout: '29s') - expect(response.status).to eq 200 - expect(response['cluster_name']).not_to be_nil - expect(response['nodes'].first[1]['mem']['total_in_bytes']).to be > 1 - expect(response['_nodes']['total']).to be 1 - end -end diff --git a/elasticsearch-api/spec/platinum/integration/security/users_query_spec.rb b/elasticsearch-api/spec/platinum/integration/security/users_query_spec.rb deleted file mode 100644 index 8eaf047410..0000000000 --- a/elasticsearch-api/spec/platinum/integration/security/users_query_spec.rb +++ /dev/null @@ -1,49 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require_relative '../platinum_helper' - -describe 'security/Query User' do - before do - ADMIN_CLIENT.security.put_user( - username: "query_users_test", - body: { - password: "x-pack-test-password", - roles: [ "manage_users_role" ], - full_name: "Read User" - } - ) - end - - it 'queries users' do - response = ADMIN_CLIENT.security.query_user(body: {}) - expect(response.status).to eq 200 - expect(response['count']).to be > 0 - expect(response['total']).to be > 0 - end - - it 'queries user and finds created one' do - body = { - query: { wildcard: { username: 'query_users_*' } } - } - response = ADMIN_CLIENT.security.query_user(body: body) - expect(response.status).to eq 200 - expect(response['count']).to be 1 - expect(response['total']).to be 1 - expect(response['users'].first['username']).to eq 'query_users_test' - end -end diff --git a/elasticsearch-api/spec/platinum/integration/service_accounts/service_accounts_spec.rb b/elasticsearch-api/spec/platinum/integration/service_accounts/service_accounts_spec.rb deleted file mode 100644 index d3c8a8bb48..0000000000 --- a/elasticsearch-api/spec/platinum/integration/service_accounts/service_accounts_spec.rb +++ /dev/null @@ -1,65 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require_relative '../platinum_helper' - -describe 'Service Accounts API' do - context 'service account tokens' do - before do - - end - - after do - ADMIN_CLIENT.security.delete_service_token( - namespace: 'elastic', - service: 'fleet-server', - name: 'api-token-fleet' - ) - end - - it 'responds with health report' do - response = ADMIN_CLIENT.security.create_service_token( - namespace: 'elastic', - service: 'fleet-server', - name: 'api-token-fleet' - ) - expect(response.status).to eq 200 - expect(response['created']).to eq true - service_token_fleet = response['token']['value'] - headers = { 'Authorization' => "Bearer #{service_token_fleet}"} - client = Elasticsearch::Client.new( - host: HOST, - transport_options: TRANSPORT_OPTIONS.merge(headers: headers) - ) - response = client.security.authenticate - - expect(response.status).to eq 200 - expect(response['username']).to eq 'elastic/fleet-server' - expect(response['full_name']).to eq 'Service account - elastic/fleet-server' - - - expect do - client.security.delete_user(username: 'foo') - end.to raise_error Elastic::Transport::Transport::Errors::Forbidden - - response = ADMIN_CLIENT.security.get_service_credentials( - namespace: 'elastic', service: 'fleet-server' - ) - expect(response['service_account']).to eq 'elastic/fleet-server' - end - end -end diff --git a/elasticsearch-api/spec/platinum/integration/snapshots/snapshots_spec.rb b/elasticsearch-api/spec/platinum/integration/snapshots/snapshots_spec.rb deleted file mode 100644 index 755915fcdf..0000000000 --- a/elasticsearch-api/spec/platinum/integration/snapshots/snapshots_spec.rb +++ /dev/null @@ -1,84 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require_relative '../platinum_helper' - -describe 'Snapshots API' do - before do - ADMIN_CLIENT.snapshot.create_repository( - repository: 'test_repo_restore_1', - body: { - type: 'source', - settings: { - delegate_type: 'fs', - location: "test_repo_restore_1_loc" - } - } - ) - ADMIN_CLIENT.indices.create( - index: index, - body: { - settings: { - number_of_shards: 1, - number_of_replicas: 0 - } - } - ) - end - - after do - ADMIN_CLIENT.indices.delete(index: 'test_index') - ADMIN_CLIENT.snapshot.delete(repository: 'test_repo_restore_1', snapshot: 'test_snapshot') - end - - let(:index) { 'test_index' } - - it 'creates a source only snapshot and then restores it' do - ADMIN_CLIENT.index(index: index, id: '1', body: { foo: 'bar' }) - ADMIN_CLIENT.indices.flush(index: index) - response = ADMIN_CLIENT.snapshot.create( - repository: 'test_repo_restore_1', - snapshot: 'test_snapshot', - wait_for_completion: true, - body: { "indices": "test_index" } - ) - expect(response.status).to eq 200 - expect(response['snapshot']['snapshot']).to eq 'test_snapshot' - expect(response['snapshot']['state']).to eq 'SUCCESS' - expect(response['snapshot']['version']).not_to be_nil - - ADMIN_CLIENT.indices.close(index: index) - ADMIN_CLIENT.snapshot.restore( - repository: 'test_repo_restore_1', - snapshot: 'test_snapshot', - wait_for_completion: true, - ) - response = ADMIN_CLIENT.indices.recovery(index: 'test_index') - expect(response.status).to eq 200 - expect(response['test_index']['shards'].first['type']).to eq 'SNAPSHOT' - expect(response['test_index']['shards'].first['stage']).to eq 'DONE' - response = ADMIN_CLIENT.search( - rest_total_hits_as_int: true, - index: index, - body: { query: { match_all: {} } } - ) - expect(response.status).to eq 200 - expect(response['hits']['total']).to eq 1 - expect(response['hits']['hits'].length).to eq 1 - expect(response['hits']['hits'].first['_id']).to eq '1' - end -end diff --git a/elasticsearch-api/spec/platinum/integration/spatial/script_doc_values_spec.rb b/elasticsearch-api/spec/platinum/integration/spatial/script_doc_values_spec.rb deleted file mode 100644 index 5061eb8427..0000000000 --- a/elasticsearch-api/spec/platinum/integration/spatial/script_doc_values_spec.rb +++ /dev/null @@ -1,147 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require_relative '../platinum_helper' - -describe 'Spatial API' do - context 'script doc values tests' do - index = 'geospatial_test' - before(:all) do - ADMIN_CLIENT.indices.create( - index: index, - body: { - settings: { number_of_shards: 1}, - mappings: { properties: { geo_shape: { type: 'geo_shape' } } } - } - ) - ADMIN_CLIENT.index( - index: index, - id: '1', - body: { - geo_shape: 'POLYGON((24.04725 59.942,24.04825 59.94125,24.04875 59.94125,24.04875 59.94175,24.048 59.9425,24.0475 59.94275,24.0465 59.94225,24.046 59.94225,24.04575 59.9425,24.04525 59.94225,24.04725 59.942))' - }, - refresh: true - ) - ADMIN_CLIENT.indices.refresh - end - - after(:all) do - ADMIN_CLIENT.indices.delete(index: index) - end - - it 'centroid' do - response = ADMIN_CLIENT.search( - rest_total_hits_as_int: true, - body: { - script_fields: { centroid: { script: { source: "doc['geo_shape'].getCentroid()" } } } - } - ) - expect(response['hits']['hits'].first['fields']['centroid'].first['lat']).to eq 59.942043484188616 - expect(response['hits']['hits'].first['fields']['centroid'].first['lon']).to eq 24.047588920220733 - end - - it 'bounding box' do - response = ADMIN_CLIENT.search( - rest_total_hits_as_int: true, - body: { - script_fields: { bbox: { script: { source: "doc['geo_shape'].getBoundingBox()" } } } - } - ) - expect(response['hits']['hits'].first['fields']['bbox'].first['top_left']['lat']).to eq 59.942749994806945 - expect(response['hits']['hits'].first['fields']['bbox'].first['top_left']['lon']).to eq 24.045249950140715 - expect(response['hits']['hits'].first['fields']['bbox'].first['bottom_right']['lat']).to eq 59.94124996941537 - expect(response['hits']['hits'].first['fields']['bbox'].first['bottom_right']['lon']).to eq 24.048749981448054 - end - - it 'label position' do - response = ADMIN_CLIENT.search( - rest_total_hits_as_int: true, - body: { - script_fields: { label_position: { script: { source: "doc['geo_shape'].getLabelPosition()" } } } - } - ) - expect(response['hits']['hits'].first['fields']['label_position'].first['lat']).to eq 59.942043484188616 - expect(response['hits']['hits'].first['fields']['label_position'].first['lon']).to eq 24.047588920220733 - end - - it 'bounding box points' do - response = ADMIN_CLIENT.search( - rest_total_hits_as_int: true, - body: { - script_fields: { - topLeft: { script: { source: "doc['geo_shape'].getBoundingBox().topLeft()" } }, - bottomRight: { script: { source: "doc['geo_shape'].getBoundingBox().bottomRight()" } } - } - } - ) - expect(response['hits']['hits'].first['fields']['topLeft'].first['lat']).to eq 59.942749994806945 - expect(response['hits']['hits'].first['fields']['topLeft'].first['lon']).to eq 24.045249950140715 - expect(response['hits']['hits'].first['fields']['bottomRight'].first['lat']).to eq 59.94124996941537 - expect(response['hits']['hits'].first['fields']['bottomRight'].first['lon']).to eq 24.048749981448054 - end - - it 'dimensional type' do - response = ADMIN_CLIENT.search( - rest_total_hits_as_int: true, - body: { - script_fields: { type: { script: { source: "doc['geo_shape'].getDimensionalType()" } } } - } - ) - expect(response['hits']['hits'].first['fields']['type'].first).to eq 2 - end - - it 'geoshape value' do - response = ADMIN_CLIENT.search( - rest_total_hits_as_int: true, - body: { - script_fields: { type: { script: { source: "doc['geo_shape'].get(0)" } } } - } - ) - expect(response['hits']['hits'].first['fields']['type'].first).to eq '' - - response = ADMIN_CLIENT.search( - rest_total_hits_as_int: true, - body: { - script_fields: { type: { script: { source: "field('geo_shape').get(null)"} } } - } - ) - expect(response['hits']['hits'].first['fields']['type'].first).to eq '' - - response = ADMIN_CLIENT.search( - rest_total_hits_as_int: true, - body: { - script_fields: { type: { script: { source: "$('geo_shape', null)"} } } - } - ) - expect(response['hits']['hits'].first['fields']['type'].first).to eq '' - end - - it 'diagonal length' do - response = ADMIN_CLIENT.search( - rest_total_hits_as_int: true, - body: { - script_fields: { - width: { script: { source: "doc['geo_shape'].getMercatorWidth()" } }, - height: { script: { source: "doc['geo_shape'].getMercatorHeight()" } } - } - } - ) - expect(response['hits']['hits'].first['fields']['width'].first).to eq 389.62170283915475 - expect(response['hits']['hits'].first['fields']['height'].first).to eq 333.37976841442287 - end - end -end diff --git a/elasticsearch-api/spec/platinum/integration/token/token_spec.rb b/elasticsearch-api/spec/platinum/integration/token/token_spec.rb deleted file mode 100644 index 10c2fe589c..0000000000 --- a/elasticsearch-api/spec/platinum/integration/token/token_spec.rb +++ /dev/null @@ -1,94 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require_relative '../platinum_helper' - -describe 'Token API' do - before do - ADMIN_CLIENT.security.put_role( - name: 'admin_role', - body: { cluster: ['manage_security'] } - ) - ADMIN_CLIENT.security.put_user( - username: 'token_user', - body: { - password: 'x-pack-test-password', - roles: [ 'admin_role' ], - full_name: 'Token user' - } - ) - end - - after do - ADMIN_CLIENT.security.delete_role(name: "admin_role", ignore: 404) - ADMIN_CLIENT.security.delete_user(username: "token_user", ignore: 404) - end - - it 'invalidates user token' do - response = ADMIN_CLIENT.security.get_token( - body: { grant_type: "password", username: "token_user", password: "x-pack-test-password" } - ) - - expect(response.status).to eq 200 - expect(response['type']).to eq 'Bearer' - expect(response['access_token']).not_to be_nil - access_token = response['access_token'] - client = Elasticsearch::Client.new( - host: "https://#{HOST_URI.host}:#{HOST_URI.port}", - transport_options: TRANSPORT_OPTIONS.merge( - headers: { Authorization: "Bearer #{access_token}" } - ) - ) - response = client.security.authenticate - expect(response.status).to eq 200 - expect(response['username']).to eq 'token_user' - expect(response['roles'].first).to eq 'admin_role' - ADMIN_CLIENT.security.invalidate_token( - body: { username: 'token_user' } - ) - - expect do - client.security.authenticate - end.to raise_error(Elastic::Transport::Transport::Errors::Unauthorized) - end - - it 'invalidates realm token' do - response = ADMIN_CLIENT.security.get_token( - body: { grant_type: "password", username: "token_user", password: "x-pack-test-password" } - ) - expect(response.status).to eq 200 - expect(response['type']).to eq 'Bearer' - expect(response['access_token']).not_to be_nil - access_token = response['access_token'] - client = Elasticsearch::Client.new( - host: "https://#{HOST_URI.host}:#{HOST_URI.port}", - transport_options: TRANSPORT_OPTIONS.merge( - headers: { Authorization: "Bearer #{access_token}" } - ) - ) - response = client.security.authenticate - expect(response.status).to eq 200 - expect(response['username']).to eq 'token_user' - expect(response['roles'].first).to eq 'admin_role' - response = ADMIN_CLIENT.security.invalidate_token(body: { realm_name: 'default_native' }) - expect(response.status).to eq 200 - - expect do - client.security.authenticate - end.to raise_error(Elastic::Transport::Transport::Errors::Unauthorized) - end -end diff --git a/elasticsearch-api/spec/platinum/unit/async_search/delete_test.rb b/elasticsearch-api/spec/platinum/unit/async_search/delete_test.rb deleted file mode 100644 index 7efcde4ced..0000000000 --- a/elasticsearch-api/spec/platinum/unit/async_search/delete_test.rb +++ /dev/null @@ -1,39 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackAsyncSearchDelete < Minitest::Test - subject { FakeClient.new } - - context 'XPack: Async Search Delete' do - should 'perform correct request' do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal('DELETE', method) - assert_equal('_async_search/foo', url) - assert_equal({}, params) - assert_nil(body) - end.returns(FakeResponse.new) - - subject.async_search.delete(id: 'foo') - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/async_search/get_test.rb b/elasticsearch-api/spec/platinum/unit/async_search/get_test.rb deleted file mode 100644 index 76b5df5f79..0000000000 --- a/elasticsearch-api/spec/platinum/unit/async_search/get_test.rb +++ /dev/null @@ -1,39 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackAsyncSearchGet < Minitest::Test - subject { FakeClient.new } - - context 'XPack: Async Search Get' do - should 'perform correct request' do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal('GET', method) - assert_equal('_async_search/foo', url) - assert_equal({}, params) - assert_nil(body) - end.returns(FakeResponse.new) - - subject.async_search.get(id: 'foo') - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/async_search/status_test.rb b/elasticsearch-api/spec/platinum/unit/async_search/status_test.rb deleted file mode 100644 index c65ca5e1da..0000000000 --- a/elasticsearch-api/spec/platinum/unit/async_search/status_test.rb +++ /dev/null @@ -1,39 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackAsyncSearchStatus < Minitest::Test - subject { FakeClient.new } - - context 'XPack: Async Search Status' do - should 'perform correct request' do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal('GET', method) - assert_equal('_async_search/status/foo', url) - assert_equal({}, params) - assert_nil(body) - end.returns(FakeResponse.new) - - subject.async_search.status(id: 'foo') - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/async_search/submit_test.rb b/elasticsearch-api/spec/platinum/unit/async_search/submit_test.rb deleted file mode 100644 index 89261a1dbb..0000000000 --- a/elasticsearch-api/spec/platinum/unit/async_search/submit_test.rb +++ /dev/null @@ -1,50 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackAsyncSearchSubmit < Minitest::Test - subject { FakeClient.new } - - context 'XPack: Async Search Submit' do - should 'perform correct request' do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal('POST', method) - assert_equal('_async_search', url) - assert_equal({}, params) - assert_nil(body) - end.returns(FakeResponse.new) - - subject.async_search.submit - end - - should 'perform correct request with index' do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal('POST', method) - assert_equal('foo/_async_search', url) - assert_equal({}, params) - assert_nil(body) - end.returns(FakeResponse.new) - - subject.async_search.submit(index: 'foo') - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/enrich/delete_policy_test.rb b/elasticsearch-api/spec/platinum/unit/enrich/delete_policy_test.rb deleted file mode 100644 index 4f661d5cb2..0000000000 --- a/elasticsearch-api/spec/platinum/unit/enrich/delete_policy_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackEnrichDeletePolicyTest < Minitest::Test - - context "XPack Enrich: Delete policy" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'DELETE', method - assert_equal '_enrich/policy/foo', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.enrich.delete_policy(name: 'foo') - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/eql/delete_test.rb b/elasticsearch-api/spec/platinum/unit/eql/delete_test.rb deleted file mode 100644 index 202daa6cf6..0000000000 --- a/elasticsearch-api/spec/platinum/unit/eql/delete_test.rb +++ /dev/null @@ -1,46 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackEqlDeleteTest < Minitest::Test - context 'Eql: Delete' do - subject { FakeClient.new } - - should 'perform correct request' do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'DELETE', method - assert_equal '_eql/search/foo', url - assert_equal({}, params) - assert_nil body - true - end.returns(FakeResponse.new) - - subject.eql.delete(id: 'foo') - end - - should 'raise argument error without id' do - assert_raises ArgumentError do - subject.eql.delete - end - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/eql/get_status_test.rb b/elasticsearch-api/spec/platinum/unit/eql/get_status_test.rb deleted file mode 100644 index 552cd30404..0000000000 --- a/elasticsearch-api/spec/platinum/unit/eql/get_status_test.rb +++ /dev/null @@ -1,46 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackEqlGetStatusTest < Minitest::Test - context 'Eql: Get Status' do - subject { FakeClient.new } - - should 'perform correct request' do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal '_eql/search/status/foo', url - assert_equal({}, params) - assert_nil body - true - end.returns(FakeResponse.new) - - subject.eql.get_status(id: 'foo') - end - - should 'raise argument error without id' do - assert_raises ArgumentError do - subject.eql.get_status - end - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/eql/get_test.rb b/elasticsearch-api/spec/platinum/unit/eql/get_test.rb deleted file mode 100644 index 7f63be2e8a..0000000000 --- a/elasticsearch-api/spec/platinum/unit/eql/get_test.rb +++ /dev/null @@ -1,46 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackEqlGetTest < Minitest::Test - context 'Eql: Get' do - subject { FakeClient.new } - - should 'perform correct request' do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal '_eql/search/foo', url - assert_equal({}, params) - assert_nil body - true - end.returns(FakeResponse.new) - - subject.eql.get(id: 'foo') - end - - should 'raise argument error without id' do - assert_raises ArgumentError do - subject.eql.get - end - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/eql/search_test.rb b/elasticsearch-api/spec/platinum/unit/eql/search_test.rb deleted file mode 100644 index 5b5bc3015d..0000000000 --- a/elasticsearch-api/spec/platinum/unit/eql/search_test.rb +++ /dev/null @@ -1,52 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackEqlSearchTest < Minitest::Test - context 'Eql: Search' do - subject { FakeClient.new } - - should 'perform correct request' do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'POST', method - assert_equal 'foo/_eql/search', url - assert_equal({}, params) - assert_equal body, 'test' - true - end.returns(FakeResponse.new) - - subject.eql.search(index: 'foo', body: 'test') - end - - should 'raise argument error without body' do - assert_raises ArgumentError do - subject.eql.search(index: 'foo') - end - end - - should 'raise argument error without index' do - assert_raises ArgumentError do - subject.eql.search(body: 'test') - end - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/graph/explore_test.rb b/elasticsearch-api/spec/platinum/unit/graph/explore_test.rb deleted file mode 100644 index 0d9d581ca3..0000000000 --- a/elasticsearch-api/spec/platinum/unit/graph/explore_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class GraphExploreTest < Minitest::Test - - context "Graph: Explore" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal 'my_index/_graph/explore', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.graph.explore(index: 'my_index') - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/index_lifecycle_management/explain_test.rb b/elasticsearch-api/spec/platinum/unit/index_lifecycle_management/explain_test.rb deleted file mode 100644 index 6dbe35d209..0000000000 --- a/elasticsearch-api/spec/platinum/unit/index_lifecycle_management/explain_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackIndexLifecycleManagementExplainTest < Minitest::Test - - context "XPack Index Lifecycle Management: explain" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal 'foo/_ilm/explain', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ilm.explain_lifecycle(index: 'foo') - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/index_lifecycle_management/get_status_test.rb b/elasticsearch-api/spec/platinum/unit/index_lifecycle_management/get_status_test.rb deleted file mode 100644 index 069e84bcf9..0000000000 --- a/elasticsearch-api/spec/platinum/unit/index_lifecycle_management/get_status_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackIndexLifecycleManagementGetStatusTest < Minitest::Test - - context "XPack Index Lifecycle Management: Get status" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal '_ilm/status', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ilm.get_status - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/index_lifecycle_management/move_to_step.rb b/elasticsearch-api/spec/platinum/unit/index_lifecycle_management/move_to_step.rb deleted file mode 100644 index 273ef80c5b..0000000000 --- a/elasticsearch-api/spec/platinum/unit/index_lifecycle_management/move_to_step.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackIndexLifecycleManagementMoveStepTest < Minitest::Test - - context "XPack Index Lifecycle Management: Move to step" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'POST', method - assert_equal '_ilm/move/foo', url - assert_equal Hash.new, params - assert_equal Hash.new, body - true - end.returns(FakeResponse.new) - - subject.ilm.move_to_step :index => 'foo', :body => {} - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/index_lifecycle_management/remove_policy_test.rb b/elasticsearch-api/spec/platinum/unit/index_lifecycle_management/remove_policy_test.rb deleted file mode 100644 index 29da1c4a98..0000000000 --- a/elasticsearch-api/spec/platinum/unit/index_lifecycle_management/remove_policy_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackIndexLifecycleManagementRemovePolicyTest < Minitest::Test - - context "XPack Index Lifecycle Management: Remove policy" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'POST', method - assert_equal 'foo/_ilm/remove', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ilm.remove_policy :index => 'foo' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/index_lifecycle_management/retry_policy_test.rb b/elasticsearch-api/spec/platinum/unit/index_lifecycle_management/retry_policy_test.rb deleted file mode 100644 index 8b5593dfb5..0000000000 --- a/elasticsearch-api/spec/platinum/unit/index_lifecycle_management/retry_policy_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackIndexLifecycleManagementRetryTest < Minitest::Test - - context "XPack Index Lifecycle Management: retry" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'POST', method - assert_equal 'foo/_ilm/retry', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ilm.retry(index: 'foo') - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/index_lifecycle_management/start_test.rb b/elasticsearch-api/spec/platinum/unit/index_lifecycle_management/start_test.rb deleted file mode 100644 index cc393a0ff2..0000000000 --- a/elasticsearch-api/spec/platinum/unit/index_lifecycle_management/start_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackIndexLifecycleManagementStartTest < Minitest::Test - - context "XPack Index Lifecycle Management: start" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'POST', method - assert_equal '_ilm/start', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ilm.start - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/index_lifecycle_management/stop_test.rb b/elasticsearch-api/spec/platinum/unit/index_lifecycle_management/stop_test.rb deleted file mode 100644 index 0f51d8aec2..0000000000 --- a/elasticsearch-api/spec/platinum/unit/index_lifecycle_management/stop_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackIndexLifecycleManagementStopTest < Minitest::Test - - context "XPack Index Lifecycle Management: stop" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'POST', method - assert_equal '_ilm/stop', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ilm.stop - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/indices/create_data_stream_test.rb b/elasticsearch-api/spec/platinum/unit/indices/create_data_stream_test.rb deleted file mode 100644 index 04ba1fd10d..0000000000 --- a/elasticsearch-api/spec/platinum/unit/indices/create_data_stream_test.rb +++ /dev/null @@ -1,46 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackIndicesCreateDataStreamTest < Minitest::Test - subject { FakeClient.new } - - context 'XPack: Create Data Stream' do - should 'perform correct request' do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal('PUT', method) - assert_equal('_data_stream/foo', url) - assert_equal({}, params) - assert_nil(body) - true - end.returns(FakeResponse.new) - - subject.indices.create_data_stream(name: 'foo') - end - - should 'raise argument error without name' do - assert_raises ArgumentError do - subject.indices.create_data_stream - end - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/indices/data_stream_stats_test.rb b/elasticsearch-api/spec/platinum/unit/indices/data_stream_stats_test.rb deleted file mode 100644 index de4efba9d0..0000000000 --- a/elasticsearch-api/spec/platinum/unit/indices/data_stream_stats_test.rb +++ /dev/null @@ -1,54 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackIndicesDataStreamStatsTest < Minitest::Test - subject { FakeClient.new } - - context 'XPack: Data Stream Stats' do - should 'perform correct request' do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal('GET', method) - assert_equal('_data_stream/_stats', url) - assert_equal({}, params) - assert_nil(body) - true - end.returns(FakeResponse.new) - - subject.indices.data_streams_stats - end - end - - context 'when name is specified' do - should 'perform correct request' do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal('GET', method) - assert_equal('_data_stream/foo/_stats', url) - assert_equal({}, params) - assert_nil(body) - true - end.returns(FakeResponse.new) - - subject.indices.data_streams_stats(name: 'foo') - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/indices/delete_data_stream_test.rb b/elasticsearch-api/spec/platinum/unit/indices/delete_data_stream_test.rb deleted file mode 100644 index c8d4233783..0000000000 --- a/elasticsearch-api/spec/platinum/unit/indices/delete_data_stream_test.rb +++ /dev/null @@ -1,46 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackIndicesDeleteDataStreamTest < Minitest::Test - subject { FakeClient.new } - - context 'XPack: Delete Data Stream' do - should 'perform correct request' do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal('DELETE', method) - assert_equal('_data_stream/foo', url) - assert_equal({}, params) - assert_nil(body) - end.returns(FakeResponse.new) - - subject.indices.delete_data_stream(name: 'foo') - end - end - - - should 'raise argument error without name' do - assert_raises ArgumentError do - subject.indices.create_data_stream - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/indices/downsample_test.rb b/elasticsearch-api/spec/platinum/unit/indices/downsample_test.rb deleted file mode 100644 index 4b6e917907..0000000000 --- a/elasticsearch-api/spec/platinum/unit/indices/downsample_test.rb +++ /dev/null @@ -1,58 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class IndicesDownsampleTest < Minitest::Test - context "Indices Downsample: Downsample an index" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal('POST', method) - assert_equal('foo/_downsample/bar', url) - assert_equal({}, params) - assert_equal(body, {}) - true - end.returns(FakeResponse.new) - - subject.indices.downsample(body: {}, index: 'foo', target_index: 'bar') - end - - should 'raise argument error without body' do - assert_raises ArgumentError do - subject.indices.downsample(index: 'foo', target_index: 'bar') - end - end - - should 'raise argument error without index' do - assert_raises ArgumentError do - subject.indices.downsample(body: {}, target_index: 'bar') - end - end - - should 'raise argument error without rollup_index' do - assert_raises ArgumentError do - subject.indices.downsample(body: {}, index: 'foo') - end - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/indices/get_data_stream_test.rb b/elasticsearch-api/spec/platinum/unit/indices/get_data_stream_test.rb deleted file mode 100644 index 38d3c828cd..0000000000 --- a/elasticsearch-api/spec/platinum/unit/indices/get_data_stream_test.rb +++ /dev/null @@ -1,50 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackIndicesGetDataStreamTest < Minitest::Test - subject { FakeClient.new } - - context 'XPack: Get Data Stream' do - should 'perform correct request' do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal('GET', method) - assert_equal('_data_stream', url) - assert_equal({}, params) - assert_nil(body) - end.returns(FakeResponse.new) - - subject.indices.get_data_stream - end - end - - context 'Get Data Stream with name' do - should 'perform correct request' do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal('GET', method) - assert_equal('_data_stream/foo', url) - end.returns(FakeResponse.new) - - subject.indices.get_data_stream(name: 'foo') - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/indices/migrate_to_data_stream_test.rb b/elasticsearch-api/spec/platinum/unit/indices/migrate_to_data_stream_test.rb deleted file mode 100644 index c9b4151571..0000000000 --- a/elasticsearch-api/spec/platinum/unit/indices/migrate_to_data_stream_test.rb +++ /dev/null @@ -1,46 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackIndicesMigrateToDataStream < Minitest::Test - subject { FakeClient.new } - - context 'XPack: Migrate to Data Stream' do - should 'perform correct request' do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal('POST', method) - assert_equal('_data_stream/_migrate/foo', url) - assert_equal({}, params) - assert_nil(body) - true - end.returns(FakeResponse.new) - - subject.indices.migrate_to_data_stream(name: 'foo') - end - - should 'raise argument error without name' do - assert_raises ArgumentError do - subject.indices.create_data_stream - end - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/indices/modify_data_stream_test.rb b/elasticsearch-api/spec/platinum/unit/indices/modify_data_stream_test.rb deleted file mode 100644 index 79a5c23f3e..0000000000 --- a/elasticsearch-api/spec/platinum/unit/indices/modify_data_stream_test.rb +++ /dev/null @@ -1,46 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackIndicesModifyDataStreamTest < Minitest::Test - subject { FakeClient.new } - - context 'XPack: Modify Data Stream' do - should 'perform correct request' do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal('POST', method) - assert_equal('_data_stream/_modify', url) - assert_equal({}, params) - assert_equal({}, body) - true - end.returns(FakeResponse.new) - - subject.indices.modify_data_stream(body: {}) - end - - should 'raise argument error without name' do - assert_raises ArgumentError do - subject.indices.modify_data_stream - end - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/indices/promote_data_stream_test.rb b/elasticsearch-api/spec/platinum/unit/indices/promote_data_stream_test.rb deleted file mode 100644 index c9e787fd1d..0000000000 --- a/elasticsearch-api/spec/platinum/unit/indices/promote_data_stream_test.rb +++ /dev/null @@ -1,46 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackIndicesPromoteDataStreamTest < Minitest::Test - subject { FakeClient.new } - - context 'XPack: Promote Data Stream' do - should 'perform correct request' do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal('POST', method) - assert_equal('_data_stream/_promote/foo', url) - assert_equal({}, params) - assert_nil(body) - true - end.returns(FakeResponse.new) - - subject.indices.promote_data_stream(name: 'foo') - end - - should 'raise argument error without name' do - assert_raises ArgumentError do - subject.indices.promote_data_stream - end - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/knn_search_test.rb b/elasticsearch-api/spec/platinum/unit/knn_search_test.rb deleted file mode 100644 index 341dd2e563..0000000000 --- a/elasticsearch-api/spec/platinum/unit/knn_search_test.rb +++ /dev/null @@ -1,40 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackInfoTest < Minitest::Test - context 'Knn Search' do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal('GET', method) - assert_equal('foo/_knn_search', url) - assert_equal({}, params) - assert_nil(body) - true - end.returns(FakeResponse.new) - - subject.knn_search(index: 'foo') - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/license/delete_test.rb b/elasticsearch-api/spec/platinum/unit/license/delete_test.rb deleted file mode 100644 index 2ddfc49771..0000000000 --- a/elasticsearch-api/spec/platinum/unit/license/delete_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackLicenseDeleteTest < Minitest::Test - - context "License: Delete" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'DELETE', method - assert_equal '_license', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.license.delete - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/license/get_test.rb b/elasticsearch-api/spec/platinum/unit/license/get_test.rb deleted file mode 100644 index 494de8d0ae..0000000000 --- a/elasticsearch-api/spec/platinum/unit/license/get_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackLicenseGetTest < Minitest::Test - - context "License: Get" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal '_license', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.license.get - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/license/post_test.rb b/elasticsearch-api/spec/platinum/unit/license/post_test.rb deleted file mode 100644 index f9a4163041..0000000000 --- a/elasticsearch-api/spec/platinum/unit/license/post_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackLicensePostTest < Minitest::Test - - context "License: Post" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'PUT', method - assert_equal '_license', url - assert_equal Hash.new, params - assert_equal [], body - true - end.returns(FakeResponse.new) - - subject.license.post body: [] - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/logstash/delete_pipeline_test.rb b/elasticsearch-api/spec/platinum/unit/logstash/delete_pipeline_test.rb deleted file mode 100644 index 21e6d955d3..0000000000 --- a/elasticsearch-api/spec/platinum/unit/logstash/delete_pipeline_test.rb +++ /dev/null @@ -1,46 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackLogstashDeletePipelineTest < Minitest::Test - context 'Logstash: Delete Pipeline' do - subject { FakeClient.new } - - should 'perform correct request' do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'DELETE', method - assert_equal '_logstash/pipeline/foo', url - assert_equal({}, params) - assert_nil body - true - end.returns(FakeResponse.new) - - subject.logstash.delete_pipeline(id: 'foo') - end - - should 'raise argument error without id' do - assert_raises ArgumentError do - subject.logstash.delete_pipeline - end - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/logstash/get_pipeline_test.rb b/elasticsearch-api/spec/platinum/unit/logstash/get_pipeline_test.rb deleted file mode 100644 index d0d6dc3161..0000000000 --- a/elasticsearch-api/spec/platinum/unit/logstash/get_pipeline_test.rb +++ /dev/null @@ -1,46 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackLogstashGetPipelineTest < Minitest::Test - context 'Logstash: Get Pipeline' do - subject { FakeClient.new } - - should 'perform correct request' do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal '_logstash/pipeline/foo', url - assert_equal({}, params) - assert_nil body - true - end.returns(FakeResponse.new) - - subject.logstash.get_pipeline(id: 'foo') - end - - should 'raise argument error without id' do - assert_raises ArgumentError do - subject.logstash.get_pipeline - end - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/logstash/put_pipeline_test.rb b/elasticsearch-api/spec/platinum/unit/logstash/put_pipeline_test.rb deleted file mode 100644 index c42e269553..0000000000 --- a/elasticsearch-api/spec/platinum/unit/logstash/put_pipeline_test.rb +++ /dev/null @@ -1,46 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackLogstashPutPipelineTest < Minitest::Test - context 'Logstash: Put Pipeline' do - subject { FakeClient.new } - - should 'perform correct request' do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'PUT', method - assert_equal '_logstash/pipeline/foo', url - assert_equal({}, params) - assert_equal({}, body) - true - end.returns(FakeResponse.new) - - subject.logstash.put_pipeline(id: 'foo', body: {}) - end - - should 'raise argument error without body' do - assert_raises ArgumentError do - subject.logstash.put_pipeline(id: 'foo') - end - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/clear_trained_model_deployment_cache_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/clear_trained_model_deployment_cache_test.rb deleted file mode 100644 index 97d398aa19..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/clear_trained_model_deployment_cache_test.rb +++ /dev/null @@ -1,40 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class MachineLearningClearTrainedModelDeploymentCacheTest < Minitest::Test - context 'Machine Learning: Clear trained model deployment cache' do - subject { FakeClient.new } - - should 'perform correct request' do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal('POST', method) - assert_equal('_ml/trained_models/model/deployment/cache/_clear', url) - assert_equal({}, params) - assert_nil(body) - true - end.returns(FakeResponse.new) - - subject.ml.clear_trained_model_deployment_cache(model_id: 'model') - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/close_job_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/close_job_test.rb deleted file mode 100644 index 80a4adaeab..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/close_job_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlCloseJobTest < Minitest::Test - - context "XPack MachineLearning: Close job" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'POST', method - assert_equal "_ml/anomaly_detectors/foo/_close", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ml.close_job :job_id => 'foo' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/delete_datafeed_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/delete_datafeed_test.rb deleted file mode 100644 index 2c6a905069..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/delete_datafeed_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlDeleteDatafeedTest < Minitest::Test - - context "XPack MachineLearning: Delete datafeed" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'DELETE', method - assert_equal "_ml/datafeeds/foo", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ml.delete_datafeed :datafeed_id => 'foo' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/delete_expired_data_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/delete_expired_data_test.rb deleted file mode 100644 index 4e22eac168..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/delete_expired_data_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlDeleteExpiredDataTest < Minitest::Test - - context "XPack MachineLearning: Delete expired data" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'DELETE', method - assert_equal "_ml/_delete_expired_data", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ml.delete_expired_data - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/delete_filter_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/delete_filter_test.rb deleted file mode 100644 index a65ee8e9c7..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/delete_filter_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlDeleteFilterTest < Minitest::Test - - context "XPack MachineLearning: Delete filter" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'DELETE', method - assert_equal "_ml/filters/foo", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ml.delete_filter :filter_id => 'foo' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/delete_forecast_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/delete_forecast_test.rb deleted file mode 100644 index 753852d1c5..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/delete_forecast_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlDeleteForecastTest < Minitest::Test - - context "XPack MachineLearning: Delete forecast" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'DELETE', method - assert_equal "_ml/anomaly_detectors/foo/_forecast", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ml.delete_forecast :job_id => 'foo' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/delete_job_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/delete_job_test.rb deleted file mode 100644 index 2692743f86..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/delete_job_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlDeleteJobTest < Minitest::Test - - context "XPack MachineLearning: Delete job" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'DELETE', method - assert_equal "_ml/anomaly_detectors/foo", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ml.delete_job :job_id => 'foo' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/delete_model_alias_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/delete_model_alias_test.rb deleted file mode 100644 index 0e8523256d..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/delete_model_alias_test.rb +++ /dev/null @@ -1,40 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlDeleteTrainedModelAliasTest < Minitest::Test - context "XPack MachineLearning: Delete trained model alias" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal('DELETE', method) - assert_equal("_ml/trained_models/foo/model_aliases/alias", url) - assert_equal(Hash.new, params) - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ml.delete_trained_model_alias(model_id: 'foo', model_alias: 'alias') - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/delete_model_snapshot_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/delete_model_snapshot_test.rb deleted file mode 100644 index 6a1fe0d1f7..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/delete_model_snapshot_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlDeleteModelSnapshotTest < Minitest::Test - - context "XPack MachineLearning: Delete model snapshot" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'DELETE', method - assert_equal "_ml/anomaly_detectors/foo/model_snapshots/bar", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ml.delete_model_snapshot :job_id => 'foo', :snapshot_id => 'bar' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/flush_job_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/flush_job_test.rb deleted file mode 100644 index 2a315637cd..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/flush_job_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlFlushJobTest < Minitest::Test - - context "XPack MachineLearning: Flush job" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'POST', method - assert_equal "_ml/anomaly_detectors/foo/_flush", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ml.flush_job :job_id => 'foo' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/forecast_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/forecast_test.rb deleted file mode 100644 index b41eb52bbf..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/forecast_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlForecastTest < Minitest::Test - - context "XPack MachineLearning: Forecast" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'POST', method - assert_equal '_ml/anomaly_detectors/foo/_forecast', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ml.forecast :job_id => 'foo' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/get_buckets_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/get_buckets_test.rb deleted file mode 100644 index 4394331b89..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/get_buckets_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlGetBucketsTest < Minitest::Test - - context "XPack MachineLearning: Get buckets" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal "_ml/anomaly_detectors/foo/results/buckets", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ml.get_buckets :job_id => 'foo' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/get_categories_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/get_categories_test.rb deleted file mode 100644 index 2847f522a8..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/get_categories_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlGetCategoriesTest < Minitest::Test - - context "XPack MachineLearning: Get categories" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal "_ml/anomaly_detectors/foo/results/categories", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ml.get_categories :job_id => 'foo' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/get_datafeed_stats_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/get_datafeed_stats_test.rb deleted file mode 100644 index c997e99efe..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/get_datafeed_stats_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlGetDatafeedStatsTest < Minitest::Test - - context "XPack MachineLearning: Get datafeed stats" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal "_ml/datafeeds/_stats", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ml.get_datafeed_stats - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/get_datafeeds_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/get_datafeeds_test.rb deleted file mode 100644 index 41769681c5..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/get_datafeeds_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlGetDatafeedsTest < Minitest::Test - - context "XPack MachineLearning: Get datafeeds" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal "_ml/datafeeds/foo", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ml.get_datafeeds :datafeed_id => 'foo' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/get_filters_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/get_filters_test.rb deleted file mode 100644 index 41f85943bc..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/get_filters_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlGetFiltersTest < Minitest::Test - - context "XPack MachineLearning: Get filters" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal "_ml/filters/foo", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ml.get_filters :filter_id => 'foo' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/get_influencers_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/get_influencers_test.rb deleted file mode 100644 index c409d38b04..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/get_influencers_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlGetInfluencersTest < Minitest::Test - - context "XPack MachineLearning: Get influencers" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal "_ml/anomaly_detectors/foo/results/influencers", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ml.get_influencers :job_id => 'foo' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/get_job_stats_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/get_job_stats_test.rb deleted file mode 100644 index 08de0c35f0..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/get_job_stats_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlGetJobStatsTest < Minitest::Test - - context "XPack MachineLearning: Get job stats" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal "_ml/anomaly_detectors/foo/_stats", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ml.get_job_stats :job_id => 'foo' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/get_jobs_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/get_jobs_test.rb deleted file mode 100644 index 80be74726c..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/get_jobs_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlGetJobsTest < Minitest::Test - - context "XPack MachineLearning: Get jobs" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal "_ml/anomaly_detectors/foo", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ml.get_jobs :job_id => 'foo' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/get_model_snapshots_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/get_model_snapshots_test.rb deleted file mode 100644 index 840f38e8f4..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/get_model_snapshots_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlGetModelSnapshotsTest < Minitest::Test - - context "XPack MachineLearning: Get model snapshots" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal "_ml/anomaly_detectors/foo/model_snapshots/bar", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ml.get_model_snapshots :job_id => 'foo', :snapshot_id => 'bar' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/get_overall_buckets_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/get_overall_buckets_test.rb deleted file mode 100644 index e47463f601..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/get_overall_buckets_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlGetOverallBucketsTest < Minitest::Test - - context "XPack MachineLearning: Get overall buckets" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal '_ml/anomaly_detectors/foo/results/overall_buckets', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ml.get_overall_buckets :job_id => 'foo' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/get_records_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/get_records_test.rb deleted file mode 100644 index 3ffab1e62d..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/get_records_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlGetRecordsTest < Minitest::Test - - context "XPack MachineLearning: Get records" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal "_ml/anomaly_detectors/foo/results/records", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ml.get_records :job_id => 'foo' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/open_job_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/open_job_test.rb deleted file mode 100644 index 1e3338cb08..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/open_job_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlOpenJobTest < Minitest::Test - - context "XPack MachineLearning: Open job" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'POST', method - assert_equal "_ml/anomaly_detectors/foo/_open", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ml.open_job :job_id => 'foo' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/post_data_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/post_data_test.rb deleted file mode 100644 index e78a00a131..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/post_data_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlPostDataTest < Minitest::Test - - context "XPack MachineLearning: Post data" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'POST', method - assert_equal "_ml/anomaly_detectors/foo/_data", url - assert_equal Hash.new, params - assert_equal Hash.new, body - true - end.returns(FakeResponse.new) - - subject.ml.post_data :job_id => 'foo', :body => {} - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/preview_data_frame_analytics_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/preview_data_frame_analytics_test.rb deleted file mode 100644 index e45965ac90..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/preview_data_frame_analytics_test.rb +++ /dev/null @@ -1,64 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlPreviewDataFrameAnalyticsTest < Minitest::Test - context 'XPack MachineLearning: Preview data frame analytics' do - subject { FakeClient.new } - - should 'perform correct request' do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal('GET', method) - assert_equal('_ml/data_frame/analytics/_preview', url) - assert_equal(Hash.new, params) - assert_nil(body) - true - end.returns(FakeResponse.new) - - subject.ml.preview_data_frame_analytics - end - - should 'perform correct request with body' do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal('POST', method) - assert_equal('_ml/data_frame/analytics/_preview', url) - assert_equal(Hash.new, params) - assert_equal(body, {}) - true - end.returns(FakeResponse.new) - - subject.ml.preview_data_frame_analytics(body: {}) - end - - should 'perform correct request with id' do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal('GET', method) - assert_equal('_ml/data_frame/analytics/3/_preview', url) - assert_equal(Hash.new, params) - assert_nil(body) - true - end.returns(FakeResponse.new) - - subject.ml.preview_data_frame_analytics(id: 3) - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/preview_datafeed_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/preview_datafeed_test.rb deleted file mode 100644 index ff2eba29c1..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/preview_datafeed_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlPreviewDatafeedTest < Minitest::Test - - context "XPack MachineLearning: Preview datafeed" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal "_ml/datafeeds/foo/_preview", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ml.preview_datafeed :datafeed_id => 'foo' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/put_datafeed_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/put_datafeed_test.rb deleted file mode 100644 index 15eebb4a45..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/put_datafeed_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlPutDatafeedTest < Minitest::Test - - context "XPack MachineLearning: Put datafeed" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'PUT', method - assert_equal "_ml/datafeeds/foo", url - assert_equal Hash.new, params - assert_equal Hash.new, body - true - end.returns(FakeResponse.new) - - subject.ml.put_datafeed :datafeed_id => 'foo', body: {} - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/put_filter_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/put_filter_test.rb deleted file mode 100644 index d51748b7c5..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/put_filter_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlPutFilterTest < Minitest::Test - - context "XPack MachineLearning: Put filter" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'PUT', method - assert_equal "_ml/filters/foo", url - assert_equal Hash.new, params - assert_equal Hash.new, body - true - end.returns(FakeResponse.new) - - subject.ml.put_filter :filter_id => 'foo', :body => {} - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/put_job_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/put_job_test.rb deleted file mode 100644 index 4a105c12b3..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/put_job_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlPutJobTest < Minitest::Test - - context "XPack MachineLearning: Put job" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'PUT', method - assert_equal "_ml/anomaly_detectors/foo", url - assert_equal Hash.new, params - assert_equal Hash.new, body - true - end.returns(FakeResponse.new) - - subject.ml.put_job :job_id => 'foo', :body => {} - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/put_trained_model_alias_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/put_trained_model_alias_test.rb deleted file mode 100644 index c62f4fe424..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/put_trained_model_alias_test.rb +++ /dev/null @@ -1,40 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlPutTrainedModelAliasTest < Minitest::Test - context "XPack MachineLearning: Put trained model alias" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal('PUT', method) - assert_equal("_ml/trained_models/foo/model_aliases/alias", url) - assert_equal(Hash.new, params) - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ml.put_trained_model_alias(model_id: 'foo', model_alias: 'alias') - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/revert_model_snapshot_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/revert_model_snapshot_test.rb deleted file mode 100644 index 2d4dd6de1f..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/revert_model_snapshot_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlRevertModelSnapshotTest < Minitest::Test - - context "XPack MachineLearning: Revert model snapshot" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'POST', method - assert_equal "_ml/anomaly_detectors/foo/model_snapshots/bar/_revert", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ml.revert_model_snapshot :job_id => 'foo', :snapshot_id => 'bar' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/start_datafeed_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/start_datafeed_test.rb deleted file mode 100644 index b090ead16c..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/start_datafeed_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlStartDatafeedTest < Minitest::Test - - context "XPack MachineLearning: Start datafeed" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'POST', method - assert_equal "_ml/datafeeds/foo/_start", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ml.start_datafeed :datafeed_id => 'foo' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/stop_datafeed_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/stop_datafeed_test.rb deleted file mode 100644 index 0dcafd675e..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/stop_datafeed_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlStopDatafeedTest < Minitest::Test - - context "XPack MachineLearning: Stop datafeed" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'POST', method - assert_equal "_ml/datafeeds/foo/_stop", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ml.stop_datafeed :datafeed_id => 'foo' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/update_data_frame_analytics_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/update_data_frame_analytics_test.rb deleted file mode 100644 index e7afb9227c..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/update_data_frame_analytics_test.rb +++ /dev/null @@ -1,40 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlUpdateDataFrameAnalyticsTest < Minitest::Test - context "XPack MachineLearning: Update data frame analytics" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'POST', method - assert_equal "_ml/data_frame/analytics/foo/_update", url - assert_equal Hash.new, params - assert_equal Hash.new, body - true - end.returns(FakeResponse.new) - - subject.ml.update_data_frame_analytics id: 'foo', body: {} - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/update_datafeed_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/update_datafeed_test.rb deleted file mode 100644 index c509520f3b..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/update_datafeed_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlUpdateDatafeedTest < Minitest::Test - - context "XPack MachineLearning: Update datafeed" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'POST', method - assert_equal "_ml/datafeeds/foo/_update", url - assert_equal Hash.new, params - assert_equal Hash.new, body - true - end.returns(FakeResponse.new) - - subject.ml.update_datafeed :datafeed_id => 'foo', :body => {} - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/update_filter_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/update_filter_test.rb deleted file mode 100644 index 7b58b0eb21..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/update_filter_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlUpdateFilterTest < Minitest::Test - - context "XPack MachineLearning: Update filter" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'POST', method - assert_equal "_ml/filters/foo/_update", url - assert_equal Hash.new, params - assert_equal Hash.new, body - true - end.returns(FakeResponse.new) - - subject.ml.update_filter :filter_id => 'foo', :body => {} - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/update_job_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/update_job_test.rb deleted file mode 100644 index 15f55690ed..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/update_job_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlUpdateJobTest < Minitest::Test - - context "XPack MachineLearning: Update job" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'POST', method - assert_equal "_ml/anomaly_detectors/foo/_update", url - assert_equal Hash.new, params - assert_equal Hash.new, body - true - end.returns(FakeResponse.new) - - subject.ml.update_job :job_id => 'foo', :body => {} - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/update_model_snapshot_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/update_model_snapshot_test.rb deleted file mode 100644 index 9cf4081018..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/update_model_snapshot_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlUpdateModelSnapshotTest < Minitest::Test - - context "XPack MachineLearning: Update model snapshot" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'POST', method - assert_equal "_ml/anomaly_detectors/foo/model_snapshots/bar/_update", url - assert_equal Hash.new, params - assert_equal Hash.new, body - true - end.returns(FakeResponse.new) - - subject.ml.update_model_snapshot :job_id => 'foo', :snapshot_id => 'bar', :body => {} - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/machine_learning/upgrade_job_snapshot_test.rb b/elasticsearch-api/spec/platinum/unit/machine_learning/upgrade_job_snapshot_test.rb deleted file mode 100644 index 94b8f1c1d1..0000000000 --- a/elasticsearch-api/spec/platinum/unit/machine_learning/upgrade_job_snapshot_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMlUpdateJobSnapshotTest < Minitest::Test - - context "XPack MachineLearning: Upgrade job snapshot" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'POST', method - assert_equal "_ml/anomaly_detectors/foo/model_snapshots/bar/_upgrade", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ml.upgrade_job_snapshot(job_id: 'foo', snapshot_id: 'bar') - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/migration/deprecations_test.rb b/elasticsearch-api/spec/platinum/unit/migration/deprecations_test.rb deleted file mode 100644 index bfda05b72a..0000000000 --- a/elasticsearch-api/spec/platinum/unit/migration/deprecations_test.rb +++ /dev/null @@ -1,42 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackMigrationDeprecationsTest < Minitest::Test - context "XPack Migration: Deprecations" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal '_migration/deprecations', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.migration.deprecations - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/rollup/get_rollup_index_caps_test.rb b/elasticsearch-api/spec/platinum/unit/rollup/get_rollup_index_caps_test.rb deleted file mode 100644 index f0b9bc35e0..0000000000 --- a/elasticsearch-api/spec/platinum/unit/rollup/get_rollup_index_caps_test.rb +++ /dev/null @@ -1,40 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackGetRollupIndexCapsTest < Minitest::Test - context "XPack Rollup: Get index caps" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal "foo/_rollup/data", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.rollup.get_rollup_index_caps :index => 'foo' - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/security/authenticate_test.rb b/elasticsearch-api/spec/platinum/unit/security/authenticate_test.rb deleted file mode 100644 index 8e40d4bee9..0000000000 --- a/elasticsearch-api/spec/platinum/unit/security/authenticate_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackSecurityAuthenticateTest < Minitest::Test - - context "XPack Security: Authenticate" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal '_security/_authenticate', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.security.authenticate - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/security/bulk_update_api_key_test.rb b/elasticsearch-api/spec/platinum/unit/security/bulk_update_api_key_test.rb deleted file mode 100644 index bb37d59589..0000000000 --- a/elasticsearch-api/spec/platinum/unit/security/bulk_update_api_key_test.rb +++ /dev/null @@ -1,40 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class SecurityBulkUpdateApiKeys < Minitest::Test - context 'Security: Bulk Update Api Keys' do - subject { FakeClient.new } - - should 'perform correct request' do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal('POST', method) - assert_equal('_security/api_key/_bulk_update', url) - assert_equal({}, params) - assert_equal(body, {}) - true - end.returns(FakeResponse.new) - - subject.security.bulk_update_api_keys(body: {}) - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/security/change_password_test.rb b/elasticsearch-api/spec/platinum/unit/security/change_password_test.rb deleted file mode 100644 index 69aa130903..0000000000 --- a/elasticsearch-api/spec/platinum/unit/security/change_password_test.rb +++ /dev/null @@ -1,55 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackSecurityChangePasswordTest < Minitest::Test - - context "XPack Security: Change password" do - subject { FakeClient.new } - - should "perform correct request for a specific user" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'PUT', method - assert_equal '_security/user/foo/_password', url - assert_equal Hash.new, params - assert_equal 'bar', body[:password] - true - end.returns(FakeResponse.new) - - subject.security.change_password username: 'foo', body: { password: 'bar' } - end - - should "perform correct request for current user" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'PUT', method - assert_equal '_security/user/_password', url - assert_equal Hash.new, params - assert_equal 'bar', body[:password] - true - end.returns(FakeResponse.new) - - subject.security.change_password body: { password: 'bar' } - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/security/clear_api_key_cache_test.rb b/elasticsearch-api/spec/platinum/unit/security/clear_api_key_cache_test.rb deleted file mode 100644 index c0539a65ff..0000000000 --- a/elasticsearch-api/spec/platinum/unit/security/clear_api_key_cache_test.rb +++ /dev/null @@ -1,40 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackSecurityClearCachedRolesTest < Minitest::Test - context 'XPack Security: Clear api key cache' do - subject { FakeClient.new } - - should 'perform correct request' do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'POST', method - assert_equal '_security/api_key/3/_clear_cache', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.security.clear_api_key_cache(ids: '3') - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/security/clear_cached_privileges_test.rb b/elasticsearch-api/spec/platinum/unit/security/clear_cached_privileges_test.rb deleted file mode 100644 index b03354dc08..0000000000 --- a/elasticsearch-api/spec/platinum/unit/security/clear_cached_privileges_test.rb +++ /dev/null @@ -1,40 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackSecurityClearCachedPrivilegesTest < Minitest::Test - context "XPack Security: Clear cached privileges" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'POST', method - assert_equal "_security/privilege/test/_clear_cache", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.security.clear_cached_privileges application: 'test' - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/security/clear_cached_realms_test.rb b/elasticsearch-api/spec/platinum/unit/security/clear_cached_realms_test.rb deleted file mode 100644 index d245a9edce..0000000000 --- a/elasticsearch-api/spec/platinum/unit/security/clear_cached_realms_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackSecurityClearCachedRealmsTest < Minitest::Test - - context "XPack Security: Clear cached realms" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'POST', method - assert_equal "_security/realm/foo,bar/_clear_cache", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.security.clear_cached_realms :realms => ['foo', 'bar'] - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/security/clear_cached_roles_test.rb b/elasticsearch-api/spec/platinum/unit/security/clear_cached_roles_test.rb deleted file mode 100644 index 3c797ce291..0000000000 --- a/elasticsearch-api/spec/platinum/unit/security/clear_cached_roles_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackSecurityClearCachedRolesTest < Minitest::Test - - context "XPack Security: Clear cached roles" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'POST', method - assert_equal '_security/role/foo/_clear_cache', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.security.clear_cached_roles :name => 'foo' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/security/delete_privileges_test.rb b/elasticsearch-api/spec/platinum/unit/security/delete_privileges_test.rb deleted file mode 100644 index 4742c40a6b..0000000000 --- a/elasticsearch-api/spec/platinum/unit/security/delete_privileges_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackSecurityDeletePrivilegesTest < Minitest::Test - - context "XPack Security: Delete privileges" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'DELETE', method - assert_equal '_security/privilege/foo/bar', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.security.delete_privileges :application => 'foo', name: 'bar' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/security/delete_role_mapping_test.rb b/elasticsearch-api/spec/platinum/unit/security/delete_role_mapping_test.rb deleted file mode 100644 index 8cf05543b3..0000000000 --- a/elasticsearch-api/spec/platinum/unit/security/delete_role_mapping_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackSecurityDeleteRoleMappingTest < Minitest::Test - - context "XPack Security: Delete role mapping" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'DELETE', method - assert_equal '_security/role_mapping/foo', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.security.delete_role_mapping :name => 'foo' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/security/delete_role_test.rb b/elasticsearch-api/spec/platinum/unit/security/delete_role_test.rb deleted file mode 100644 index a3e76c1c97..0000000000 --- a/elasticsearch-api/spec/platinum/unit/security/delete_role_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackSecurityDeleteRoleTest < Minitest::Test - - context "XPack Security: Delete role" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'DELETE', method - assert_equal '_security/role/foo', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.security.delete_role :name => 'foo' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/security/delete_user_test.rb b/elasticsearch-api/spec/platinum/unit/security/delete_user_test.rb deleted file mode 100644 index 5ffeef5904..0000000000 --- a/elasticsearch-api/spec/platinum/unit/security/delete_user_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackSecurityDeleteUserTest < Minitest::Test - - context "XPack Security: Delete user" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'DELETE', method - assert_equal '_security/user/foo', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.security.delete_user :username => 'foo' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/security/disable_user_test.rb b/elasticsearch-api/spec/platinum/unit/security/disable_user_test.rb deleted file mode 100644 index 37d235308a..0000000000 --- a/elasticsearch-api/spec/platinum/unit/security/disable_user_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackSecurityDisableUserTest < Minitest::Test - - context "XPack Security: Disable user" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'PUT', method - assert_equal "_security/user/foo/_disable", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.security.disable_user :username => 'foo' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/security/enable_user_test.rb b/elasticsearch-api/spec/platinum/unit/security/enable_user_test.rb deleted file mode 100644 index c738ac9086..0000000000 --- a/elasticsearch-api/spec/platinum/unit/security/enable_user_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackSecurityEnableUserTest < Minitest::Test - - context "XPack Security: Enable user" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'PUT', method - assert_equal "_security/user/foo/_enable", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.security.enable_user :username => 'foo' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/security/get_privileges_test.rb b/elasticsearch-api/spec/platinum/unit/security/get_privileges_test.rb deleted file mode 100644 index 72ef116e56..0000000000 --- a/elasticsearch-api/spec/platinum/unit/security/get_privileges_test.rb +++ /dev/null @@ -1,78 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackSecurityGetPrivilegesTest < Minitest::Test - - context "XPack Security: Get privileges" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal '_security/privilege', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.security.get_privileges - end - - should "perform correct request for an application but no name" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal '_security/privilege/foo', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.security.get_privileges application: 'foo' - end - - should "perform correct request for an application and a single name" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal '_security/privilege/foo/bar', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.security.get_privileges application: 'foo', name: 'bar' - end - - should "perform correct request for an application and multiple names" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal '_security/privilege/foo/bar,baz', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.security.get_privileges application: 'foo', name: ['bar', 'baz'] - end - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/security/get_role_mapping_test.rb b/elasticsearch-api/spec/platinum/unit/security/get_role_mapping_test.rb deleted file mode 100644 index 75fdf41c93..0000000000 --- a/elasticsearch-api/spec/platinum/unit/security/get_role_mapping_test.rb +++ /dev/null @@ -1,54 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackSecurityGetRoleMappingTest < Minitest::Test - - context "XPack Security: Get role mapping" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal "_security/role_mapping/foo", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.security.get_role_mapping :name => 'foo' - end - - should "handle a list of roles" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal "_security/role_mapping/foo,bar", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.security.get_role_mapping :name => ['foo', 'bar'] - end - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/security/get_role_test.rb b/elasticsearch-api/spec/platinum/unit/security/get_role_test.rb deleted file mode 100644 index e76128dede..0000000000 --- a/elasticsearch-api/spec/platinum/unit/security/get_role_test.rb +++ /dev/null @@ -1,62 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackSecurityGetRoleTest < Minitest::Test - - context "XPack Security: Get role" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal '_security/role', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.security.get_role - end - - should "perform correct request for multiple roles" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal '_security/role/foo,bar', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.security.get_role name: ['foo', 'bar'] - end - - should "catch a NotFound exception with the ignore parameter" do - subject.expects(:perform_request).raises(NotFound) - - assert_nothing_raised do - subject.security.get_role name: 'foo', ignore: 404 - end - end - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/security/get_token_test.rb b/elasticsearch-api/spec/platinum/unit/security/get_token_test.rb deleted file mode 100644 index ebb7a77053..0000000000 --- a/elasticsearch-api/spec/platinum/unit/security/get_token_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackSecurityGetTokenTest < Minitest::Test - - context "XPack Security: Get token" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'POST', method - assert_equal "_security/oauth2/token", url - assert_equal Hash.new, params - assert_equal Hash.new, body - true - end.returns(FakeResponse.new) - - subject.security.get_token :body => {} - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/security/get_user_privileges_test.rb b/elasticsearch-api/spec/platinum/unit/security/get_user_privileges_test.rb deleted file mode 100644 index 42b909a7f9..0000000000 --- a/elasticsearch-api/spec/platinum/unit/security/get_user_privileges_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackSecurityGetUserPrivilegesTest < Minitest::Test - - context "XPack Security: Get user privileges" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal "_security/user/_privileges", url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.security.get_user_privileges - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/security/get_user_test.rb b/elasticsearch-api/spec/platinum/unit/security/get_user_test.rb deleted file mode 100644 index 8a0e036429..0000000000 --- a/elasticsearch-api/spec/platinum/unit/security/get_user_test.rb +++ /dev/null @@ -1,61 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackSecurityGetUserTest < Minitest::Test - - context "XPack Security: Get user" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal '_security/user', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.security.get_user - end - - should "perform correct request for multiple roles" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal '_security/user/foo,bar', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.security.get_user username: ['foo', 'bar'] - end - - should "catch a NotFound exception with the ignore parameter" do - subject.expects(:perform_request).raises(NotFound) - - assert_nothing_raised do - subject.security.get_user username: 'foo', ignore: 404 - end - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/security/grant_api_key_test.rb b/elasticsearch-api/spec/platinum/unit/security/grant_api_key_test.rb deleted file mode 100644 index da372a01ed..0000000000 --- a/elasticsearch-api/spec/platinum/unit/security/grant_api_key_test.rb +++ /dev/null @@ -1,41 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackSecurityGrantApiKey < Minitest::Test - context "XPack Security: Grant API Key" do - subject { FakeClient.new } - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal('POST', method) - assert_equal('_security/api_key/grant', url) - assert_equal(Hash.new, params) - assert_equal(body, {access_token: 'access_token', api_key: 'api_key', grant_type: 'access_token'}) - true - end.returns(FakeResponse.new) - - subject.security.grant_api_key( - body: {access_token: 'access_token', api_key: 'api_key', grant_type: 'access_token'} - ) - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/security/has_privileges_test.rb b/elasticsearch-api/spec/platinum/unit/security/has_privileges_test.rb deleted file mode 100644 index 9c1a250550..0000000000 --- a/elasticsearch-api/spec/platinum/unit/security/has_privileges_test.rb +++ /dev/null @@ -1,55 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackSecurityHasPrivilegesTest < Minitest::Test - - context "XPack Security: Has Privileges" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'POST', method - assert_equal '_security/user/_has_privileges', url - assert_equal Hash.new, params - assert_equal({ cluster: [], index: [], application: [] }, body) - true - end.returns(FakeResponse.new) - - subject.security.has_privileges(body: { cluster: [], index: [], application: [] }) - end - - should "check privileges for a specific user" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'POST', method - assert_equal '_security/user/foo/_has_privileges', url - assert_equal Hash.new, params - assert_equal({ cluster: [], index: [], application: [] }, body) - true - end.returns(FakeResponse.new) - - subject.security.has_privileges(user: 'foo', body: { cluster: [], index: [], application: [] }) - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/security/invalidate_token_test.rb b/elasticsearch-api/spec/platinum/unit/security/invalidate_token_test.rb deleted file mode 100644 index 797650c4fe..0000000000 --- a/elasticsearch-api/spec/platinum/unit/security/invalidate_token_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackSecurityInvalidateTokenTest < Minitest::Test - - context "XPack Security: Invalidate token" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'DELETE', method - assert_equal "_security/oauth2/token", url - assert_equal Hash.new, params - assert_equal Hash.new, body - true - end.returns(FakeResponse.new) - - subject.security.invalidate_token :body => {} - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/security/oidc_authenticate_test.rb b/elasticsearch-api/spec/platinum/unit/security/oidc_authenticate_test.rb deleted file mode 100644 index 1191c49add..0000000000 --- a/elasticsearch-api/spec/platinum/unit/security/oidc_authenticate_test.rb +++ /dev/null @@ -1,40 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class SecurityOidcAuthenticateTest < Minitest::Test - context 'Security: OIDC Authenticate' do - subject { FakeClient.new } - - should 'perform correct request' do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal('POST', method) - assert_equal('_security/oidc/authenticate', url) - assert_equal({}, params) - assert_equal(body, {}) - true - end.returns(FakeResponse.new) - - subject.security.oidc_authenticate(body: {}) - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/security/oidc_logout_test.rb b/elasticsearch-api/spec/platinum/unit/security/oidc_logout_test.rb deleted file mode 100644 index 539bd23bfb..0000000000 --- a/elasticsearch-api/spec/platinum/unit/security/oidc_logout_test.rb +++ /dev/null @@ -1,40 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class SecurityOidcLogoutTest < Minitest::Test - context 'Security: OIDC Logout' do - subject { FakeClient.new } - - should 'perform correct request' do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal('POST', method) - assert_equal('_security/oidc/logout', url) - assert_equal({}, params) - assert_equal(body, {}) - true - end.returns(FakeResponse.new) - - subject.security.oidc_logout(body: {}) - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/security/oidc_prepare_authentication_test.rb b/elasticsearch-api/spec/platinum/unit/security/oidc_prepare_authentication_test.rb deleted file mode 100644 index f3c90da71c..0000000000 --- a/elasticsearch-api/spec/platinum/unit/security/oidc_prepare_authentication_test.rb +++ /dev/null @@ -1,40 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class SecurityOidcPrepareAuthenticationTest < Minitest::Test - context 'Security: OIDC Prepare_Authentication' do - subject { FakeClient.new } - - should 'perform correct request' do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal('POST', method) - assert_equal('_security/oidc/prepare', url) - assert_equal({}, params) - assert_equal(body, {}) - true - end.returns(FakeResponse.new) - - subject.security.oidc_prepare_authentication(body: {}) - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/security/put_privileges_test.rb b/elasticsearch-api/spec/platinum/unit/security/put_privileges_test.rb deleted file mode 100644 index 3ede21219f..0000000000 --- a/elasticsearch-api/spec/platinum/unit/security/put_privileges_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackSecurityPutPrivilegesTest < Minitest::Test - - context "XPack Security: Put role" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'PUT', method - assert_equal '_security/privilege', url - assert_equal Hash.new, params - assert_equal({ "app-allow": { read: { actions: [ "data:read/*" ] } } }, body) - true - end.returns(FakeResponse.new) - - subject.security.put_privileges(body: { "app-allow": { read: { actions: [ "data:read/*" ] } } }) - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/security/put_role_mapping_test.rb b/elasticsearch-api/spec/platinum/unit/security/put_role_mapping_test.rb deleted file mode 100644 index 9cc883fb39..0000000000 --- a/elasticsearch-api/spec/platinum/unit/security/put_role_mapping_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackSecurityPutRoleMappingTest < Minitest::Test - - context "XPack Security: Put role mapping" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'PUT', method - assert_equal "_security/role_mapping/foo", url - assert_equal Hash.new, params - assert_equal Hash.new, body - true - end.returns(FakeResponse.new) - - subject.security.put_role_mapping :name => 'foo', :body => {} - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/security/put_role_test.rb b/elasticsearch-api/spec/platinum/unit/security/put_role_test.rb deleted file mode 100644 index 388e64e944..0000000000 --- a/elasticsearch-api/spec/platinum/unit/security/put_role_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackSecurityPutRoleTest < Minitest::Test - - context "XPack Security: Put role" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'PUT', method - assert_equal '_security/role/foo', url - assert_equal Hash.new, params - assert_equal Hash.new, body - true - end.returns(FakeResponse.new) - - subject.security.put_role :name => 'foo', body: {} - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/security/put_user_test.rb b/elasticsearch-api/spec/platinum/unit/security/put_user_test.rb deleted file mode 100644 index 3273fce310..0000000000 --- a/elasticsearch-api/spec/platinum/unit/security/put_user_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackSecurityPutUserTest < Minitest::Test - - context "XPack Security: Put user" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'PUT', method - assert_equal '_security/user/foo', url - assert_equal Hash.new, params - assert_equal Hash.new, body - true - end.returns(FakeResponse.new) - - subject.security.put_user username: 'foo', body: {} - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/ssl/certificates_test.rb b/elasticsearch-api/spec/platinum/unit/ssl/certificates_test.rb deleted file mode 100644 index e72774946c..0000000000 --- a/elasticsearch-api/spec/platinum/unit/ssl/certificates_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackSslCertificatesTest < Minitest::Test - - context "XPack Ssl: Certificates" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal '_ssl/certificates', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.ssl.certificates - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/usage_test.rb b/elasticsearch-api/spec/platinum/unit/usage_test.rb deleted file mode 100644 index cf999776fa..0000000000 --- a/elasticsearch-api/spec/platinum/unit/usage_test.rb +++ /dev/null @@ -1,40 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackUsageTest < Minitest::Test - context 'XPack: Usage' do - subject { FakeClient.new } - - should 'perform correct request' do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal('GET', method) - assert_equal('_xpack/usage', url) - assert_equal({}, params) - assert_nil(body) - true - end.returns(FakeResponse.new) - - subject.xpack.usage - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/watcher/ack_watch_test.rb b/elasticsearch-api/spec/platinum/unit/watcher/ack_watch_test.rb deleted file mode 100644 index 33f2d3bc2e..0000000000 --- a/elasticsearch-api/spec/platinum/unit/watcher/ack_watch_test.rb +++ /dev/null @@ -1,55 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackWatcherAckWatchTest < Minitest::Test - - context "XPack Watcher: Ack watch" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'PUT', method - assert_equal '_watcher/watch/foo/_ack', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.watcher.ack_watch watch_id: 'foo' - end - - should "perform correct request when action id is provided" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'PUT', method - assert_equal '_watcher/watch/foo/_ack/bar', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.watcher.ack_watch watch_id: 'foo', action_id: 'bar' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/watcher/activate_watch_test.rb b/elasticsearch-api/spec/platinum/unit/watcher/activate_watch_test.rb deleted file mode 100644 index 1cb1aa0621..0000000000 --- a/elasticsearch-api/spec/platinum/unit/watcher/activate_watch_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackWatcherActivateWatchTest < Minitest::Test - - context "XPack Watcher: Activate watch" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'PUT', method - assert_equal '_watcher/watch/foo/_activate', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.watcher.activate_watch watch_id: 'foo' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/watcher/deactivate_watch_test.rb b/elasticsearch-api/spec/platinum/unit/watcher/deactivate_watch_test.rb deleted file mode 100644 index f51080579c..0000000000 --- a/elasticsearch-api/spec/platinum/unit/watcher/deactivate_watch_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackWatcherDeactivateWatchTest < Minitest::Test - - context "XPack Watcher: Deactivate watch" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'PUT', method - assert_equal '_watcher/watch/foo/_deactivate', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.watcher.deactivate_watch watch_id: 'foo' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/watcher/delete_watch_test.rb b/elasticsearch-api/spec/platinum/unit/watcher/delete_watch_test.rb deleted file mode 100644 index 674299adec..0000000000 --- a/elasticsearch-api/spec/platinum/unit/watcher/delete_watch_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackWatcherDeleteWatchTest < Minitest::Test - - context "XPack Watcher: Delete watch" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'DELETE', method - assert_equal '_watcher/watch/foo', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.watcher.delete_watch id: 'foo' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/watcher/execute_watch_test.rb b/elasticsearch-api/spec/platinum/unit/watcher/execute_watch_test.rb deleted file mode 100644 index 6b387f04f6..0000000000 --- a/elasticsearch-api/spec/platinum/unit/watcher/execute_watch_test.rb +++ /dev/null @@ -1,55 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackWatcherExecuteWatchTest < Minitest::Test - - context "XPack Watcher: Execute watch" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'PUT', method - assert_equal '_watcher/watch/foo/_execute', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.watcher.execute_watch id: 'foo' - end - - should "perform correct request with no id specified" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'PUT', method - assert_equal '_watcher/watch/_execute', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.watcher.execute_watch - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/watcher/get_watch_test.rb b/elasticsearch-api/spec/platinum/unit/watcher/get_watch_test.rb deleted file mode 100644 index f3c866e0ef..0000000000 --- a/elasticsearch-api/spec/platinum/unit/watcher/get_watch_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackWatcherGetWatchTest < Minitest::Test - - context "XPack Watcher: Get watch" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal '_watcher/watch/foo', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.watcher.get_watch id: 'foo' - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/watcher/put_watch_test.rb b/elasticsearch-api/spec/platinum/unit/watcher/put_watch_test.rb deleted file mode 100644 index 782c8334a1..0000000000 --- a/elasticsearch-api/spec/platinum/unit/watcher/put_watch_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackWatcherPutWatchTest < Minitest::Test - - context "XPack Watcher: Put watch" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'PUT', method - assert_equal '_watcher/watch/foo', url - assert_equal Hash.new, params - assert_equal Hash.new, body - true - end.returns(FakeResponse.new) - - subject.watcher.put_watch id: 'foo', body: {} - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/watcher/query_watches_test.rb b/elasticsearch-api/spec/platinum/unit/watcher/query_watches_test.rb deleted file mode 100644 index c544bed6ca..0000000000 --- a/elasticsearch-api/spec/platinum/unit/watcher/query_watches_test.rb +++ /dev/null @@ -1,52 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackWatcherQueryWatchesTest < Minitest::Test - context "XPack Watcher: Query watches" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal('GET', method) - assert_equal('_watcher/_query/watches', url) - assert_equal(params, {}) - assert_nil(body) - true - end.returns(FakeResponse.new) - - subject.watcher.query_watches - end - - should "perform correct request when sending body" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal('POST', method) - assert_equal('_watcher/_query/watches', url) - assert_equal(params, {}) - assert_equal(body, {}) - true - end.returns(FakeResponse.new) - - subject.watcher.query_watches(body: {}) - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/watcher/start_test.rb b/elasticsearch-api/spec/platinum/unit/watcher/start_test.rb deleted file mode 100644 index 0387758fc5..0000000000 --- a/elasticsearch-api/spec/platinum/unit/watcher/start_test.rb +++ /dev/null @@ -1,41 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackWatcherStartTest < Minitest::Test - - context "XPack Watcher: Start" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'POST', method - assert_equal '_watcher/_start', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.watcher.start - end - end - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/watcher/stats_test.rb b/elasticsearch-api/spec/platinum/unit/watcher/stats_test.rb deleted file mode 100644 index ca272d9eb2..0000000000 --- a/elasticsearch-api/spec/platinum/unit/watcher/stats_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackWatcherStatsTest < Minitest::Test - - context "XPack Watcher: Stats" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal '_watcher/stats', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.watcher.stats - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/platinum/unit/watcher/stop_test.rb b/elasticsearch-api/spec/platinum/unit/watcher/stop_test.rb deleted file mode 100644 index 2a1e8a8a54..0000000000 --- a/elasticsearch-api/spec/platinum/unit/watcher/stop_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -require 'test_helper' - -module Elasticsearch - module Test - class XPackWatcherStopTest < Minitest::Test - - context "XPack Watcher: Stop" do - subject { FakeClient.new } - - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'POST', method - assert_equal '_watcher/_stop', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) - - subject.watcher.stop - end - - end - - end - end -end diff --git a/elasticsearch-api/spec/rest_api/README.md b/elasticsearch-api/spec/rest_api/README.md new file mode 100644 index 0000000000..776a0e9f9b --- /dev/null +++ b/elasticsearch-api/spec/rest_api/README.md @@ -0,0 +1 @@ +This directory contains the files to run the Elasticsearch REST API Spec tests. See [../../api-spec-testing/README.md'](api-spec-testing). diff --git a/elasticsearch-api/spec/spec_helper.rb b/elasticsearch-api/spec/spec_helper.rb index a550a4867f..b7c649670b 100644 --- a/elasticsearch-api/spec/spec_helper.rb +++ b/elasticsearch-api/spec/spec_helper.rb @@ -25,7 +25,7 @@ require 'debug' end require 'yaml' -require 'active_support/isolated_execution_state' unless RUBY_VERSION < '2.7.0' +# require 'active_support/isolated_execution_state' unless RUBY_VERSION < '2.7.0' require 'jbuilder' require 'jsonify' require 'elasticsearch' diff --git a/elasticsearch-api/spec/free/integration/health_spec.rb b/elasticsearch-api/spec/unit/actions/async_search/delete_spec.rb similarity index 63% rename from elasticsearch-api/spec/free/integration/health_spec.rb rename to elasticsearch-api/spec/unit/actions/async_search/delete_spec.rb index 1f76467e68..ec320a4f73 100644 --- a/elasticsearch-api/spec/free/integration/health_spec.rb +++ b/elasticsearch-api/spec/unit/actions/async_search/delete_spec.rb @@ -14,15 +14,22 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -# TODO: These tests won't be necessary once we migrate to the new YAML tests -require_relative './spec_helper' -describe "Health basic test" do +require 'spec_helper' + +describe 'client#async_search.delete' do + let(:expected_args) do + [ + 'DELETE', + '_async_search/foo', + {}, + nil, + {}, + { defined_params: { id: 'foo' }, endpoint: 'async_search.delete' } + ] + end + it 'performs the request' do - response = CLIENT.health_report - expect(response.status).to eq 200 - expect(response['cluster_name']).not_to be_nil - expect(response.dig('indicators', 'master_is_stable', 'symptom')).to eq 'The cluster has a stable master node' - expect(response.dig('indicators', 'master_is_stable', 'status')).to eq 'green' + expect(client_double.async_search.delete(id: 'foo')).to be_a Elasticsearch::API::Response end end diff --git a/elasticsearch-api/spec/free/integration/spec_helper.rb b/elasticsearch-api/spec/unit/actions/async_search/get_spec.rb similarity index 63% rename from elasticsearch-api/spec/free/integration/spec_helper.rb rename to elasticsearch-api/spec/unit/actions/async_search/get_spec.rb index 81c38c0ca4..4eab487c50 100644 --- a/elasticsearch-api/spec/free/integration/spec_helper.rb +++ b/elasticsearch-api/spec/unit/actions/async_search/get_spec.rb @@ -14,15 +14,22 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -require 'elasticsearch' -host = ENV['TEST_ES_SERVER'] || 'http://localhost:9200' -raise URI::InvalidURIError unless host =~ /\A#{URI::DEFAULT_PARSER.make_regexp}\z/ +require 'spec_helper' -test_suite = ENV['TEST_SUITE'] || 'free' -password = ENV['ELASTIC_PASSWORD'] || 'changeme' -uri = URI.parse(host) -transport_options = {} -host = "http://elastic:#{password}@#{uri.host}:#{uri.port}".freeze +describe 'client#async_search.get' do + let(:expected_args) do + [ + 'GET', + '_async_search/foo', + {}, + nil, + {}, + { defined_params: { id: 'foo' }, endpoint: 'async_search.get' } + ] + end -CLIENT = Elasticsearch::Client.new(host: host, transport_options: transport_options) + it 'performs the request' do + expect(client_double.async_search.get(id: 'foo')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/unit/actions/async_search/status_spec.rb b/elasticsearch-api/spec/unit/actions/async_search/status_spec.rb new file mode 100644 index 0000000000..d170e8d3a2 --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/async_search/status_spec.rb @@ -0,0 +1,35 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client#async_search.status' do + let(:expected_args) do + [ + 'GET', + '_async_search/status/foo', + {}, + nil, + {}, + { defined_params: { id: 'foo' }, endpoint: 'async_search.status' } + ] + end + + it 'performs the request' do + expect(client_double.async_search.status(id: 'foo')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/unit/actions/async_search/submit_spec.rb b/elasticsearch-api/spec/unit/actions/async_search/submit_spec.rb new file mode 100644 index 0000000000..51c1b60dea --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/async_search/submit_spec.rb @@ -0,0 +1,35 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client#async_search.submit' do + let(:expected_args) do + [ + 'POST', + 'foo/_async_search', + {}, + nil, + {}, + { defined_params: { index: 'foo' }, endpoint: 'async_search.submit' } + ] + end + + it 'performs the request' do + expect(client_double.async_search.submit(index: 'foo')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/bulk_spec.rb b/elasticsearch-api/spec/unit/actions/bulk_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/bulk_spec.rb rename to elasticsearch-api/spec/unit/actions/bulk_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/cat/aliases_spec.rb b/elasticsearch-api/spec/unit/actions/cat/aliases_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/cat/aliases_spec.rb rename to elasticsearch-api/spec/unit/actions/cat/aliases_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/cat/allocation_spec.rb b/elasticsearch-api/spec/unit/actions/cat/allocation_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/cat/allocation_spec.rb rename to elasticsearch-api/spec/unit/actions/cat/allocation_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/cat/component_templates_spec.rb b/elasticsearch-api/spec/unit/actions/cat/component_templates_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/cat/component_templates_spec.rb rename to elasticsearch-api/spec/unit/actions/cat/component_templates_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/cat/count_spec.rb b/elasticsearch-api/spec/unit/actions/cat/count_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/cat/count_spec.rb rename to elasticsearch-api/spec/unit/actions/cat/count_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/cat/fielddata_spec.rb b/elasticsearch-api/spec/unit/actions/cat/fielddata_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/cat/fielddata_spec.rb rename to elasticsearch-api/spec/unit/actions/cat/fielddata_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/cat/health_spec.rb b/elasticsearch-api/spec/unit/actions/cat/health_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/cat/health_spec.rb rename to elasticsearch-api/spec/unit/actions/cat/health_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/cat/help_spec.rb b/elasticsearch-api/spec/unit/actions/cat/help_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/cat/help_spec.rb rename to elasticsearch-api/spec/unit/actions/cat/help_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/cat/indices_spec.rb b/elasticsearch-api/spec/unit/actions/cat/indices_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/cat/indices_spec.rb rename to elasticsearch-api/spec/unit/actions/cat/indices_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/cat/master_spec.rb b/elasticsearch-api/spec/unit/actions/cat/master_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/cat/master_spec.rb rename to elasticsearch-api/spec/unit/actions/cat/master_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/cat/nodeattrs_spec.rb b/elasticsearch-api/spec/unit/actions/cat/nodeattrs_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/cat/nodeattrs_spec.rb rename to elasticsearch-api/spec/unit/actions/cat/nodeattrs_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/cat/nodes_spec.rb b/elasticsearch-api/spec/unit/actions/cat/nodes_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/cat/nodes_spec.rb rename to elasticsearch-api/spec/unit/actions/cat/nodes_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/cat/pending_tasks_spec.rb b/elasticsearch-api/spec/unit/actions/cat/pending_tasks_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/cat/pending_tasks_spec.rb rename to elasticsearch-api/spec/unit/actions/cat/pending_tasks_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/cat/plugins_spec.rb b/elasticsearch-api/spec/unit/actions/cat/plugins_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/cat/plugins_spec.rb rename to elasticsearch-api/spec/unit/actions/cat/plugins_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/cat/recovery_spec.rb b/elasticsearch-api/spec/unit/actions/cat/recovery_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/cat/recovery_spec.rb rename to elasticsearch-api/spec/unit/actions/cat/recovery_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/cat/repositories_spec.rb b/elasticsearch-api/spec/unit/actions/cat/repositories_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/cat/repositories_spec.rb rename to elasticsearch-api/spec/unit/actions/cat/repositories_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/cat/segments_spec.rb b/elasticsearch-api/spec/unit/actions/cat/segments_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/cat/segments_spec.rb rename to elasticsearch-api/spec/unit/actions/cat/segments_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/cat/shards_spec.rb b/elasticsearch-api/spec/unit/actions/cat/shards_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/cat/shards_spec.rb rename to elasticsearch-api/spec/unit/actions/cat/shards_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/cat/snapshot_spec.rb b/elasticsearch-api/spec/unit/actions/cat/snapshot_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/cat/snapshot_spec.rb rename to elasticsearch-api/spec/unit/actions/cat/snapshot_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/cat/tasks_spec.rb b/elasticsearch-api/spec/unit/actions/cat/tasks_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/cat/tasks_spec.rb rename to elasticsearch-api/spec/unit/actions/cat/tasks_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/cat/templates_spec.rb b/elasticsearch-api/spec/unit/actions/cat/templates_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/cat/templates_spec.rb rename to elasticsearch-api/spec/unit/actions/cat/templates_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/cat/thread_pool_spec.rb b/elasticsearch-api/spec/unit/actions/cat/thread_pool_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/cat/thread_pool_spec.rb rename to elasticsearch-api/spec/unit/actions/cat/thread_pool_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/clear_scroll_spec.rb b/elasticsearch-api/spec/unit/actions/clear_scroll_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/clear_scroll_spec.rb rename to elasticsearch-api/spec/unit/actions/clear_scroll_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/close_point_in_time_spec.rb b/elasticsearch-api/spec/unit/actions/close_point_in_time_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/close_point_in_time_spec.rb rename to elasticsearch-api/spec/unit/actions/close_point_in_time_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/cluster/allocation_explain_spec.rb b/elasticsearch-api/spec/unit/actions/cluster/allocation_explain_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/cluster/allocation_explain_spec.rb rename to elasticsearch-api/spec/unit/actions/cluster/allocation_explain_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/cluster/get_settings_spec.rb b/elasticsearch-api/spec/unit/actions/cluster/get_settings_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/cluster/get_settings_spec.rb rename to elasticsearch-api/spec/unit/actions/cluster/get_settings_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/cluster/health_spec.rb b/elasticsearch-api/spec/unit/actions/cluster/health_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/cluster/health_spec.rb rename to elasticsearch-api/spec/unit/actions/cluster/health_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/cluster/info_spec.rb b/elasticsearch-api/spec/unit/actions/cluster/info_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/cluster/info_spec.rb rename to elasticsearch-api/spec/unit/actions/cluster/info_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/cluster/pending_tasks_spec.rb b/elasticsearch-api/spec/unit/actions/cluster/pending_tasks_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/cluster/pending_tasks_spec.rb rename to elasticsearch-api/spec/unit/actions/cluster/pending_tasks_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/cluster/put_settings_spec.rb b/elasticsearch-api/spec/unit/actions/cluster/put_settings_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/cluster/put_settings_spec.rb rename to elasticsearch-api/spec/unit/actions/cluster/put_settings_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/cluster/remote_info_spec.rb b/elasticsearch-api/spec/unit/actions/cluster/remote_info_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/cluster/remote_info_spec.rb rename to elasticsearch-api/spec/unit/actions/cluster/remote_info_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/cluster/reroute_spec.rb b/elasticsearch-api/spec/unit/actions/cluster/reroute_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/cluster/reroute_spec.rb rename to elasticsearch-api/spec/unit/actions/cluster/reroute_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/cluster/state_spec.rb b/elasticsearch-api/spec/unit/actions/cluster/state_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/cluster/state_spec.rb rename to elasticsearch-api/spec/unit/actions/cluster/state_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/cluster/stats_spec.rb b/elasticsearch-api/spec/unit/actions/cluster/stats_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/cluster/stats_spec.rb rename to elasticsearch-api/spec/unit/actions/cluster/stats_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/connector/check_in_spec.rb b/elasticsearch-api/spec/unit/actions/connector/check_in_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/connector/check_in_spec.rb rename to elasticsearch-api/spec/unit/actions/connector/check_in_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/connector/delete_spec.rb b/elasticsearch-api/spec/unit/actions/connector/delete_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/connector/delete_spec.rb rename to elasticsearch-api/spec/unit/actions/connector/delete_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/connector/get_spec.rb b/elasticsearch-api/spec/unit/actions/connector/get_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/connector/get_spec.rb rename to elasticsearch-api/spec/unit/actions/connector/get_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/connector/last_sync_spec.rb b/elasticsearch-api/spec/unit/actions/connector/last_sync_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/connector/last_sync_spec.rb rename to elasticsearch-api/spec/unit/actions/connector/last_sync_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/connector/list_spec.rb b/elasticsearch-api/spec/unit/actions/connector/list_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/connector/list_spec.rb rename to elasticsearch-api/spec/unit/actions/connector/list_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/connector/post_spec.rb b/elasticsearch-api/spec/unit/actions/connector/post_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/connector/post_spec.rb rename to elasticsearch-api/spec/unit/actions/connector/post_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/connector/put_spec.rb b/elasticsearch-api/spec/unit/actions/connector/put_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/connector/put_spec.rb rename to elasticsearch-api/spec/unit/actions/connector/put_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/connector/sync_job_claim_spec.rb b/elasticsearch-api/spec/unit/actions/connector/sync_job_claim_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/connector/sync_job_claim_spec.rb rename to elasticsearch-api/spec/unit/actions/connector/sync_job_claim_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/connector/update_active_filtering_spec.rb b/elasticsearch-api/spec/unit/actions/connector/update_active_filtering_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/connector/update_active_filtering_spec.rb rename to elasticsearch-api/spec/unit/actions/connector/update_active_filtering_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/connector/update_api_key_id_spec.rb b/elasticsearch-api/spec/unit/actions/connector/update_api_key_id_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/connector/update_api_key_id_spec.rb rename to elasticsearch-api/spec/unit/actions/connector/update_api_key_id_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/connector/update_configuration_spec.rb b/elasticsearch-api/spec/unit/actions/connector/update_configuration_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/connector/update_configuration_spec.rb rename to elasticsearch-api/spec/unit/actions/connector/update_configuration_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/connector/update_error_spec.rb b/elasticsearch-api/spec/unit/actions/connector/update_error_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/connector/update_error_spec.rb rename to elasticsearch-api/spec/unit/actions/connector/update_error_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/connector/update_features_spec.rb b/elasticsearch-api/spec/unit/actions/connector/update_features_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/connector/update_features_spec.rb rename to elasticsearch-api/spec/unit/actions/connector/update_features_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/connector/update_filtering_spec.rb b/elasticsearch-api/spec/unit/actions/connector/update_filtering_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/connector/update_filtering_spec.rb rename to elasticsearch-api/spec/unit/actions/connector/update_filtering_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/connector/update_filtering_validation_spec.rb b/elasticsearch-api/spec/unit/actions/connector/update_filtering_validation_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/connector/update_filtering_validation_spec.rb rename to elasticsearch-api/spec/unit/actions/connector/update_filtering_validation_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/connector/update_index_name_spec.rb b/elasticsearch-api/spec/unit/actions/connector/update_index_name_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/connector/update_index_name_spec.rb rename to elasticsearch-api/spec/unit/actions/connector/update_index_name_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/connector/update_name_spec.rb b/elasticsearch-api/spec/unit/actions/connector/update_name_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/connector/update_name_spec.rb rename to elasticsearch-api/spec/unit/actions/connector/update_name_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/connector/update_native_spec.rb b/elasticsearch-api/spec/unit/actions/connector/update_native_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/connector/update_native_spec.rb rename to elasticsearch-api/spec/unit/actions/connector/update_native_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/connector/update_pipeline_spec.rb b/elasticsearch-api/spec/unit/actions/connector/update_pipeline_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/connector/update_pipeline_spec.rb rename to elasticsearch-api/spec/unit/actions/connector/update_pipeline_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/connector/update_scheduling_spec.rb b/elasticsearch-api/spec/unit/actions/connector/update_scheduling_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/connector/update_scheduling_spec.rb rename to elasticsearch-api/spec/unit/actions/connector/update_scheduling_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/connector/update_service_type_spec.rb b/elasticsearch-api/spec/unit/actions/connector/update_service_type_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/connector/update_service_type_spec.rb rename to elasticsearch-api/spec/unit/actions/connector/update_service_type_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/connector/update_status_spec.rb b/elasticsearch-api/spec/unit/actions/connector/update_status_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/connector/update_status_spec.rb rename to elasticsearch-api/spec/unit/actions/connector/update_status_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/connector_sync_job/cancel_spec.rb b/elasticsearch-api/spec/unit/actions/connector_sync_job/cancel_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/connector_sync_job/cancel_spec.rb rename to elasticsearch-api/spec/unit/actions/connector_sync_job/cancel_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/connector_sync_job/check_in_spec.rb b/elasticsearch-api/spec/unit/actions/connector_sync_job/check_in_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/connector_sync_job/check_in_spec.rb rename to elasticsearch-api/spec/unit/actions/connector_sync_job/check_in_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/connector_sync_job/delete_spec.rb b/elasticsearch-api/spec/unit/actions/connector_sync_job/delete_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/connector_sync_job/delete_spec.rb rename to elasticsearch-api/spec/unit/actions/connector_sync_job/delete_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/connector_sync_job/error_spec.rb b/elasticsearch-api/spec/unit/actions/connector_sync_job/error_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/connector_sync_job/error_spec.rb rename to elasticsearch-api/spec/unit/actions/connector_sync_job/error_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/connector_sync_job/get_spec.rb b/elasticsearch-api/spec/unit/actions/connector_sync_job/get_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/connector_sync_job/get_spec.rb rename to elasticsearch-api/spec/unit/actions/connector_sync_job/get_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/connector_sync_job/list_spec.rb b/elasticsearch-api/spec/unit/actions/connector_sync_job/list_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/connector_sync_job/list_spec.rb rename to elasticsearch-api/spec/unit/actions/connector_sync_job/list_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/connector_sync_job/post_spec.rb b/elasticsearch-api/spec/unit/actions/connector_sync_job/post_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/connector_sync_job/post_spec.rb rename to elasticsearch-api/spec/unit/actions/connector_sync_job/post_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/connector_sync_job/update_stats_spec.rb b/elasticsearch-api/spec/unit/actions/connector_sync_job/update_stats_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/connector_sync_job/update_stats_spec.rb rename to elasticsearch-api/spec/unit/actions/connector_sync_job/update_stats_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/count_spec.rb b/elasticsearch-api/spec/unit/actions/count_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/count_spec.rb rename to elasticsearch-api/spec/unit/actions/count_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/create_document_spec.rb b/elasticsearch-api/spec/unit/actions/create_document_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/create_document_spec.rb rename to elasticsearch-api/spec/unit/actions/create_document_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/dangling_indices/delete_dangling_indices_spec.rb b/elasticsearch-api/spec/unit/actions/dangling_indices/delete_dangling_indices_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/dangling_indices/delete_dangling_indices_spec.rb rename to elasticsearch-api/spec/unit/actions/dangling_indices/delete_dangling_indices_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/dangling_indices/import_dangling_indices_spec.rb b/elasticsearch-api/spec/unit/actions/dangling_indices/import_dangling_indices_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/dangling_indices/import_dangling_indices_spec.rb rename to elasticsearch-api/spec/unit/actions/dangling_indices/import_dangling_indices_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/dangling_indices/list_dangling_indices_spec.rb b/elasticsearch-api/spec/unit/actions/dangling_indices/list_dangling_indices_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/dangling_indices/list_dangling_indices_spec.rb rename to elasticsearch-api/spec/unit/actions/dangling_indices/list_dangling_indices_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/data_frame/update_data_frame_transform_spec.rb b/elasticsearch-api/spec/unit/actions/data_frame/update_data_frame_transform_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/data_frame/update_data_frame_transform_spec.rb rename to elasticsearch-api/spec/unit/actions/data_frame/update_data_frame_transform_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/delete_by_query_spec.rb b/elasticsearch-api/spec/unit/actions/delete_by_query_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/delete_by_query_spec.rb rename to elasticsearch-api/spec/unit/actions/delete_by_query_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/delete_document_spec.rb b/elasticsearch-api/spec/unit/actions/delete_document_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/delete_document_spec.rb rename to elasticsearch-api/spec/unit/actions/delete_document_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/delete_script_spec.rb b/elasticsearch-api/spec/unit/actions/delete_script_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/delete_script_spec.rb rename to elasticsearch-api/spec/unit/actions/delete_script_spec.rb diff --git a/elasticsearch-api/spec/unit/actions/enrich/delete_policy_spec.rb b/elasticsearch-api/spec/unit/actions/enrich/delete_policy_spec.rb new file mode 100644 index 0000000000..e240b3217c --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/enrich/delete_policy_spec.rb @@ -0,0 +1,35 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client#enrich.delete_policy' do + let(:expected_args) do + [ + 'DELETE', + '_enrich/policy/foo', + {}, + nil, + {}, + { defined_params: { name: 'foo' }, endpoint: 'enrich.delete_policy' } + ] + end + + it 'performs the request' do + expect(client_double.enrich.delete_policy(name: 'foo')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/unit/actions/enrich/execute_policy_spec.rb b/elasticsearch-api/spec/unit/actions/enrich/execute_policy_spec.rb new file mode 100644 index 0000000000..1798a486f7 --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/enrich/execute_policy_spec.rb @@ -0,0 +1,35 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client#enrich.delete_policy' do + let(:expected_args) do + [ + 'PUT', + '_enrich/policy/foo/_execute', + {}, + nil, + {}, + { defined_params: { name: 'foo' }, endpoint: 'enrich.execute_policy' } + ] + end + + it 'performs the request' do + expect(client_double.enrich.execute_policy(name: 'foo')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/unit/actions/enrich/get_policy_spec.rb b/elasticsearch-api/spec/unit/actions/enrich/get_policy_spec.rb new file mode 100644 index 0000000000..7a84856c2e --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/enrich/get_policy_spec.rb @@ -0,0 +1,35 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client#enrich.delete_policy' do + let(:expected_args) do + [ + 'GET', + '_enrich/policy/foo', + {}, + nil, + {}, + { defined_params: { name: 'foo' }, endpoint: 'enrich.get_policy' } + ] + end + + it 'performs the request' do + expect(client_double.enrich.get_policy(name: 'foo')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/unit/actions/enrich/put_policy_spec.rb b/elasticsearch-api/spec/unit/actions/enrich/put_policy_spec.rb new file mode 100644 index 0000000000..6291cf4392 --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/enrich/put_policy_spec.rb @@ -0,0 +1,35 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client#enrich.delete_policy' do + let(:expected_args) do + [ + 'PUT', + '_enrich/policy/foo', + {}, + {}, + {}, + { defined_params: { name: 'foo' }, endpoint: 'enrich.put_policy' } + ] + end + + it 'performs the request' do + expect(client_double.enrich.put_policy(body: {}, name: 'foo')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch/spec/integration/helpers/helpers_spec_helper.rb b/elasticsearch-api/spec/unit/actions/enrich/stats_spec.rb similarity index 71% rename from elasticsearch/spec/integration/helpers/helpers_spec_helper.rb rename to elasticsearch-api/spec/unit/actions/enrich/stats_spec.rb index 1c9b5de18c..2963d4790c 100644 --- a/elasticsearch/spec/integration/helpers/helpers_spec_helper.rb +++ b/elasticsearch-api/spec/unit/actions/enrich/stats_spec.rb @@ -17,13 +17,19 @@ require 'spec_helper' -ELASTICSEARCH_URL = ENV['TEST_ES_SERVER'] || "http://localhost:#{(ENV['PORT'] || 9200)}" -raise URI::InvalidURIError unless ELASTICSEARCH_URL =~ /\A#{URI::DEFAULT_PARSER.make_regexp}\z/ +describe 'client#enrich.delete_policy' do + let(:expected_args) do + [ + 'GET', + '_enrich/_stats', + {}, + nil, + {}, + { endpoint: 'enrich.stats' } + ] + end -def client - @client ||= Elasticsearch::Client.new( - host: ELASTICSEARCH_URL, - user: 'elastic', - password: 'changeme' - ) + it 'performs the request' do + expect(client_double.enrich.stats).to be_a Elasticsearch::API::Response + end end diff --git a/elasticsearch-api/spec/unit/actions/eql/delete_spec.rb b/elasticsearch-api/spec/unit/actions/eql/delete_spec.rb new file mode 100644 index 0000000000..8b070d8221 --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/eql/delete_spec.rb @@ -0,0 +1,35 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client#eql.search' do + let(:expected_args) do + [ + 'DELETE', + '_eql/search/foo', + {}, + nil, + {}, + { defined_params: { id: 'foo' }, endpoint: 'eql.delete' } + ] + end + + it 'performs the request' do + expect(client_double.eql.delete(id: 'foo')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/unit/actions/eql/get_spec.rb b/elasticsearch-api/spec/unit/actions/eql/get_spec.rb new file mode 100644 index 0000000000..4c8cc6dac0 --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/eql/get_spec.rb @@ -0,0 +1,35 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client#eql.search' do + let(:expected_args) do + [ + 'GET', + '_eql/search/foo', + {}, + nil, + {}, + { defined_params: { id: 'foo' }, endpoint: 'eql.get' } + ] + end + + it 'performs the request' do + expect(client_double.eql.get(id: 'foo')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/unit/actions/eql/get_status_spec.rb b/elasticsearch-api/spec/unit/actions/eql/get_status_spec.rb new file mode 100644 index 0000000000..6a7f53533b --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/eql/get_status_spec.rb @@ -0,0 +1,35 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client#eql.search' do + let(:expected_args) do + [ + 'GET', + '_eql/search/status/foo', + {}, + nil, + {}, + { defined_params: { id: 'foo' }, endpoint: 'eql.get_status' } + ] + end + + it 'performs the request' do + expect(client_double.eql.get_status(id: 'foo')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/unit/actions/eql/search_spec.rb b/elasticsearch-api/spec/unit/actions/eql/search_spec.rb new file mode 100644 index 0000000000..6364838f38 --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/eql/search_spec.rb @@ -0,0 +1,35 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client#eql.search' do + let(:expected_args) do + [ + 'POST', + 'foo/_eql/search', + {}, + {}, + {}, + { defined_params: { index: 'foo' }, endpoint: 'eql.search' } + ] + end + + it 'performs the request' do + expect(client_double.eql.search(index: 'foo', body: {})).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/esql/async_query_delete_spec.rb b/elasticsearch-api/spec/unit/actions/esql/async_query_delete_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/esql/async_query_delete_spec.rb rename to elasticsearch-api/spec/unit/actions/esql/async_query_delete_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/esql/async_query_get._spec.rb b/elasticsearch-api/spec/unit/actions/esql/async_query_get._spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/esql/async_query_get._spec.rb rename to elasticsearch-api/spec/unit/actions/esql/async_query_get._spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/esql/async_query_spec.rb b/elasticsearch-api/spec/unit/actions/esql/async_query_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/esql/async_query_spec.rb rename to elasticsearch-api/spec/unit/actions/esql/async_query_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/esql/async_query_stop_spec.rb b/elasticsearch-api/spec/unit/actions/esql/async_query_stop_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/esql/async_query_stop_spec.rb rename to elasticsearch-api/spec/unit/actions/esql/async_query_stop_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/esql/query_spec.rb b/elasticsearch-api/spec/unit/actions/esql/query_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/esql/query_spec.rb rename to elasticsearch-api/spec/unit/actions/esql/query_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/exists_document_spec.rb b/elasticsearch-api/spec/unit/actions/exists_document_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/exists_document_spec.rb rename to elasticsearch-api/spec/unit/actions/exists_document_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/explain_document_spec.rb b/elasticsearch-api/spec/unit/actions/explain_document_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/explain_document_spec.rb rename to elasticsearch-api/spec/unit/actions/explain_document_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/features/get_features_spec.rb b/elasticsearch-api/spec/unit/actions/features/get_features_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/features/get_features_spec.rb rename to elasticsearch-api/spec/unit/actions/features/get_features_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/features/reset_features_spec.rb b/elasticsearch-api/spec/unit/actions/features/reset_features_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/features/reset_features_spec.rb rename to elasticsearch-api/spec/unit/actions/features/reset_features_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/field_caps_spec.rb b/elasticsearch-api/spec/unit/actions/field_caps_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/field_caps_spec.rb rename to elasticsearch-api/spec/unit/actions/field_caps_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/fleet/global_checkpoints_spec.rb b/elasticsearch-api/spec/unit/actions/fleet/global_checkpoints_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/fleet/global_checkpoints_spec.rb rename to elasticsearch-api/spec/unit/actions/fleet/global_checkpoints_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/fleet/msearch_spec.rb b/elasticsearch-api/spec/unit/actions/fleet/msearch_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/fleet/msearch_spec.rb rename to elasticsearch-api/spec/unit/actions/fleet/msearch_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/fleet/search_spec.rb b/elasticsearch-api/spec/unit/actions/fleet/search_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/fleet/search_spec.rb rename to elasticsearch-api/spec/unit/actions/fleet/search_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/get_document_source_spec.rb b/elasticsearch-api/spec/unit/actions/get_document_source_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/get_document_source_spec.rb rename to elasticsearch-api/spec/unit/actions/get_document_source_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/get_document_spec.rb b/elasticsearch-api/spec/unit/actions/get_document_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/get_document_spec.rb rename to elasticsearch-api/spec/unit/actions/get_document_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/get_script_spec.rb b/elasticsearch-api/spec/unit/actions/get_script_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/get_script_spec.rb rename to elasticsearch-api/spec/unit/actions/get_script_spec.rb diff --git a/elasticsearch-api/spec/unit/actions/graph/explore_spec.rb b/elasticsearch-api/spec/unit/actions/graph/explore_spec.rb new file mode 100644 index 0000000000..7415a7b4ab --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/graph/explore_spec.rb @@ -0,0 +1,35 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client#eql.search' do + let(:expected_args) do + [ + 'GET', + 'foo/_graph/explore', + {}, + nil, + {}, + { defined_params: { index: 'foo' }, endpoint: 'graph.explore' } + ] + end + + it 'performs the request' do + expect(client_double.graph.explore(index: 'foo')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/hashie_spec.rb b/elasticsearch-api/spec/unit/actions/hashie_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/hashie_spec.rb rename to elasticsearch-api/spec/unit/actions/hashie_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/health_report_spec.rb b/elasticsearch-api/spec/unit/actions/health_report_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/health_report_spec.rb rename to elasticsearch-api/spec/unit/actions/health_report_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/index_document_spec.rb b/elasticsearch-api/spec/unit/actions/index_document_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/index_document_spec.rb rename to elasticsearch-api/spec/unit/actions/index_document_spec.rb diff --git a/elasticsearch-api/spec/platinum/unit/info_test.rb b/elasticsearch-api/spec/unit/actions/index_lifecycle_management/explain_spec.rb similarity index 58% rename from elasticsearch-api/spec/platinum/unit/info_test.rb rename to elasticsearch-api/spec/unit/actions/index_lifecycle_management/explain_spec.rb index 066b9b6fb2..9f6bc2218f 100644 --- a/elasticsearch-api/spec/platinum/unit/info_test.rb +++ b/elasticsearch-api/spec/unit/actions/index_lifecycle_management/explain_spec.rb @@ -15,26 +15,23 @@ # specific language governing permissions and limitations # under the License. -require 'test_helper' +require 'spec_helper' -module Elasticsearch - module Test - class XPackInfoTest < Minitest::Test - context "XPack: Info" do - subject { FakeClient.new } +describe 'client.index_lifecycle_management#explain' do + let(:expected_args) do + [ + 'GET', + 'foo/_ilm/explain', + {}, + nil, + {}, + { defined_params: { index: 'foo' }, endpoint: 'ilm.explain_lifecycle' } + ] + end - should "perform correct request" do - subject.expects(:perform_request).with do |method, url, params, body| - assert_equal 'GET', method - assert_equal '_xpack', url - assert_equal Hash.new, params - assert_nil body - true - end.returns(FakeResponse.new) + let(:index) { 'foo' } - subject.xpack.info - end - end - end + it 'performs the request' do + expect(client_double.index_lifecycle_management.explain_lifecycle(index: 'foo')).to be_a Elasticsearch::API::Response end end diff --git a/elasticsearch-api/spec/unit/actions/index_lifecycle_management/get_status_spec.rb b/elasticsearch-api/spec/unit/actions/index_lifecycle_management/get_status_spec.rb new file mode 100644 index 0000000000..fd72263150 --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/index_lifecycle_management/get_status_spec.rb @@ -0,0 +1,37 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client.index_lifecycle_management#get_status' do + let(:expected_args) do + [ + 'GET', + '_ilm/status', + {}, + nil, + {}, + { endpoint: 'ilm.get_status' } + ] + end + + let(:index) { 'foo' } + + it 'performs the request' do + expect(client_double.index_lifecycle_management.get_status(index: 'foo')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/index_lifecycle_management/migrate_to_data_tiers_spec.rb b/elasticsearch-api/spec/unit/actions/index_lifecycle_management/migrate_to_data_tiers_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/index_lifecycle_management/migrate_to_data_tiers_spec.rb rename to elasticsearch-api/spec/unit/actions/index_lifecycle_management/migrate_to_data_tiers_spec.rb diff --git a/elasticsearch-api/spec/unit/actions/index_lifecycle_management/move_to_step_spec.rb b/elasticsearch-api/spec/unit/actions/index_lifecycle_management/move_to_step_spec.rb new file mode 100644 index 0000000000..35de205b91 --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/index_lifecycle_management/move_to_step_spec.rb @@ -0,0 +1,37 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client.index_lifecycle_management#move_to_step' do + let(:expected_args) do + [ + 'POST', + '_ilm/move/foo', + {}, + nil, + {}, + { defined_params: { index: 'foo' }, endpoint: 'ilm.move_to_step' } + ] + end + + let(:index) { 'foo' } + + it 'performs the request' do + expect(client_double.index_lifecycle_management.move_to_step(index: 'foo')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/unit/actions/index_lifecycle_management/remove_policy_spec.rb b/elasticsearch-api/spec/unit/actions/index_lifecycle_management/remove_policy_spec.rb new file mode 100644 index 0000000000..900db9b56d --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/index_lifecycle_management/remove_policy_spec.rb @@ -0,0 +1,37 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client.index_lifecycle_management#remove_policy' do + let(:expected_args) do + [ + 'POST', + 'foo/_ilm/remove', + {}, + nil, + {}, + { defined_params: { index: 'foo' }, endpoint: 'ilm.remove_policy' } + ] + end + + let(:index) { 'foo' } + + it 'performs the request' do + expect(client_double.index_lifecycle_management.remove_policy(index: 'foo')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/unit/actions/index_lifecycle_management/retry_policy_spec.rb b/elasticsearch-api/spec/unit/actions/index_lifecycle_management/retry_policy_spec.rb new file mode 100644 index 0000000000..979cadb1ef --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/index_lifecycle_management/retry_policy_spec.rb @@ -0,0 +1,37 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client.index_lifecycle_management#retry' do + let(:expected_args) do + [ + 'POST', + 'foo/_ilm/retry', + {}, + nil, + {}, + { defined_params: { index: 'foo' }, endpoint: 'ilm.retry' } + ] + end + + let(:index) { 'foo' } + + it 'performs the request' do + expect(client_double.index_lifecycle_management.retry(index: 'foo')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/unit/actions/index_lifecycle_management/start_spec.rb b/elasticsearch-api/spec/unit/actions/index_lifecycle_management/start_spec.rb new file mode 100644 index 0000000000..7c98f25335 --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/index_lifecycle_management/start_spec.rb @@ -0,0 +1,37 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client.index_lifecycle_management#start' do + let(:expected_args) do + [ + 'POST', + '_ilm/start', + {}, + nil, + {}, + { endpoint: 'ilm.start' } + ] + end + + let(:index) { 'foo' } + + it 'performs the request' do + expect(client_double.index_lifecycle_management.start).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/unit/actions/index_lifecycle_management/stop_spec.rb b/elasticsearch-api/spec/unit/actions/index_lifecycle_management/stop_spec.rb new file mode 100644 index 0000000000..f64441ea00 --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/index_lifecycle_management/stop_spec.rb @@ -0,0 +1,37 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client.index_lifecycle_management#stop' do + let(:expected_args) do + [ + 'POST', + '_ilm/stop', + {}, + nil, + {}, + { endpoint: 'ilm.stop' } + ] + end + + let(:index) { 'foo' } + + it 'performs the request' do + expect(client_double.index_lifecycle_management.stop).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/add_block_spec.rb b/elasticsearch-api/spec/unit/actions/indices/add_block_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/add_block_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/add_block_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/analyze_spec.rb b/elasticsearch-api/spec/unit/actions/indices/analyze_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/analyze_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/analyze_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/clear_cache_spec.rb b/elasticsearch-api/spec/unit/actions/indices/clear_cache_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/clear_cache_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/clear_cache_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/clone_spec.rb b/elasticsearch-api/spec/unit/actions/indices/clone_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/clone_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/clone_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/close_spec.rb b/elasticsearch-api/spec/unit/actions/indices/close_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/close_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/close_spec.rb diff --git a/elasticsearch-api/spec/unit/actions/indices/create_data_stream_spec.rb b/elasticsearch-api/spec/unit/actions/indices/create_data_stream_spec.rb new file mode 100644 index 0000000000..0297c8f4e5 --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/indices/create_data_stream_spec.rb @@ -0,0 +1,37 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client.indices.create_data_stream' do + let(:expected_args) do + [ + 'PUT', + '_data_stream/foo', + {}, + nil, + {}, + { endpoint: 'indices.create_data_stream', defined_params: { name: 'foo' } } + ] + end + + let(:index) { 'foo' } + + it 'performs the request' do + expect(client_double.indices.create_data_stream(name: 'foo')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/create_spec.rb b/elasticsearch-api/spec/unit/actions/indices/create_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/create_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/create_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/data_streams_stats_spec.rb b/elasticsearch-api/spec/unit/actions/indices/data_streams_stats_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/data_streams_stats_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/data_streams_stats_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/delete_alias_spec.rb b/elasticsearch-api/spec/unit/actions/indices/delete_alias_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/delete_alias_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/delete_alias_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/delete_data_lifecycle_spec.rb b/elasticsearch-api/spec/unit/actions/indices/delete_data_lifecycle_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/delete_data_lifecycle_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/delete_data_lifecycle_spec.rb diff --git a/elasticsearch-api/spec/unit/actions/indices/delete_data_stream_spec.rb b/elasticsearch-api/spec/unit/actions/indices/delete_data_stream_spec.rb new file mode 100644 index 0000000000..f354681fa3 --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/indices/delete_data_stream_spec.rb @@ -0,0 +1,37 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client.indices.delete_data_stream' do + let(:expected_args) do + [ + 'DELETE', + '_data_stream/foo', + {}, + nil, + {}, + { endpoint: 'indices.delete_data_stream', defined_params: { name: 'foo' } } + ] + end + + let(:index) { 'foo' } + + it 'performs the request' do + expect(client_double.indices.delete_data_stream(name: 'foo')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/delete_spec.rb b/elasticsearch-api/spec/unit/actions/indices/delete_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/delete_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/delete_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/delete_template_spec.rb b/elasticsearch-api/spec/unit/actions/indices/delete_template_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/delete_template_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/delete_template_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/disk_usage_spec.rb b/elasticsearch-api/spec/unit/actions/indices/disk_usage_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/disk_usage_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/disk_usage_spec.rb diff --git a/elasticsearch-api/spec/unit/actions/indices/downsample_spec.rb b/elasticsearch-api/spec/unit/actions/indices/downsample_spec.rb new file mode 100644 index 0000000000..a6a71e4aaa --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/indices/downsample_spec.rb @@ -0,0 +1,37 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client.indices.downsample' do + let(:expected_args) do + [ + 'POST', + 'foo/_downsample/bar', + {}, + {}, + {}, + { endpoint: 'indices.downsample', defined_params: { index: 'foo', target_index: 'bar' } } + ] + end + + let(:index) { 'foo' } + + it 'performs the request' do + expect(client_double.indices.downsample(body: {}, index: 'foo', target_index: 'bar')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/exists_alias_spec.rb b/elasticsearch-api/spec/unit/actions/indices/exists_alias_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/exists_alias_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/exists_alias_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/exists_spec.rb b/elasticsearch-api/spec/unit/actions/indices/exists_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/exists_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/exists_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/exists_template_spec.rb b/elasticsearch-api/spec/unit/actions/indices/exists_template_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/exists_template_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/exists_template_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/explain_data_lifecycle_spec.rb b/elasticsearch-api/spec/unit/actions/indices/explain_data_lifecycle_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/explain_data_lifecycle_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/explain_data_lifecycle_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/field_usage_stats_spec.rb b/elasticsearch-api/spec/unit/actions/indices/field_usage_stats_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/field_usage_stats_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/field_usage_stats_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/flush_spec.rb b/elasticsearch-api/spec/unit/actions/indices/flush_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/flush_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/flush_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/forcemerge_spec.rb b/elasticsearch-api/spec/unit/actions/indices/forcemerge_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/forcemerge_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/forcemerge_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/get_alias_spec.rb b/elasticsearch-api/spec/unit/actions/indices/get_alias_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/get_alias_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/get_alias_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/get_data_lifecycle_spec.rb b/elasticsearch-api/spec/unit/actions/indices/get_data_lifecycle_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/get_data_lifecycle_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/get_data_lifecycle_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/get_data_lifecycle_stats_spec.rb b/elasticsearch-api/spec/unit/actions/indices/get_data_lifecycle_stats_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/get_data_lifecycle_stats_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/get_data_lifecycle_stats_spec.rb diff --git a/elasticsearch-api/spec/unit/actions/indices/get_data_stream_spec.rb b/elasticsearch-api/spec/unit/actions/indices/get_data_stream_spec.rb new file mode 100644 index 0000000000..487fe693ee --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/indices/get_data_stream_spec.rb @@ -0,0 +1,37 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client.indices.get_data_stream' do + let(:expected_args) do + [ + 'GET', + '_data_stream', + {}, + nil, + {}, + { endpoint: 'indices.get_data_stream' } + ] + end + + let(:index) { 'foo' } + + it 'performs the request' do + expect(client_double.indices.get_data_stream).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/get_field_mapping_spec.rb b/elasticsearch-api/spec/unit/actions/indices/get_field_mapping_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/get_field_mapping_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/get_field_mapping_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/get_mapping_spec.rb b/elasticsearch-api/spec/unit/actions/indices/get_mapping_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/get_mapping_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/get_mapping_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/get_settings_spec.rb b/elasticsearch-api/spec/unit/actions/indices/get_settings_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/get_settings_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/get_settings_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/get_spec.rb b/elasticsearch-api/spec/unit/actions/indices/get_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/get_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/get_spec.rb diff --git a/elasticsearch-api/spec/unit/actions/indices/migrate_to_data_stream_spec.rb b/elasticsearch-api/spec/unit/actions/indices/migrate_to_data_stream_spec.rb new file mode 100644 index 0000000000..a009ec4545 --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/indices/migrate_to_data_stream_spec.rb @@ -0,0 +1,37 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client.indices.migrate_to_data_stream' do + let(:expected_args) do + [ + 'POST', + '_data_stream/_migrate/foo', + {}, + nil, + {}, + { endpoint: 'indices.migrate_to_data_stream', defined_params: { name: 'foo' } } + ] + end + + let(:index) { 'foo' } + + it 'performs the request' do + expect(client_double.indices.migrate_to_data_stream(name: 'foo')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/unit/actions/indices/modify_data_stream_spec.rb b/elasticsearch-api/spec/unit/actions/indices/modify_data_stream_spec.rb new file mode 100644 index 0000000000..107e01eb01 --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/indices/modify_data_stream_spec.rb @@ -0,0 +1,37 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client.indices.modify_data_stream' do + let(:expected_args) do + [ + 'POST', + '_data_stream/_modify', + {}, + {}, + {}, + { endpoint: 'indices.modify_data_stream' } + ] + end + + let(:index) { 'foo' } + + it 'performs the request' do + expect(client_double.indices.modify_data_stream(body: {})).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/open_spec.rb b/elasticsearch-api/spec/unit/actions/indices/open_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/open_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/open_spec.rb diff --git a/elasticsearch-api/spec/unit/actions/indices/promote_data_stream_spec.rb b/elasticsearch-api/spec/unit/actions/indices/promote_data_stream_spec.rb new file mode 100644 index 0000000000..ec2b2ca08b --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/indices/promote_data_stream_spec.rb @@ -0,0 +1,37 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client.indices.promote_data_stream' do + let(:expected_args) do + [ + 'POST', + '_data_stream/_promote/foo', + {}, + nil, + {}, + { endpoint: 'indices.promote_data_stream', defined_params: { name: 'foo' } } + ] + end + + let(:index) { 'foo' } + + it 'performs the request' do + expect(client_double.indices.promote_data_stream(name: 'foo')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/put_alias_spec.rb b/elasticsearch-api/spec/unit/actions/indices/put_alias_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/put_alias_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/put_alias_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/put_data_lifecycle_spec.rb b/elasticsearch-api/spec/unit/actions/indices/put_data_lifecycle_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/put_data_lifecycle_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/put_data_lifecycle_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/put_mapping_spec.rb b/elasticsearch-api/spec/unit/actions/indices/put_mapping_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/put_mapping_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/put_mapping_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/put_settings_spec.rb b/elasticsearch-api/spec/unit/actions/indices/put_settings_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/put_settings_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/put_settings_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/put_template_spec.rb b/elasticsearch-api/spec/unit/actions/indices/put_template_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/put_template_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/put_template_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/recovery_spec.rb b/elasticsearch-api/spec/unit/actions/indices/recovery_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/recovery_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/recovery_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/refresh_spec.rb b/elasticsearch-api/spec/unit/actions/indices/refresh_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/refresh_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/refresh_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/resolve_cluster_spec.rb b/elasticsearch-api/spec/unit/actions/indices/resolve_cluster_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/resolve_cluster_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/resolve_cluster_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/rollover_spec.rb b/elasticsearch-api/spec/unit/actions/indices/rollover_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/rollover_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/rollover_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/segments_spec.rb b/elasticsearch-api/spec/unit/actions/indices/segments_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/segments_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/segments_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/shard_stores_spec.rb b/elasticsearch-api/spec/unit/actions/indices/shard_stores_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/shard_stores_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/shard_stores_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/shrink_spec.rb b/elasticsearch-api/spec/unit/actions/indices/shrink_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/shrink_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/shrink_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/split_spec.rb b/elasticsearch-api/spec/unit/actions/indices/split_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/split_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/split_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/stats_spec.rb b/elasticsearch-api/spec/unit/actions/indices/stats_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/stats_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/stats_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/update_aliases_spec.rb b/elasticsearch-api/spec/unit/actions/indices/update_aliases_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/update_aliases_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/update_aliases_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/indices/validate_query_spec.rb b/elasticsearch-api/spec/unit/actions/indices/validate_query_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/indices/validate_query_spec.rb rename to elasticsearch-api/spec/unit/actions/indices/validate_query_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/inference/delete_spec.rb b/elasticsearch-api/spec/unit/actions/inference/delete_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/inference/delete_spec.rb rename to elasticsearch-api/spec/unit/actions/inference/delete_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/inference/get_spec.rb b/elasticsearch-api/spec/unit/actions/inference/get_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/inference/get_spec.rb rename to elasticsearch-api/spec/unit/actions/inference/get_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/inference/inference_spec.rb b/elasticsearch-api/spec/unit/actions/inference/inference_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/inference/inference_spec.rb rename to elasticsearch-api/spec/unit/actions/inference/inference_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/inference/put_spec.rb b/elasticsearch-api/spec/unit/actions/inference/put_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/inference/put_spec.rb rename to elasticsearch-api/spec/unit/actions/inference/put_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/inference/stream_inference_spec.rb b/elasticsearch-api/spec/unit/actions/inference/stream_inference_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/inference/stream_inference_spec.rb rename to elasticsearch-api/spec/unit/actions/inference/stream_inference_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/inference/unified_inference_spec.rb b/elasticsearch-api/spec/unit/actions/inference/unified_inference_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/inference/unified_inference_spec.rb rename to elasticsearch-api/spec/unit/actions/inference/unified_inference_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/inference/update_spec.rb b/elasticsearch-api/spec/unit/actions/inference/update_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/inference/update_spec.rb rename to elasticsearch-api/spec/unit/actions/inference/update_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/info_spec.rb b/elasticsearch-api/spec/unit/actions/info_spec.rb similarity index 91% rename from elasticsearch-api/spec/elasticsearch/api/actions/info_spec.rb rename to elasticsearch-api/spec/unit/actions/info_spec.rb index 881496a083..8a26056683 100644 --- a/elasticsearch-api/spec/elasticsearch/api/actions/info_spec.rb +++ b/elasticsearch-api/spec/unit/actions/info_spec.rb @@ -18,15 +18,14 @@ require 'spec_helper' describe 'client#info' do - let(:expected_args) do [ - 'GET', - '', - { }, - nil, - {}, - { endpoint: 'info' } + 'GET', + '', + { }, + nil, + {}, + { endpoint: 'info' } ] end diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/ingest/delete_geoip_database_spec.rb b/elasticsearch-api/spec/unit/actions/ingest/delete_geoip_database_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/ingest/delete_geoip_database_spec.rb rename to elasticsearch-api/spec/unit/actions/ingest/delete_geoip_database_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/ingest/delete_ip_location_database_spec.rb b/elasticsearch-api/spec/unit/actions/ingest/delete_ip_location_database_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/ingest/delete_ip_location_database_spec.rb rename to elasticsearch-api/spec/unit/actions/ingest/delete_ip_location_database_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/ingest/delete_pipeline_spec.rb b/elasticsearch-api/spec/unit/actions/ingest/delete_pipeline_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/ingest/delete_pipeline_spec.rb rename to elasticsearch-api/spec/unit/actions/ingest/delete_pipeline_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/ingest/geo_ip_stats_spec.rb b/elasticsearch-api/spec/unit/actions/ingest/geo_ip_stats_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/ingest/geo_ip_stats_spec.rb rename to elasticsearch-api/spec/unit/actions/ingest/geo_ip_stats_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/ingest/get_geoip_database_spec.rb b/elasticsearch-api/spec/unit/actions/ingest/get_geoip_database_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/ingest/get_geoip_database_spec.rb rename to elasticsearch-api/spec/unit/actions/ingest/get_geoip_database_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/ingest/get_ip_location_database_spec.rb b/elasticsearch-api/spec/unit/actions/ingest/get_ip_location_database_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/ingest/get_ip_location_database_spec.rb rename to elasticsearch-api/spec/unit/actions/ingest/get_ip_location_database_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/ingest/get_pipeline_spec.rb b/elasticsearch-api/spec/unit/actions/ingest/get_pipeline_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/ingest/get_pipeline_spec.rb rename to elasticsearch-api/spec/unit/actions/ingest/get_pipeline_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/ingest/put_geoip_database_spec.rb b/elasticsearch-api/spec/unit/actions/ingest/put_geoip_database_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/ingest/put_geoip_database_spec.rb rename to elasticsearch-api/spec/unit/actions/ingest/put_geoip_database_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/ingest/put_ip_location_database_spec.rb b/elasticsearch-api/spec/unit/actions/ingest/put_ip_location_database_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/ingest/put_ip_location_database_spec.rb rename to elasticsearch-api/spec/unit/actions/ingest/put_ip_location_database_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/ingest/put_pipeline_spec.rb b/elasticsearch-api/spec/unit/actions/ingest/put_pipeline_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/ingest/put_pipeline_spec.rb rename to elasticsearch-api/spec/unit/actions/ingest/put_pipeline_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/ingest/simulate_spec.rb b/elasticsearch-api/spec/unit/actions/ingest/simulate_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/ingest/simulate_spec.rb rename to elasticsearch-api/spec/unit/actions/ingest/simulate_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/json_builders_spec.rb b/elasticsearch-api/spec/unit/actions/json_builders_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/json_builders_spec.rb rename to elasticsearch-api/spec/unit/actions/json_builders_spec.rb diff --git a/elasticsearch-api/spec/unit/actions/knn_search_spec.rb b/elasticsearch-api/spec/unit/actions/knn_search_spec.rb new file mode 100644 index 0000000000..2400b84238 --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/knn_search_spec.rb @@ -0,0 +1,35 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client#knn_search' do + let(:expected_args) do + [ + 'GET', + 'foo/_knn_search', + { }, + nil, + {}, + { endpoint: 'knn_search', defined_params: { index: 'foo' } } + ] + end + + it 'performs the request' do + expect(client_double.knn_search(index: 'foo')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/unit/actions/license/delete_spec.rb b/elasticsearch-api/spec/unit/actions/license/delete_spec.rb new file mode 100644 index 0000000000..01d90496b4 --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/license/delete_spec.rb @@ -0,0 +1,35 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client#license.delete' do + let(:expected_args) do + [ + 'DELETE', + '_license', + { }, + nil, + {}, + { endpoint: 'license.delete' } + ] + end + + it 'performs the request' do + expect(client_double.license.delete).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/unit/actions/license/get_spec.rb b/elasticsearch-api/spec/unit/actions/license/get_spec.rb new file mode 100644 index 0000000000..00727f86d3 --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/license/get_spec.rb @@ -0,0 +1,35 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client#license.get' do + let(:expected_args) do + [ + 'GET', + '_license', + { }, + nil, + {}, + { endpoint: 'license.get' } + ] + end + + it 'performs the request' do + expect(client_double.license.get).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/unit/actions/license/post_spec.rb b/elasticsearch-api/spec/unit/actions/license/post_spec.rb new file mode 100644 index 0000000000..7805b8824b --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/license/post_spec.rb @@ -0,0 +1,35 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client#license.post' do + let(:expected_args) do + [ + 'PUT', + '_license', + { }, + nil, + {}, + { endpoint: 'license.post' } + ] + end + + it 'performs the request' do + expect(client_double.license.post).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/unit/actions/logstash/delete_pipeline_spec.rb b/elasticsearch-api/spec/unit/actions/logstash/delete_pipeline_spec.rb new file mode 100644 index 0000000000..00e18b7740 --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/logstash/delete_pipeline_spec.rb @@ -0,0 +1,35 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client#logstash.delete_pipeline' do + let(:expected_args) do + [ + 'DELETE', + '_logstash/pipeline/foo', + {}, + nil, + {}, + { endpoint: 'logstash.delete_pipeline', defined_params: { id: 'foo' } } + ] + end + + it 'performs the request' do + expect(client_double.logstash.delete_pipeline(id: 'foo')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/unit/actions/logstash/get_pipeline_spec.rb b/elasticsearch-api/spec/unit/actions/logstash/get_pipeline_spec.rb new file mode 100644 index 0000000000..85f7e7fdf7 --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/logstash/get_pipeline_spec.rb @@ -0,0 +1,35 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client#logstash.get_pipeline' do + let(:expected_args) do + [ + 'GET', + '_logstash/pipeline/foo', + {}, + nil, + {}, + { endpoint: 'logstash.get_pipeline', defined_params: { id: 'foo' } } + ] + end + + it 'performs the request' do + expect(client_double.logstash.get_pipeline(id: 'foo')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/unit/actions/logstash/put_pipeline_spec.rb b/elasticsearch-api/spec/unit/actions/logstash/put_pipeline_spec.rb new file mode 100644 index 0000000000..5f6aaf50f9 --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/logstash/put_pipeline_spec.rb @@ -0,0 +1,35 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client#logstash.put_pipeline' do + let(:expected_args) do + [ + 'PUT', + '_logstash/pipeline/foo', + {}, + {}, + {}, + { endpoint: 'logstash.put_pipeline', defined_params: { id: 'foo' } } + ] + end + + it 'performs the request' do + expect(client_double.logstash.put_pipeline(body: {}, id: 'foo')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/unit/actions/machine_learning/clear_trained_model_deployment_cache_spec.rb b/elasticsearch-api/spec/unit/actions/machine_learning/clear_trained_model_deployment_cache_spec.rb new file mode 100644 index 0000000000..48031ad8a4 --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/machine_learning/clear_trained_model_deployment_cache_spec.rb @@ -0,0 +1,35 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client#ml.clear_trained_model_deployment_cache' do + let(:expected_args) do + [ + 'POST', + '_ml/trained_models/foo/deployment/cache/_clear', + {}, + nil, + {}, + { endpoint: 'ml.clear_trained_model_deployment_cache', defined_params: { model_id: 'foo' } } + ] + end + + it 'performs the request' do + expect(client_double.ml.clear_trained_model_deployment_cache(model_id: 'foo')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/machine_learning/get_memory_stats_spec.rb b/elasticsearch-api/spec/unit/actions/machine_learning/get_memory_stats_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/machine_learning/get_memory_stats_spec.rb rename to elasticsearch-api/spec/unit/actions/machine_learning/get_memory_stats_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/machine_learning/get_model_snapshot_upgrade_stats_spec.rb b/elasticsearch-api/spec/unit/actions/machine_learning/get_model_snapshot_upgrade_stats_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/machine_learning/get_model_snapshot_upgrade_stats_spec.rb rename to elasticsearch-api/spec/unit/actions/machine_learning/get_model_snapshot_upgrade_stats_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/machine_learning/infer_trained_model_deployment_spec.rb b/elasticsearch-api/spec/unit/actions/machine_learning/infer_trained_model_deployment_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/machine_learning/infer_trained_model_deployment_spec.rb rename to elasticsearch-api/spec/unit/actions/machine_learning/infer_trained_model_deployment_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/machine_learning/put_trained_model_definition_part_spec.rb b/elasticsearch-api/spec/unit/actions/machine_learning/put_trained_model_definition_part_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/machine_learning/put_trained_model_definition_part_spec.rb rename to elasticsearch-api/spec/unit/actions/machine_learning/put_trained_model_definition_part_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/machine_learning/put_trained_model_vocabulary_spec.rb b/elasticsearch-api/spec/unit/actions/machine_learning/put_trained_model_vocabulary_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/machine_learning/put_trained_model_vocabulary_spec.rb rename to elasticsearch-api/spec/unit/actions/machine_learning/put_trained_model_vocabulary_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/machine_learning/reset_job_spec.rb b/elasticsearch-api/spec/unit/actions/machine_learning/reset_job_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/machine_learning/reset_job_spec.rb rename to elasticsearch-api/spec/unit/actions/machine_learning/reset_job_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/machine_learning/set_upgrade_mode_spec.rb b/elasticsearch-api/spec/unit/actions/machine_learning/set_upgrade_mode_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/machine_learning/set_upgrade_mode_spec.rb rename to elasticsearch-api/spec/unit/actions/machine_learning/set_upgrade_mode_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/machine_learning/start_trained_model_deployment_spec.rb b/elasticsearch-api/spec/unit/actions/machine_learning/start_trained_model_deployment_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/machine_learning/start_trained_model_deployment_spec.rb rename to elasticsearch-api/spec/unit/actions/machine_learning/start_trained_model_deployment_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/machine_learning/stop_trained_model_deployment_spec.rb b/elasticsearch-api/spec/unit/actions/machine_learning/stop_trained_model_deployment_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/machine_learning/stop_trained_model_deployment_spec.rb rename to elasticsearch-api/spec/unit/actions/machine_learning/stop_trained_model_deployment_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/machine_learning/update_trained_model_deployment_spec.rb b/elasticsearch-api/spec/unit/actions/machine_learning/update_trained_model_deployment_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/machine_learning/update_trained_model_deployment_spec.rb rename to elasticsearch-api/spec/unit/actions/machine_learning/update_trained_model_deployment_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/mget_spec.rb b/elasticsearch-api/spec/unit/actions/mget_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/mget_spec.rb rename to elasticsearch-api/spec/unit/actions/mget_spec.rb diff --git a/elasticsearch-api/spec/unit/actions/migration/deprecation_spec.rb b/elasticsearch-api/spec/unit/actions/migration/deprecation_spec.rb new file mode 100644 index 0000000000..e636f904c2 --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/migration/deprecation_spec.rb @@ -0,0 +1,35 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client#migration.deprecations' do + let(:expected_args) do + [ + 'GET', + '_migration/deprecations', + {}, + nil, + {}, + { endpoint: 'migration.deprecations' } + ] + end + + it 'performs the request' do + expect(client_double.migration.deprecations).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/migration/get_feature_upgrade_status_spec.rb b/elasticsearch-api/spec/unit/actions/migration/get_feature_upgrade_status_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/migration/get_feature_upgrade_status_spec.rb rename to elasticsearch-api/spec/unit/actions/migration/get_feature_upgrade_status_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/migration/post_feature_upgrade_spec.rb b/elasticsearch-api/spec/unit/actions/migration/post_feature_upgrade_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/migration/post_feature_upgrade_spec.rb rename to elasticsearch-api/spec/unit/actions/migration/post_feature_upgrade_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/msearch_spec.rb b/elasticsearch-api/spec/unit/actions/msearch_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/msearch_spec.rb rename to elasticsearch-api/spec/unit/actions/msearch_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/msearch_template_spec.rb b/elasticsearch-api/spec/unit/actions/msearch_template_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/msearch_template_spec.rb rename to elasticsearch-api/spec/unit/actions/msearch_template_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/mtermvectors_spec.rb b/elasticsearch-api/spec/unit/actions/mtermvectors_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/mtermvectors_spec.rb rename to elasticsearch-api/spec/unit/actions/mtermvectors_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/nodes/clear_repositories_metering_archive_spec.rb b/elasticsearch-api/spec/unit/actions/nodes/clear_repositories_metering_archive_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/nodes/clear_repositories_metering_archive_spec.rb rename to elasticsearch-api/spec/unit/actions/nodes/clear_repositories_metering_archive_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/nodes/get_repositories_metering_info_spec.rb b/elasticsearch-api/spec/unit/actions/nodes/get_repositories_metering_info_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/nodes/get_repositories_metering_info_spec.rb rename to elasticsearch-api/spec/unit/actions/nodes/get_repositories_metering_info_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/nodes/hot_threads_spec.rb b/elasticsearch-api/spec/unit/actions/nodes/hot_threads_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/nodes/hot_threads_spec.rb rename to elasticsearch-api/spec/unit/actions/nodes/hot_threads_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/nodes/info_spec.rb b/elasticsearch-api/spec/unit/actions/nodes/info_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/nodes/info_spec.rb rename to elasticsearch-api/spec/unit/actions/nodes/info_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/nodes/reload_secure_settings_spec.rb b/elasticsearch-api/spec/unit/actions/nodes/reload_secure_settings_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/nodes/reload_secure_settings_spec.rb rename to elasticsearch-api/spec/unit/actions/nodes/reload_secure_settings_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/nodes/stats_spec.rb b/elasticsearch-api/spec/unit/actions/nodes/stats_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/nodes/stats_spec.rb rename to elasticsearch-api/spec/unit/actions/nodes/stats_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/open_point_in_time_spec.rb b/elasticsearch-api/spec/unit/actions/open_point_in_time_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/open_point_in_time_spec.rb rename to elasticsearch-api/spec/unit/actions/open_point_in_time_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/ping_spec.rb b/elasticsearch-api/spec/unit/actions/ping_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/ping_spec.rb rename to elasticsearch-api/spec/unit/actions/ping_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/put_script_spec.rb b/elasticsearch-api/spec/unit/actions/put_script_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/put_script_spec.rb rename to elasticsearch-api/spec/unit/actions/put_script_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/query_rules/delete_ruleset_spec.rb b/elasticsearch-api/spec/unit/actions/query_rules/delete_ruleset_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/query_rules/delete_ruleset_spec.rb rename to elasticsearch-api/spec/unit/actions/query_rules/delete_ruleset_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/query_rules/delete_spec.rb b/elasticsearch-api/spec/unit/actions/query_rules/delete_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/query_rules/delete_spec.rb rename to elasticsearch-api/spec/unit/actions/query_rules/delete_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/query_rules/get_ruleset_spec.rb b/elasticsearch-api/spec/unit/actions/query_rules/get_ruleset_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/query_rules/get_ruleset_spec.rb rename to elasticsearch-api/spec/unit/actions/query_rules/get_ruleset_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/query_rules/get_spec.rb b/elasticsearch-api/spec/unit/actions/query_rules/get_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/query_rules/get_spec.rb rename to elasticsearch-api/spec/unit/actions/query_rules/get_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/query_rules/put_ruleset_spec.rb b/elasticsearch-api/spec/unit/actions/query_rules/put_ruleset_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/query_rules/put_ruleset_spec.rb rename to elasticsearch-api/spec/unit/actions/query_rules/put_ruleset_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/query_rules/put_spec.rb b/elasticsearch-api/spec/unit/actions/query_rules/put_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/query_rules/put_spec.rb rename to elasticsearch-api/spec/unit/actions/query_rules/put_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/query_rules/test_spec.rb b/elasticsearch-api/spec/unit/actions/query_rules/test_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/query_rules/test_spec.rb rename to elasticsearch-api/spec/unit/actions/query_rules/test_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/rank_eval_spec.rb b/elasticsearch-api/spec/unit/actions/rank_eval_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/rank_eval_spec.rb rename to elasticsearch-api/spec/unit/actions/rank_eval_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/reindex_spec.rb b/elasticsearch-api/spec/unit/actions/reindex_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/reindex_spec.rb rename to elasticsearch-api/spec/unit/actions/reindex_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/render_search_template_spec.rb b/elasticsearch-api/spec/unit/actions/render_search_template_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/render_search_template_spec.rb rename to elasticsearch-api/spec/unit/actions/render_search_template_spec.rb diff --git a/elasticsearch-api/spec/unit/actions/rollup/get_rollup_index_caps_spec.rb b/elasticsearch-api/spec/unit/actions/rollup/get_rollup_index_caps_spec.rb new file mode 100644 index 0000000000..240a98be4b --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/rollup/get_rollup_index_caps_spec.rb @@ -0,0 +1,35 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client#rollup.get_rollup_index_caps' do + let(:expected_args) do + [ + 'GET', + 'foo/_rollup/data', + {}, + nil, + {}, + { endpoint: 'rollup.get_rollup_index_caps', defined_params: { index: 'foo' } } + ] + end + + it 'performs the request' do + expect(client_double.rollup.get_rollup_index_caps(index: 'foo')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/scroll_spec.rb b/elasticsearch-api/spec/unit/actions/scroll_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/scroll_spec.rb rename to elasticsearch-api/spec/unit/actions/scroll_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/search_application/delete_behavioral_analytics_spec.rb b/elasticsearch-api/spec/unit/actions/search_application/delete_behavioral_analytics_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/search_application/delete_behavioral_analytics_spec.rb rename to elasticsearch-api/spec/unit/actions/search_application/delete_behavioral_analytics_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/search_application/delete_spec.rb b/elasticsearch-api/spec/unit/actions/search_application/delete_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/search_application/delete_spec.rb rename to elasticsearch-api/spec/unit/actions/search_application/delete_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/search_application/get_behavioral_analytics_spec.rb b/elasticsearch-api/spec/unit/actions/search_application/get_behavioral_analytics_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/search_application/get_behavioral_analytics_spec.rb rename to elasticsearch-api/spec/unit/actions/search_application/get_behavioral_analytics_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/search_application/get_spec.rb b/elasticsearch-api/spec/unit/actions/search_application/get_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/search_application/get_spec.rb rename to elasticsearch-api/spec/unit/actions/search_application/get_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/search_application/list_spec.rb b/elasticsearch-api/spec/unit/actions/search_application/list_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/search_application/list_spec.rb rename to elasticsearch-api/spec/unit/actions/search_application/list_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/search_application/post_behavioral_analytics_event_spec.rb b/elasticsearch-api/spec/unit/actions/search_application/post_behavioral_analytics_event_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/search_application/post_behavioral_analytics_event_spec.rb rename to elasticsearch-api/spec/unit/actions/search_application/post_behavioral_analytics_event_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/search_application/put_behavioral_analytics_spec.rb b/elasticsearch-api/spec/unit/actions/search_application/put_behavioral_analytics_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/search_application/put_behavioral_analytics_spec.rb rename to elasticsearch-api/spec/unit/actions/search_application/put_behavioral_analytics_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/search_application/put_spec.rb b/elasticsearch-api/spec/unit/actions/search_application/put_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/search_application/put_spec.rb rename to elasticsearch-api/spec/unit/actions/search_application/put_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/search_application/render_query_spec.rb b/elasticsearch-api/spec/unit/actions/search_application/render_query_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/search_application/render_query_spec.rb rename to elasticsearch-api/spec/unit/actions/search_application/render_query_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/search_application/search_spec.rb b/elasticsearch-api/spec/unit/actions/search_application/search_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/search_application/search_spec.rb rename to elasticsearch-api/spec/unit/actions/search_application/search_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/search_mvt_spec.rb b/elasticsearch-api/spec/unit/actions/search_mvt_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/search_mvt_spec.rb rename to elasticsearch-api/spec/unit/actions/search_mvt_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/search_shards_spec.rb b/elasticsearch-api/spec/unit/actions/search_shards_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/search_shards_spec.rb rename to elasticsearch-api/spec/unit/actions/search_shards_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/search_spec.rb b/elasticsearch-api/spec/unit/actions/search_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/search_spec.rb rename to elasticsearch-api/spec/unit/actions/search_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/search_template_spec.rb b/elasticsearch-api/spec/unit/actions/search_template_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/search_template_spec.rb rename to elasticsearch-api/spec/unit/actions/search_template_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/searchable_snapshots/cache_stats_spec.rb b/elasticsearch-api/spec/unit/actions/searchable_snapshots/cache_stats_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/searchable_snapshots/cache_stats_spec.rb rename to elasticsearch-api/spec/unit/actions/searchable_snapshots/cache_stats_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/searchable_snapshots/clear_cache_spec.rb b/elasticsearch-api/spec/unit/actions/searchable_snapshots/clear_cache_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/searchable_snapshots/clear_cache_spec.rb rename to elasticsearch-api/spec/unit/actions/searchable_snapshots/clear_cache_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/searchable_snapshots/mount_spec.rb b/elasticsearch-api/spec/unit/actions/searchable_snapshots/mount_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/searchable_snapshots/mount_spec.rb rename to elasticsearch-api/spec/unit/actions/searchable_snapshots/mount_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/searchable_snapshots/stats_spec.rb b/elasticsearch-api/spec/unit/actions/searchable_snapshots/stats_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/searchable_snapshots/stats_spec.rb rename to elasticsearch-api/spec/unit/actions/searchable_snapshots/stats_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/security/bulk_delete_role_spec.rb b/elasticsearch-api/spec/unit/actions/security/bulk_delete_role_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/security/bulk_delete_role_spec.rb rename to elasticsearch-api/spec/unit/actions/security/bulk_delete_role_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/security/bulk_put_role_spec.rb b/elasticsearch-api/spec/unit/actions/security/bulk_put_role_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/security/bulk_put_role_spec.rb rename to elasticsearch-api/spec/unit/actions/security/bulk_put_role_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/security/clear_cached_service_tokens_spec.rb b/elasticsearch-api/spec/unit/actions/security/clear_cached_service_tokens_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/security/clear_cached_service_tokens_spec.rb rename to elasticsearch-api/spec/unit/actions/security/clear_cached_service_tokens_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/security/create_api_key_spec.rb b/elasticsearch-api/spec/unit/actions/security/create_api_key_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/security/create_api_key_spec.rb rename to elasticsearch-api/spec/unit/actions/security/create_api_key_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/security/create_cross_cluster_api_key_spec.rb b/elasticsearch-api/spec/unit/actions/security/create_cross_cluster_api_key_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/security/create_cross_cluster_api_key_spec.rb rename to elasticsearch-api/spec/unit/actions/security/create_cross_cluster_api_key_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/security/create_service_token_spec.rb b/elasticsearch-api/spec/unit/actions/security/create_service_token_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/security/create_service_token_spec.rb rename to elasticsearch-api/spec/unit/actions/security/create_service_token_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/security/delegate_pki_spec.rb b/elasticsearch-api/spec/unit/actions/security/delegate_pki_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/security/delegate_pki_spec.rb rename to elasticsearch-api/spec/unit/actions/security/delegate_pki_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/security/delete_service_token_spec.rb b/elasticsearch-api/spec/unit/actions/security/delete_service_token_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/security/delete_service_token_spec.rb rename to elasticsearch-api/spec/unit/actions/security/delete_service_token_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/security/enroll_kibana_spec.rb b/elasticsearch-api/spec/unit/actions/security/enroll_kibana_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/security/enroll_kibana_spec.rb rename to elasticsearch-api/spec/unit/actions/security/enroll_kibana_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/security/get_api_key_spec.rb b/elasticsearch-api/spec/unit/actions/security/get_api_key_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/security/get_api_key_spec.rb rename to elasticsearch-api/spec/unit/actions/security/get_api_key_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/security/get_builtin_privileges_spec.rb b/elasticsearch-api/spec/unit/actions/security/get_builtin_privileges_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/security/get_builtin_privileges_spec.rb rename to elasticsearch-api/spec/unit/actions/security/get_builtin_privileges_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/security/get_service_accounts_spec.rb b/elasticsearch-api/spec/unit/actions/security/get_service_accounts_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/security/get_service_accounts_spec.rb rename to elasticsearch-api/spec/unit/actions/security/get_service_accounts_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/security/get_service_credentials_spec.rb b/elasticsearch-api/spec/unit/actions/security/get_service_credentials_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/security/get_service_credentials_spec.rb rename to elasticsearch-api/spec/unit/actions/security/get_service_credentials_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/security/invalidate_api_key_spec.rb b/elasticsearch-api/spec/unit/actions/security/invalidate_api_key_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/security/invalidate_api_key_spec.rb rename to elasticsearch-api/spec/unit/actions/security/invalidate_api_key_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/security/query_api_keys_spec.rb b/elasticsearch-api/spec/unit/actions/security/query_api_keys_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/security/query_api_keys_spec.rb rename to elasticsearch-api/spec/unit/actions/security/query_api_keys_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/security/query_role_spec.rb b/elasticsearch-api/spec/unit/actions/security/query_role_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/security/query_role_spec.rb rename to elasticsearch-api/spec/unit/actions/security/query_role_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/security/query_user_spec.rb b/elasticsearch-api/spec/unit/actions/security/query_user_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/security/query_user_spec.rb rename to elasticsearch-api/spec/unit/actions/security/query_user_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/security/saml_authenticate_spec.rb b/elasticsearch-api/spec/unit/actions/security/saml_authenticate_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/security/saml_authenticate_spec.rb rename to elasticsearch-api/spec/unit/actions/security/saml_authenticate_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/security/saml_complete_logout_spec.rb b/elasticsearch-api/spec/unit/actions/security/saml_complete_logout_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/security/saml_complete_logout_spec.rb rename to elasticsearch-api/spec/unit/actions/security/saml_complete_logout_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/security/saml_invalidate_spec.rb b/elasticsearch-api/spec/unit/actions/security/saml_invalidate_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/security/saml_invalidate_spec.rb rename to elasticsearch-api/spec/unit/actions/security/saml_invalidate_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/security/saml_logout_spec.rb b/elasticsearch-api/spec/unit/actions/security/saml_logout_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/security/saml_logout_spec.rb rename to elasticsearch-api/spec/unit/actions/security/saml_logout_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/security/saml_prepare_authentication_spec.rb b/elasticsearch-api/spec/unit/actions/security/saml_prepare_authentication_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/security/saml_prepare_authentication_spec.rb rename to elasticsearch-api/spec/unit/actions/security/saml_prepare_authentication_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/security/saml_service_provider_metadata_spec.rb b/elasticsearch-api/spec/unit/actions/security/saml_service_provider_metadata_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/security/saml_service_provider_metadata_spec.rb rename to elasticsearch-api/spec/unit/actions/security/saml_service_provider_metadata_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/security/update_api_key_spec.rb b/elasticsearch-api/spec/unit/actions/security/update_api_key_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/security/update_api_key_spec.rb rename to elasticsearch-api/spec/unit/actions/security/update_api_key_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/security/update_cross_cluster_api_key_spec.rb b/elasticsearch-api/spec/unit/actions/security/update_cross_cluster_api_key_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/security/update_cross_cluster_api_key_spec.rb rename to elasticsearch-api/spec/unit/actions/security/update_cross_cluster_api_key_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/simulate/ingest_spec.rb b/elasticsearch-api/spec/unit/actions/simulate/ingest_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/simulate/ingest_spec.rb rename to elasticsearch-api/spec/unit/actions/simulate/ingest_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/snapshot/clone_spec.rb b/elasticsearch-api/spec/unit/actions/snapshot/clone_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/snapshot/clone_spec.rb rename to elasticsearch-api/spec/unit/actions/snapshot/clone_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/snapshot/create_repository_spec.rb b/elasticsearch-api/spec/unit/actions/snapshot/create_repository_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/snapshot/create_repository_spec.rb rename to elasticsearch-api/spec/unit/actions/snapshot/create_repository_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/snapshot/create_spec.rb b/elasticsearch-api/spec/unit/actions/snapshot/create_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/snapshot/create_spec.rb rename to elasticsearch-api/spec/unit/actions/snapshot/create_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/snapshot/delete_repository_spec.rb b/elasticsearch-api/spec/unit/actions/snapshot/delete_repository_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/snapshot/delete_repository_spec.rb rename to elasticsearch-api/spec/unit/actions/snapshot/delete_repository_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/snapshot/delete_spec.rb b/elasticsearch-api/spec/unit/actions/snapshot/delete_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/snapshot/delete_spec.rb rename to elasticsearch-api/spec/unit/actions/snapshot/delete_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/snapshot/get_repository_spec.rb b/elasticsearch-api/spec/unit/actions/snapshot/get_repository_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/snapshot/get_repository_spec.rb rename to elasticsearch-api/spec/unit/actions/snapshot/get_repository_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/snapshot/get_spec.rb b/elasticsearch-api/spec/unit/actions/snapshot/get_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/snapshot/get_spec.rb rename to elasticsearch-api/spec/unit/actions/snapshot/get_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/snapshot/repository_analize_spec.rb b/elasticsearch-api/spec/unit/actions/snapshot/repository_analize_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/snapshot/repository_analize_spec.rb rename to elasticsearch-api/spec/unit/actions/snapshot/repository_analize_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/snapshot/restore_spec.rb b/elasticsearch-api/spec/unit/actions/snapshot/restore_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/snapshot/restore_spec.rb rename to elasticsearch-api/spec/unit/actions/snapshot/restore_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/snapshot/status_spec.rb b/elasticsearch-api/spec/unit/actions/snapshot/status_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/snapshot/status_spec.rb rename to elasticsearch-api/spec/unit/actions/snapshot/status_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/snapshot/verify_repository_spec.rb b/elasticsearch-api/spec/unit/actions/snapshot/verify_repository_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/snapshot/verify_repository_spec.rb rename to elasticsearch-api/spec/unit/actions/snapshot/verify_repository_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/sql/delete_async_spec.rb b/elasticsearch-api/spec/unit/actions/sql/delete_async_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/sql/delete_async_spec.rb rename to elasticsearch-api/spec/unit/actions/sql/delete_async_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/sql/get_async_spec.rb b/elasticsearch-api/spec/unit/actions/sql/get_async_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/sql/get_async_spec.rb rename to elasticsearch-api/spec/unit/actions/sql/get_async_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/sql/get_async_stats_spec.rb b/elasticsearch-api/spec/unit/actions/sql/get_async_stats_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/sql/get_async_stats_spec.rb rename to elasticsearch-api/spec/unit/actions/sql/get_async_stats_spec.rb diff --git a/elasticsearch-api/spec/unit/actions/ssl/certificates_spec.rb b/elasticsearch-api/spec/unit/actions/ssl/certificates_spec.rb new file mode 100644 index 0000000000..7ff7f7a7af --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/ssl/certificates_spec.rb @@ -0,0 +1,35 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client#ssl.certificates' do + let(:expected_args) do + [ + 'GET', + '_ssl/certificates', + {}, + nil, + {}, + { endpoint: 'ssl.certificates' } + ] + end + + it 'performs the request' do + expect(client_double.ssl.certificates(index: 'foo')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/tasks/cancel_spec.rb b/elasticsearch-api/spec/unit/actions/tasks/cancel_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/tasks/cancel_spec.rb rename to elasticsearch-api/spec/unit/actions/tasks/cancel_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/tasks/get_spec.rb b/elasticsearch-api/spec/unit/actions/tasks/get_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/tasks/get_spec.rb rename to elasticsearch-api/spec/unit/actions/tasks/get_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/tasks/list_spec.rb b/elasticsearch-api/spec/unit/actions/tasks/list_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/tasks/list_spec.rb rename to elasticsearch-api/spec/unit/actions/tasks/list_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/terms_enum_spec.rb b/elasticsearch-api/spec/unit/actions/terms_enum_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/terms_enum_spec.rb rename to elasticsearch-api/spec/unit/actions/terms_enum_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/termvectors_spec.rb b/elasticsearch-api/spec/unit/actions/termvectors_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/termvectors_spec.rb rename to elasticsearch-api/spec/unit/actions/termvectors_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/text_structure/find_field_structure_spec.rb b/elasticsearch-api/spec/unit/actions/text_structure/find_field_structure_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/text_structure/find_field_structure_spec.rb rename to elasticsearch-api/spec/unit/actions/text_structure/find_field_structure_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/text_structure/find_message_structure_spec.rb b/elasticsearch-api/spec/unit/actions/text_structure/find_message_structure_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/text_structure/find_message_structure_spec.rb rename to elasticsearch-api/spec/unit/actions/text_structure/find_message_structure_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/text_structure/find_structure_spec.rb b/elasticsearch-api/spec/unit/actions/text_structure/find_structure_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/text_structure/find_structure_spec.rb rename to elasticsearch-api/spec/unit/actions/text_structure/find_structure_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/text_structure/test_grok_pattern_spec.rb b/elasticsearch-api/spec/unit/actions/text_structure/test_grok_pattern_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/text_structure/test_grok_pattern_spec.rb rename to elasticsearch-api/spec/unit/actions/text_structure/test_grok_pattern_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/transform/get_node_stats_spec.rb b/elasticsearch-api/spec/unit/actions/transform/get_node_stats_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/transform/get_node_stats_spec.rb rename to elasticsearch-api/spec/unit/actions/transform/get_node_stats_spec.rb diff --git a/elasticsearch-api/spec/platinum/unit/transform/reset_transform_spec.rb b/elasticsearch-api/spec/unit/actions/transform/reset_transform_spec.rb similarity index 91% rename from elasticsearch-api/spec/platinum/unit/transform/reset_transform_spec.rb rename to elasticsearch-api/spec/unit/actions/transform/reset_transform_spec.rb index 8a6bc91062..11a5542f05 100644 --- a/elasticsearch-api/spec/platinum/unit/transform/reset_transform_spec.rb +++ b/elasticsearch-api/spec/unit/actions/transform/reset_transform_spec.rb @@ -24,7 +24,9 @@ '_transform/foo/_reset', {}, nil, - {} + {}, + { defined_params: { transform_id: 'foo' }, + endpoint: 'transform.reset_transform' } ] end diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/transform/schedule_now_transform_spec.rb b/elasticsearch-api/spec/unit/actions/transform/schedule_now_transform_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/transform/schedule_now_transform_spec.rb rename to elasticsearch-api/spec/unit/actions/transform/schedule_now_transform_spec.rb diff --git a/elasticsearch-api/spec/platinum/unit/transform/upgrade_transforms_spec.rb b/elasticsearch-api/spec/unit/actions/transform/upgrade_transforms_spec.rb similarity index 94% rename from elasticsearch-api/spec/platinum/unit/transform/upgrade_transforms_spec.rb rename to elasticsearch-api/spec/unit/actions/transform/upgrade_transforms_spec.rb index 4180a3c25b..cf792f2a2b 100644 --- a/elasticsearch-api/spec/platinum/unit/transform/upgrade_transforms_spec.rb +++ b/elasticsearch-api/spec/unit/actions/transform/upgrade_transforms_spec.rb @@ -24,7 +24,8 @@ '_transform/_upgrade', {}, nil, - {} + {}, + { endpoint: 'transform.upgrade_transforms' } ] end diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/update_by_query_spec.rb b/elasticsearch-api/spec/unit/actions/update_by_query_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/update_by_query_spec.rb rename to elasticsearch-api/spec/unit/actions/update_by_query_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/update_document_spec.rb b/elasticsearch-api/spec/unit/actions/update_document_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/update_document_spec.rb rename to elasticsearch-api/spec/unit/actions/update_document_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/watcher/get_settings_spec.rb b/elasticsearch-api/spec/unit/actions/watcher/get_settings_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/watcher/get_settings_spec.rb rename to elasticsearch-api/spec/unit/actions/watcher/get_settings_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/actions/watcher/update_settings_spec.rb b/elasticsearch-api/spec/unit/actions/watcher/update_settings_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/actions/watcher/update_settings_spec.rb rename to elasticsearch-api/spec/unit/actions/watcher/update_settings_spec.rb diff --git a/elasticsearch-api/spec/unit/actions/xpack/usage_spec.rb b/elasticsearch-api/spec/unit/actions/xpack/usage_spec.rb new file mode 100644 index 0000000000..c0f73e87b0 --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/xpack/usage_spec.rb @@ -0,0 +1,35 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'client#usage' do + let(:expected_args) do + [ + 'GET', + '_xpack/usage', + {}, + nil, + {}, + { endpoint: 'xpack.usage' } + ] + end + + it 'performs the request' do + expect(client_double.xpack.usage).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/elasticsearch/api/api_response_spec.rb b/elasticsearch-api/spec/unit/api_response_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/api_response_spec.rb rename to elasticsearch-api/spec/unit/api_response_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/api_spec.rb b/elasticsearch-api/spec/unit/api_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/api_spec.rb rename to elasticsearch-api/spec/unit/api_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/client_spec.rb b/elasticsearch-api/spec/unit/client_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/client_spec.rb rename to elasticsearch-api/spec/unit/client_spec.rb diff --git a/elasticsearch-api/spec/elasticsearch/api/perform_request_spec.rb b/elasticsearch-api/spec/unit/perform_request_spec.rb similarity index 95% rename from elasticsearch-api/spec/elasticsearch/api/perform_request_spec.rb rename to elasticsearch-api/spec/unit/perform_request_spec.rb index 44b3fa288e..154e19bd90 100644 --- a/elasticsearch-api/spec/elasticsearch/api/perform_request_spec.rb +++ b/elasticsearch-api/spec/unit/perform_request_spec.rb @@ -17,8 +17,8 @@ require 'spec_helper' require 'elastic-transport' -require_relative '../../../utils/thor/endpoint_spec' -require_relative '../../../utils/thor/generator/files_helper' +require_relative File.expand_path('../../utils/thor/endpoint_spec', __dir__) +require_relative File.expand_path('../../utils/thor/generator/files_helper', __dir__) describe 'Perform request args' do Elasticsearch::API::FilesHelper.files.each do |filepath| diff --git a/elasticsearch-api/spec/platinum/unit/test_helper.rb b/elasticsearch-api/spec/unit/test_helper.rb similarity index 81% rename from elasticsearch-api/spec/platinum/unit/test_helper.rb rename to elasticsearch-api/spec/unit/test_helper.rb index 6a914a20f6..16e1cc0374 100644 --- a/elasticsearch-api/spec/platinum/unit/test_helper.rb +++ b/elasticsearch-api/spec/unit/test_helper.rb @@ -26,22 +26,6 @@ require 'elasticsearch' require 'elasticsearch/api' -Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new(print_failure_summary: true) - -module Minitest - class Test - def assert_nothing_raised(*args) - begin - line = __LINE__ - yield - rescue Exception => e - raise MiniTest::Assertion, "Exception raised:\n<#{e.class}>", e.backtrace - end - true - end - end -end - module Elasticsearch module Test class FakeClient diff --git a/elasticsearch-api/spec/elasticsearch/api/utils_spec.rb b/elasticsearch-api/spec/unit/utils_spec.rb similarity index 100% rename from elasticsearch-api/spec/elasticsearch/api/utils_spec.rb rename to elasticsearch-api/spec/unit/utils_spec.rb diff --git a/elasticsearch/spec/integration/characters_escaping_spec.rb b/elasticsearch/spec/integration/characters_escaping_spec.rb index 3919841c9b..4cd080f142 100644 --- a/elasticsearch/spec/integration/characters_escaping_spec.rb +++ b/elasticsearch/spec/integration/characters_escaping_spec.rb @@ -18,41 +18,35 @@ require 'spec_helper' require 'uri' -ELASTICSEARCH_URL = ENV['TEST_ES_SERVER'] || "http://localhost:#{(ENV['PORT'] || 9200)}" -raise URI::InvalidURIError unless ELASTICSEARCH_URL =~ /\A#{URI::DEFAULT_PARSER.make_regexp}\z/ - -context 'Elasticsearch client' do - let(:client) do - Elasticsearch::Client.new(host: ELASTICSEARCH_URL, user: 'elastic', password: 'changeme') - end +context 'Elasticsearch CLIENT' do let(:index) { 'tvs' } after do - client.indices.delete(index: index) + CLIENT.indices.delete(index: index) end context 'escaping spaces in ids' do it 'escapes spaces for id when using index' do - response = client.index(index: index, id: 'a test 1', body: { name: 'A test 1' }, refresh: true) + response = CLIENT.index(index: index, id: 'a test 1', body: { name: 'A test 1' }, refresh: true) expect(response.body['_id']).to eq 'a test 1' - response = client.search(index: index) + response = CLIENT.search(index: index) expect(response.body['hits']['hits'].first['_id']).to eq 'a test 1' # Raises exception, _id is unrecognized expect do - client.index(index: index, _id: 'a test 2', body: { name: 'A test 2' }) + CLIENT.index(index: index, _id: 'a test 2', body: { name: 'A test 2' }) end.to raise_exception Elastic::Transport::Transport::Errors::BadRequest # Raises exception, id is a query parameter expect do - client.index(index: index, body: { name: 'A test 3', _id: 'a test 3' }) + CLIENT.index(index: index, body: { name: 'A test 3', _id: 'a test 3' }) end.to raise_exception Elastic::Transport::Transport::Errors::BadRequest end it 'escapes spaces for id when using create' do # Works with create - response = client.create(index: index, id: 'a test 4', body: { name: 'A test 4' }) + response = CLIENT.create(index: index, id: 'a test 4', body: { name: 'A test 4' }) expect(response.body['_id']).to eq 'a test 4' end @@ -60,9 +54,9 @@ body = [ { create: { _index: index, _id: 'a test 5', data: { name: 'A test 5' } } } ] - expect(client.bulk(body: body, refresh: true).status).to eq 200 + expect(CLIENT.bulk(body: body, refresh: true).status).to eq 200 - response = client.search(index: index) + response = CLIENT.search(index: index) expect( response.body['hits']['hits'].select { |a| a['_id'] == 'a test 5' }.size ).to eq 1 @@ -71,13 +65,13 @@ context 'it doesnae escape plus signs in id' do it 'escapes spaces for id when using index' do - response = client.index(index: index, id: 'a+test+1', body: { name: 'A test 1' }) + response = CLIENT.index(index: index, id: 'a+test+1', body: { name: 'A test 1' }) expect(response.body['_id']).to eq 'a+test+1' end it 'escapes spaces for id when using create' do # Works with create - response = client.create(index: index, id: 'a+test+2', body: { name: 'A test 2' }) + response = CLIENT.create(index: index, id: 'a+test+2', body: { name: 'A test 2' }) expect(response.body['_id']).to eq 'a+test+2' end @@ -85,9 +79,9 @@ body = [ { create: { _index: index, _id: 'a+test+3', data: { name: 'A test 3' } } } ] - expect(client.bulk(body: body, refresh: true).status).to eq 200 + expect(CLIENT.bulk(body: body, refresh: true).status).to eq 200 - response = client.search(index: index) + response = CLIENT.search(index: index) expect( response.body['hits']['hits'].select { |a| a['_id'] == 'a+test+3' }.size ).to eq 1 diff --git a/elasticsearch/spec/integration/client_integration_spec.rb b/elasticsearch/spec/integration/client_integration_spec.rb index 79ef20850c..967ae0616d 100644 --- a/elasticsearch/spec/integration/client_integration_spec.rb +++ b/elasticsearch/spec/integration/client_integration_spec.rb @@ -24,39 +24,30 @@ context 'Elasticsearch client' do let(:logger) { Logger.new($stderr) } - let(:client) do - Elasticsearch::Client.new( - host: ELASTICSEARCH_URL, - logger: logger, - user: 'elastic', - password: 'changeme' - ) - end - context 'Integrates with elasticsearch API' do it 'should perform the API methods' do expect do # Index a document - client.index(index: 'test-index', id: '1', body: { title: 'Test' }) + CLIENT.index(index: 'test-index', id: '1', body: { title: 'Test' }) # Refresh the index - client.indices.refresh(index: 'test-index') + CLIENT.indices.refresh(index: 'test-index') # Search - response = client.search(index: 'test-index', body: { query: { match: { title: 'test' } } }) + response = CLIENT.search(index: 'test-index', body: { query: { match: { title: 'test' } } }) expect(response['hits']['total']['value']).to eq 1 expect(response['hits']['hits'][0]['_source']['title']).to eq 'Test' # Delete the index - client.indices.delete(index: 'test-index') + CLIENT.indices.delete(index: 'test-index') end.not_to raise_error end end context 'Reports the right meta header' do it 'Reports es service name and gem version' do - headers = client.transport.connections.first.connection.headers + headers = CLIENT.transport.connections.first.connection.headers version = Class.new.extend(Elastic::Transport::MetaHeader).send(:client_meta_version, Elasticsearch::VERSION) expect(headers['x-elastic-client-meta']).to match /^es=#{version}/ end diff --git a/elasticsearch/spec/integration/helpers/bulk_helper_spec.rb b/elasticsearch/spec/integration/helpers/bulk_helper_spec.rb index 31da9a0b84..1633a12ce2 100644 --- a/elasticsearch/spec/integration/helpers/bulk_helper_spec.rb +++ b/elasticsearch/spec/integration/helpers/bulk_helper_spec.rb @@ -14,7 +14,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -require_relative 'helpers_spec_helper' +require_relative File.expand_path('../../spec_helper', __dir__) require 'elasticsearch/helpers/bulk_helper' require 'tempfile' @@ -23,25 +23,25 @@ let(:index) { 'bulk_animals' } let(:index_slice) { 'bulk_animals_slice' } let(:params) { { refresh: 'wait_for' } } - let(:bulk_helper) { Elasticsearch::Helpers::BulkHelper.new(client, index, params) } + let(:bulk_helper) { Elasticsearch::Helpers::BulkHelper.new(CLIENT, index, params) } let(:docs) do [ - { scientific_name: 'Lama guanicoe', name:'Guanaco' }, - { scientific_name: 'Tayassu pecari', name:'White-lipped peccary' }, - { scientific_name: 'Snycerus caffer', name:'Buffalo, african' }, - { scientific_name: 'Coluber constrictor', name:'Snake, racer' }, - { scientific_name: 'Thalasseus maximus', name:'Royal tern' }, - { scientific_name: 'Centrocercus urophasianus', name:'Hen, sage' }, - { scientific_name: 'Sitta canadensis', name:'Nuthatch, red-breasted' }, - { scientific_name: 'Aegypius tracheliotus', name:'Vulture, lappet-faced' }, - { scientific_name: 'Bucephala clangula', name:'Common goldeneye' }, - { scientific_name: 'Felis pardalis', name:'Ocelot' } + { scientific_name: 'Lama guanicoe', name: 'Guanaco' }, + { scientific_name: 'Tayassu pecari', name: 'White-lipped peccary' }, + { scientific_name: 'Snycerus caffer', name: 'Buffalo, african' }, + { scientific_name: 'Coluber constrictor', name: 'Snake, racer' }, + { scientific_name: 'Thalasseus maximus', name: 'Royal tern' }, + { scientific_name: 'Centrocercus urophasianus', name: 'Hen, sage' }, + { scientific_name: 'Sitta canadensis', name: 'Nuthatch, red-breasted' }, + { scientific_name: 'Aegypius tracheliotus', name: 'Vulture, lappet-faced' }, + { scientific_name: 'Bucephala clangula', name: 'Common goldeneye' }, + { scientific_name: 'Felis pardalis', name: 'Ocelot' } ] end after do - client.indices.delete(index: index, ignore: 404) - client.indices.delete(index: index_slice, ignore: 404) + CLIENT.indices.delete(index: index, ignore: 404) + CLIENT.indices.delete(index: index_slice, ignore: 404) end it 'Ingests documents' do @@ -58,9 +58,9 @@ ] bulk_helper.ingest(docs) # Get the ingested documents, add id and modify them to update them: - animals = client.search(index: index)['hits']['hits'] + animals = CLIENT.search(index: index)['hits']['hits'] # Add id to each doc - docs = animals.map { |animal| animal['_source'].merge({'id' => animal['_id'] }) } + docs = animals.map { |animal| animal['_source'].merge({ 'id' => animal['_id'] }) } docs.map { |doc| doc['scientific_name'].upcase! } response = bulk_helper.update(docs) expect(response.status).to eq(200) @@ -73,17 +73,17 @@ response = bulk_helper.delete(ids) expect(response.status).to eq 200 expect(response['items'].map { |item| item['delete']['result'] }.uniq.first).to eq('deleted') - expect(client.count(index: index)['count']).to eq(0) + expect(CLIENT.count(index: index)['count']).to eq(0) end it 'Ingests documents and yields response and docs' do slice = 2 - bulk_helper = Elasticsearch::Helpers::BulkHelper.new(client, index_slice, params) - response = bulk_helper.ingest(docs, {slice: slice}) do |response, docs| + bulk_helper = Elasticsearch::Helpers::BulkHelper.new(CLIENT, index_slice, params) + bulk_helper.ingest(docs, { slice: slice }) do |response, docs| expect(response).to be_an_instance_of Elasticsearch::API::Response expect(docs.count).to eq slice end - response = client.search(index: index_slice, size: 200) + response = CLIENT.search(index: index_slice, size: 200) expect(response['hits']['hits'].map { |a| a['_source'].transform_keys(&:to_sym) }).to eq docs end diff --git a/elasticsearch/spec/integration/helpers/esql_helper_spec.rb b/elasticsearch/spec/integration/helpers/esql_helper_spec.rb index 12122c7157..ed8dde04ba 100644 --- a/elasticsearch/spec/integration/helpers/esql_helper_spec.rb +++ b/elasticsearch/spec/integration/helpers/esql_helper_spec.rb @@ -14,7 +14,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -require_relative 'helpers_spec_helper' +require_relative File.expand_path('../../spec_helper', __dir__) require 'elasticsearch/helpers/esql_helper' require 'ipaddr' @@ -24,13 +24,13 @@ let(:esql_helper) { Elasticsearch::Helpers::ESQLHelper } let(:query) do <<~ESQL - FROM #{index} - | EVAL duration_ms = ROUND(event.duration / 1000000.0, 1) + FROM #{index} + | EVAL duration_ms = ROUND(event.duration / 1000000.0, 1) ESQL end before do - client.indices.create( + CLIENT.indices.create( index: index, body: { mappings: { @@ -38,34 +38,41 @@ } } ) - client.bulk( + CLIENT.bulk( index: index, body: [ - {'index': {}}, - {'@timestamp' => '2023-10-23T12:15:03.360Z', 'client.ip' => '172.21.2.162', message: 'Connected to 10.1.0.3', 'event.duration' => 3450233}, - {'index': {}}, - {'@timestamp' => '2023-10-23T12:27:28.948Z', 'client.ip' => '172.21.2.113', message: 'Connected to 10.1.0.2', 'event.duration' => 2764889}, - {'index': {}}, - {'@timestamp' => '2023-10-23T13:33:34.937Z', 'client.ip' => '172.21.0.5', message: 'Disconnected', 'event.duration' => 1232382}, - {'index': {}}, - {'@timestamp' => '2023-10-23T13:51:54.732Z', 'client.ip' => '172.21.3.15', message: 'Connection error', 'event.duration' => 725448}, - {'index': {}}, - {'@timestamp' => '2023-10-23T13:52:55.015Z', 'client.ip' => '172.21.3.15', message: 'Connection error', 'event.duration' => 8268153}, - {'index': {}}, - {'@timestamp' => '2023-10-23T13:53:55.832Z', 'client.ip' => '172.21.3.15', message: 'Connection error', 'event.duration' => 5033755}, - {'index': {}}, - {'@timestamp' => '2023-10-23T13:55:01.543Z', 'client.ip' => '172.21.3.15', message: 'Connected to 10.1.0.1', 'event.duration' => 1756467} + { 'index': {} }, + { '@timestamp' => '2023-10-23T12:15:03.360Z', 'client.ip' => '172.21.2.162', message: 'Connected to 10.1.0.3', + 'event.duration' => 3_450_233 }, + { 'index': {} }, + { '@timestamp' => '2023-10-23T12:27:28.948Z', 'client.ip' => '172.21.2.113', message: 'Connected to 10.1.0.2', + 'event.duration' => 2_764_889 }, + { 'index': {} }, + { '@timestamp' => '2023-10-23T13:33:34.937Z', 'client.ip' => '172.21.0.5', message: 'Disconnected', + 'event.duration' => 1_232_382 }, + { 'index': {} }, + { '@timestamp' => '2023-10-23T13:51:54.732Z', 'client.ip' => '172.21.3.15', message: 'Connection error', + 'event.duration' => 725_448 }, + { 'index': {} }, + { '@timestamp' => '2023-10-23T13:52:55.015Z', 'client.ip' => '172.21.3.15', message: 'Connection error', + 'event.duration' => 8_268_153 }, + { 'index': {} }, + { '@timestamp' => '2023-10-23T13:53:55.832Z', 'client.ip' => '172.21.3.15', message: 'Connection error', + 'event.duration' => 5_033_755 }, + { 'index': {} }, + { '@timestamp' => '2023-10-23T13:55:01.543Z', 'client.ip' => '172.21.3.15', message: 'Connected to 10.1.0.1', + 'event.duration' => 1_756_467 } ], refresh: true ) end after do - client.indices.delete(index: index) + CLIENT.indices.delete(index: index) end it 'returns an ESQL response as a relational key/value object' do - response = esql_helper.query(client, query) + response = esql_helper.query(CLIENT, query) expect(response.count).to eq 7 expect(response.first.keys).to eq ['duration_ms', 'message', 'event.duration', 'client.ip', '@timestamp'] response.each do |r| @@ -82,7 +89,7 @@ 'client.ip' => Proc.new { |i| IPAddr.new(i) }, 'event.duration' => Proc.new { |d| d.to_s } } - response = esql_helper.query(client, query, parser: parser) + response = esql_helper.query(CLIENT, query, parser: parser) response.each do |r| expect(r['@timestamp']).to be_a DateTime expect(r['client.ip']).to be_a IPAddr @@ -92,7 +99,7 @@ end it 'parser does not error when value is nil, leaves nil' do - client.index( + CLIENT.index( index: index, body: { '@timestamp' => nil, @@ -107,7 +114,7 @@ 'client.ip' => Proc.new { |i| IPAddr.new(i) }, 'event.duration' => Proc.new { |d| d.to_s } } - response = esql_helper.query(client, query, parser: parser) + response = esql_helper.query(CLIENT, query, parser: parser) response.each do |r| expect [DateTime, NilClass].include?(r['@timestamp'].class) expect [IPAddr, NilClass].include?(r['client.ip'].class) diff --git a/elasticsearch/spec/integration/helpers/scroll_helper_spec.rb b/elasticsearch/spec/integration/helpers/scroll_helper_spec.rb index ec59731b54..7407480f06 100644 --- a/elasticsearch/spec/integration/helpers/scroll_helper_spec.rb +++ b/elasticsearch/spec/integration/helpers/scroll_helper_spec.rb @@ -14,14 +14,14 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -require_relative 'helpers_spec_helper' +require_relative File.expand_path('../../spec_helper', __dir__) require 'elasticsearch/helpers/scroll_helper' context 'Elasticsearch client helpers' do context 'ScrollHelper' do let(:index) { 'books' } let(:body) { { size: 12, query: { match_all: {} } } } - let(:scroll_helper) { Elasticsearch::Helpers::ScrollHelper.new(client, index, body) } + let(:scroll_helper) { Elasticsearch::Helpers::ScrollHelper.new(CLIENT, index, body) } before do documents = [ @@ -50,11 +50,11 @@ { index: { _index: index, data: {name: "The Left Hand of Darkness", "author": "Ursula K. Le Guin", "release_date": "1969-06-01", "page_count": 304} } }, { index: { _index: index, data: {name: "The Moon is a Harsh Mistress", "author": "Robert A. Heinlein", "release_date": "1966-04-01", "page_count": 288 } } } ] - client.bulk(body: documents, refresh: 'wait_for') + CLIENT.bulk(body: documents, refresh: 'wait_for') end after do - client.indices.delete(index: index) + CLIENT.indices.delete(index: index) end it 'instantiates a scroll helper' do @@ -63,7 +63,7 @@ it 'searches an index' do my_documents = [] - while !(documents = scroll_helper.results).empty? + until (documents = scroll_helper.results).empty? my_documents << documents end diff --git a/elasticsearch/spec/integration/opentelemetry_spec.rb b/elasticsearch/spec/integration/opentelemetry_spec.rb index 55c423b780..1c0611feea 100644 --- a/elasticsearch/spec/integration/opentelemetry_spec.rb +++ b/elasticsearch/spec/integration/opentelemetry_spec.rb @@ -27,26 +27,18 @@ after { exporter.reset } let(:span) { exporter.finished_spans[0] } - let(:client) do - Elasticsearch::Client.new( - host: ELASTICSEARCH_URL, - user: 'elastic', - password: 'changeme' - ) - end - after do - client.delete(index: 'myindex', id: 1); rescue + CLIENT.delete(index: 'myindex', id: 1); rescue end context 'when a request is instrumented' do it 'sets the span name to the endpoint id' do - client.search(body: { query: { match: { a: 1 } } }) + CLIENT.search(body: { query: { match: { a: 1 } } }) expect(span.name).to eq 'search' end it 'sets the path parts' do - client.index(index: 'myindex', id: 1, body: { title: 'Test' }) + CLIENT.index(index: 'myindex', id: 1, body: { title: 'Test' }) expect(span.attributes['db.elasticsearch.path_parts.index']).to eq 'myindex' expect(span.attributes['db.elasticsearch.path_parts.id']).to eq 1 end diff --git a/elasticsearch/spec/spec_helper.rb b/elasticsearch/spec/spec_helper.rb index 4a505c68ff..d7c4ecfbce 100644 --- a/elasticsearch/spec/spec_helper.rb +++ b/elasticsearch/spec/spec_helper.rb @@ -16,6 +16,7 @@ # under the License. require 'elasticsearch' +require 'openssl' require 'rspec' RSpec.configure do |config| @@ -41,3 +42,18 @@ def jruby? c.add_span_processor span_processor end end + +CERTS_PATH = File.expand_path('../../.buildkite/certs', __dir__) +host = ENV['TEST_ES_SERVER'] || 'http://localhost:9200' +raise URI::InvalidURIError unless host =~ /\A#{URI::DEFAULT_PARSER.make_regexp}\z/ + +password = ENV['ELASTIC_PASSWORD'] || 'changeme' +HOST_URI = URI.parse(host) +raw_certificate = File.read("#{CERTS_PATH}/testnode.crt") +certificate = OpenSSL::X509::Certificate.new(raw_certificate) +raw_key = File.read("#{CERTS_PATH}/testnode.key") +key = OpenSSL::PKey::RSA.new(raw_key) +ca_file = File.expand_path("#{CERTS_PATH}/ca.crt") +TRANSPORT_OPTIONS = { ssl: { verify: false, client_cert: certificate, client_key: key, ca_file: ca_file } } +HOST = "https://elastic:#{password}@#{HOST_URI.host}:#{HOST_URI.port}" +CLIENT = Elasticsearch::Client.new(host: HOST, transport_options: TRANSPORT_OPTIONS) diff --git a/rake_tasks/test_tasks.rake b/rake_tasks/test_tasks.rake index f29b14909f..d0d5e3dba9 100644 --- a/rake_tasks/test_tasks.rake +++ b/rake_tasks/test_tasks.rake @@ -47,33 +47,11 @@ namespace :test do end end - desc 'Run Elasticsearch test suite free tests.' - task es_free: ['es:wait_for_green'] do - puts '-' * 80 - sh "cd #{CURRENT_PATH.join('elasticsearch-api')} && unset BUNDLE_GEMFILE && bundle exec rake test:rest_api" - puts "\n" - end - - desc 'Run Elasticsearch test suite platinum tests.' - task es_platinum: 'es:wait_for_green' do - puts '-' * 80 - sh "cd #{CURRENT_PATH.join('elasticsearch-api')} && unset BUNDLE_GEMFILE && TEST_SUITE=platinum bundle exec rake test:rest_api" - puts "\n" - end - desc 'Run YAML test runner tests' task :yaml do sh "cd #{CURRENT_PATH.join('elasticsearch-api')} && unset BUNDLE_GEMFILE && bundle exec rake test:yaml" end - namespace :platinum do - desc 'Run platinum integration tests' - task :integration do - sh "cd #{CURRENT_PATH.join('elasticsearch-api')} && unset BUNDLE_GEMFILE && bundle exec rake test:platinum:integration" - puts "\n" - end - end - # Returns: version_number, build_hash def cluster_info require 'elasticsearch'