Skip to content

Commit 657afa8

Browse files
committed
Test: Updates perform_request_spec
1 parent 9a037cf commit 657afa8

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

elasticsearch-api/spec/unit/perform_request_spec.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@
2323
describe 'Perform request args' do
2424
Elasticsearch::API::FilesHelper.files.each do |filepath|
2525
spec = Elasticsearch::API::EndpointSpec.new(filepath)
26-
next if spec.module_namespace.flatten.first == '_internal' || spec.visibility != 'public'
26+
next if spec.module_namespace.flatten.first == '_internal' ||
27+
spec.visibility != 'public' ||
28+
# TODO: Once the test suite is migrated to elasticsearch-specification, these should be removed
29+
spec.module_namespace.flatten.first == 'rollup' ||
30+
['scroll', 'clear_scroll', 'connector.last_sync'].include?(spec.endpoint_name)
2731

2832
# These are the path parts defined by the user in the method argument
2933
defined_path_parts = spec.path_params.inject({}) do |params, part|
@@ -35,13 +39,11 @@
3539
params.merge(part.to_sym => 'testing')
3640
end
3741

42+
required_params.merge!(body: {}) if ['inference.put', 'inference.update', 'inference.chat_completion_unified'].include? spec.endpoint_name
43+
3844
let(:client_double) do
3945
Class.new { include Elasticsearch::API }.new.tap do |client|
4046
expect(client).to receive(:perform_request) do |_, _, _, _, _, request_params|
41-
# The create method ends up becoming an 'index' request
42-
if expected_perform_request_params[:endpoint] == 'create'
43-
expected_perform_request_params[:endpoint] = 'index'
44-
end
4547
# Check that the expected hash is passed to the perform_request method
4648
expect(request_params).to eq(expected_perform_request_params)
4749
end.and_return(response_double)

0 commit comments

Comments
 (0)