Skip to content

Commit

Permalink
[API] Test Runner: Adds internal prevalidate node removal
Browse files Browse the repository at this point in the history
  • Loading branch information
picandocodigo committed Dec 6, 2022
1 parent eebcb23 commit d4d4fa0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions elasticsearch-api/api-spec-testing/test_file/action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ def initialize(definition)
def execute(client, test = nil)
@definition.each.inject(client) do |client, (method_chain, args)|
if method_chain.match?('_internal')
es_version = test.cached_values['es_version'] unless test.nil?
perform_internal(method_chain, args, client, es_version)
perform_internal(method_chain, args, client, test)
else
chain = method_chain.split('.')
# If we have a method nested in a namespace, client becomes the
Expand Down Expand Up @@ -143,7 +142,8 @@ def yaml_response?
private

# Executes operations not implemented by elasticsearch-api, such as _internal
def perform_internal(method, args, client, es_version)
def perform_internal(method, args, client, test)
es_version = test.cached_values['es_version'] unless test.nil?
case method
when '_internal.update_desired_nodes'
http = 'PUT'
Expand Down Expand Up @@ -178,7 +178,12 @@ def perform_internal(method, args, client, es_version)
end
http = 'GET'
body = args.delete('body')
when '_internal.prevalidate_node_removal'
path = '/_internal/prevalidate_node_removal'
http = 'POST'
body = args.delete('body')
end
args = prepare_arguments(args, test)
@response = Elasticsearch::API::Response.new(client.perform_request(http, path, args, body))
client
end
Expand Down

0 comments on commit d4d4fa0

Please sign in to comment.