Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/groonga-query-log/command/run-regression-test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def initialize
@skip_finished_queries = false
@output_query_log = false
@stop_on_failure = false
@retry_on_no_response = false
@rewrite_vector_equal = false
@rewrite_vector_not_equal_empty_string = false
@vector_accessors = []
Expand Down Expand Up @@ -199,6 +200,11 @@ def create_option_parser
"(#{@stop_on_failure})") do |boolean|
@stop_on_failure = boolean
end
parser.on("--[no-]retry-on-no-response",
"Retry execution when the no response",
"(#{@retry_on_no_response})") do |boolean|
@retry_on_no_response = boolean
end
parser.on("--[no-]rewrite-vector-equal",
"Rewrite 'vector == ...' with 'vector @ ...'",
"(#{@rewrite_vector_equal})") do |boolean|
Expand Down Expand Up @@ -379,6 +385,7 @@ def tester_options
:skip_finished_queries => @skip_finished_queries,
:ignored_drilldown_keys => @ignored_drilldown_keys,
:stop_on_failure => @stop_on_failure,
:retry_on_no_response => @retry_on_no_response,
:rewrite_vector_equal => @rewrite_vector_equal,
:rewrite_vector_not_equal_empty_string =>
@rewrite_vector_not_equal_empty_string,
Expand Down Expand Up @@ -602,6 +609,7 @@ def initialize(old, new, options)
options[:results_directory] || (@working_directory + "results")
@n_clients = options[:n_clients] || 1
@stop_on_failure = options[:stop_on_failure]
@retry_on_no_response = options[:retry_on_no_response]
@options = options
@n_ready_waits = 2
end
Expand Down Expand Up @@ -699,6 +707,9 @@ def verify_server(test_log_path, query_log_path, &callback)
if @stop_on_failure
command_line << "--stop-on-failure"
end
if @retry_on_no_response
command_line << "--retry-on-no-response"
end
if @options[:rewrite_vector_equal]
command_line << "--rewrite-vector-equal"
end
Expand Down
6 changes: 6 additions & 0 deletions lib/groonga-query-log/command/verify-server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@ def create_parser
@options.stop_on_failure = boolean
end

parser.on("--[no-]retry-on-no-response",
"Retry execution when the no response",
"(#{@options.retry_on_no_response?})") do |boolean|
@options.retry_on_no_response = boolean
end

parser.on("--[no-]rewrite-vector-equal",
"Rewrite 'vector == ...' with 'vector @ ...'",
"(#{@options.rewrite_vector_equal?})") do |boolean|
Expand Down
18 changes: 16 additions & 2 deletions lib/groonga-query-log/server-verifier.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright (C) 2013-2018 Kouhei Sutou <[email protected]>
# Copyright (C) 2019 Horimoto Yasuhiro <[email protected]>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
Expand Down Expand Up @@ -170,8 +171,15 @@ def verify_command(groonga1_client, groonga2_client, command)
command["output_type"] = "json"
rewrite_filter(command, "filter")
rewrite_filter(command, "scorer")
response1 = groonga1_client.execute(command)
response2 = groonga2_client.execute(command)

response1, response2 = ""
n_tries = 3
n_tries.times do
response1 = groonga1_client.execute(command)
response2 = groonga2_client.execute(command)
break unless @options.retry_on_no_response?
break if (!response1.nil? && !response2.nil?)
end
compare_options = {
:care_order => @options.care_order,
:ignored_drilldown_keys => @options.ignored_drilldown_keys,
Expand Down Expand Up @@ -271,6 +279,7 @@ class Options
attr_writer :verify_cache
attr_accessor :ignored_drilldown_keys
attr_writer :stop_on_failure
attr_writer :retry_on_no_response
attr_writer :rewrite_vector_equal
attr_writer :rewrite_vector_not_equal_empty_string
attr_accessor :vector_accessors
Expand Down Expand Up @@ -303,6 +312,7 @@ def initialize
@verify_cache = false
@ignored_drilldown_keys = []
@stop_on_failure = false
@retry_on_no_response = false
@rewrite_vector_equal = false
@rewrite_vector_not_equal_empty_string = false
@vector_accessors = []
Expand Down Expand Up @@ -330,6 +340,10 @@ def stop_on_failure?
@stop_on_failure
end

def retry_on_no_response?
@retry_on_no_response
end

def rewrite_vector_equal?
@rewrite_vector_equal
end
Expand Down