Skip to content

Commit 26c9156

Browse files
committed
[Test Runner] Updates perform_request_spec
Don't fail, log when methods are not implemented yet
1 parent b631150 commit 26c9156

File tree

1 file changed

+24
-19
lines changed

1 file changed

+24
-19
lines changed

elasticsearch-api/spec/unit/perform_request_spec.rb

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
require 'spec_helper'
1918
require 'elastic-transport'
19+
require 'spec_helper'
20+
2021
require_relative File.expand_path('../../utils/thor/endpoint_spec', __dir__)
2122
require_relative File.expand_path('../../utils/thor/generator/files_helper', __dir__)
2223

@@ -28,8 +29,7 @@
2829
# TODO: Once the test suite is migrated to elasticsearch-specification, these should be removed
2930
spec.module_namespace.flatten.first == 'rollup' ||
3031
[
31-
'scroll', 'clear_scroll', 'connector.last_sync', 'knn_search',
32-
'indices.remove_block'
32+
'scroll', 'clear_scroll', 'connector.last_sync', 'knn_search'
3333
].include?(spec.endpoint_name)
3434

3535
# These are the path parts defined by the user in the method argument
@@ -66,25 +66,30 @@
6666
{ endpoint: spec.endpoint_name, defined_params: defined_path_parts }
6767
end
6868
end
69-
70-
if spec.path_parts.empty?
71-
it "passes the endpoint id to the request" do
72-
if spec.module_namespace.empty?
73-
client_double.send(spec.method_name, required_params)
74-
else
75-
client_double.send(spec.module_namespace[0]).send(spec.method_name, required_params)
69+
begin
70+
if spec.path_parts.empty?
71+
it "passes the endpoint id to the request" do
72+
if spec.module_namespace.empty?
73+
client_double.send(spec.method_name, required_params)
74+
else
75+
client_double.send(spec.module_namespace[0]).send(spec.method_name, required_params)
76+
end
7677
end
77-
end
78-
else
79-
it "passes params to the request with the endpoint id: #{spec.path_parts.keys}" do
80-
if spec.module_namespace.empty?
81-
client_double.send(spec.method_name, required_params.merge(defined_path_parts))
82-
else
83-
client_double.send(
84-
spec.module_namespace[0]).send(spec.method_name, required_params.merge(defined_path_parts)
85-
)
78+
else
79+
it "passes params to the request with the endpoint id: #{spec.path_parts.keys}" do
80+
if spec.module_namespace.empty?
81+
client_double.send(spec.method_name, required_params.merge(defined_path_parts))
82+
else
83+
client_double.send(
84+
spec.module_namespace[0]
85+
).send(
86+
spec.method_name, required_params.merge(defined_path_parts)
87+
)
88+
end
8689
end
8790
end
91+
rescue NoMethodError
92+
Logger.new($stdout).info("Method #{spec.method_name} not implemented yet")
8893
end
8994
end
9095
end

0 commit comments

Comments
 (0)