|
23 | 23 | describe 'Perform request args' do |
24 | 24 | Elasticsearch::API::FilesHelper.files.each do |filepath| |
25 | 25 | 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) |
27 | 31 |
|
28 | 32 | # These are the path parts defined by the user in the method argument |
29 | 33 | defined_path_parts = spec.path_params.inject({}) do |params, part| |
|
35 | 39 | params.merge(part.to_sym => 'testing') |
36 | 40 | end |
37 | 41 |
|
| 42 | + required_params.merge!(body: {}) if ['inference.put', 'inference.update', 'inference.chat_completion_unified'].include? spec.endpoint_name |
| 43 | + |
38 | 44 | let(:client_double) do |
39 | 45 | Class.new { include Elasticsearch::API }.new.tap do |client| |
40 | 46 | 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 |
45 | 47 | # Check that the expected hash is passed to the perform_request method |
46 | 48 | expect(request_params).to eq(expected_perform_request_params) |
47 | 49 | end.and_return(response_double) |
|
0 commit comments