diff --git a/elasticsearch-api/spec/rest_api/skipped_tests_platinum.yml b/elasticsearch-api/spec/rest_api/skipped_tests_platinum.yml index 47b1e8d2a..e1459a9e3 100644 --- a/elasticsearch-api/spec/rest_api/skipped_tests_platinum.yml +++ b/elasticsearch-api/spec/rest_api/skipped_tests_platinum.yml @@ -226,3 +226,10 @@ - :file: 'esql/150_lookup.yml' :description: '*' +# TODO: once migrate is available in spec +- + :file: 'migrate/10_reindex.yml' + :description: '*' +- + :file: 'migrate/20_reindex_status.yml' + :description: '*' diff --git a/elasticsearch-api/spec/unit/actions/async_search/delete_spec.rb b/elasticsearch-api/spec/unit/actions/async_search/delete_spec.rb new file mode 100644 index 000000000..8db2fb329 --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/async_search/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 'async_search.delete' do + let(:expected_args) do + [ + 'DELETE', + '_async_search/foo', + {}, + nil, + {}, + { endpoint: 'count' } + ] + end + + it 'performs the request' do + expect(client_double.async_search.delete(id: 'foo')).to be_a Elasticsearch::API::Response + end +end diff --git a/elasticsearch-api/spec/unit/actions/async_search/get_spec.rb b/elasticsearch-api/spec/unit/actions/async_search/get_spec.rb new file mode 100644 index 000000000..80d9b84e9 --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/async_search/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 'async_search.delete' do + let(:expected_args) do + [ + 'GET', + '_async_search/foo', + {}, + nil, + {}, + { endpoint: 'count' } + ] + end + + 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 000000000..66191b44a --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/async_search/status_spec.rb @@ -0,0 +1,34 @@ +# 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 'async_search.delete' do + let(:expected_args) do + [ + 'GET', + '_async_search/status/foo', + {}, + nil, + {}, + { 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 000000000..5c2068e08 --- /dev/null +++ b/elasticsearch-api/spec/unit/actions/async_search/submit_spec.rb @@ -0,0 +1,87 @@ +# 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 'async_search.submit' do + context 'with no parameters' do + let(:expected_args) do + [ + 'POST', + '_async_search', + {}, + nil, + {}, + { endpoint: 'async_search.submit' } + ] + end + + it 'performs the request' do + expect(client_double.async_search.submit).to be_a Elasticsearch::API::Response + end + end + + context 'with index' do + let(:expected_args) do + [ + 'DELETE', + '_async_search/foo', + {}, + nil, + {}, + { endpoint: 'count' } + ] + end + + it 'performs the request' do + expect(client_double.async_search.submit).to be_a Elasticsearch::API::Response + end + end +end + +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