Navigation Menu

Skip to content

Commit

Permalink
verify-server: add --stop-on-failure option
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Jun 18, 2018
1 parent 10def08 commit bf9786c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/groonga-query-log/command/verify-server.rb
Expand Up @@ -148,6 +148,12 @@ def create_parser
@options.ignored_drilldown_keys << key
end

parser.on("--[no-]stop-on-failure",
"Stop execution on the first failure",
"(#{@options.stop_on_failure})") do |boolean|
@options.stop_on_failure = boolean
end

parser.separator("Debug options:")
parser.separator("")

Expand Down
8 changes: 8 additions & 0 deletions lib/groonga-query-log/server-verifier.rb
Expand Up @@ -49,6 +49,8 @@ def run_producer(input, &callback)
n_commands = 0
callback_per_n_commands = 100
parser.parse(input) do |statistic|
break if !@same and @options.stop_on_failure?

command = statistic.command
next if command.nil?
next unless target_command?(command)
Expand Down Expand Up @@ -178,6 +180,7 @@ class Options
attr_accessor :care_order
attr_writer :verify_cache
attr_accessor :ignored_drilldown_keys
attr_writer :stop_on_failure
def initialize
@groonga1 = GroongaOptions.new
@groonga2 = GroongaOptions.new
Expand All @@ -199,6 +202,7 @@ def initialize
@care_order = true
@verify_cache = false
@ignored_drilldown_keys = []
@stop_on_failure = false
end

def request_queue_size
Expand All @@ -213,6 +217,10 @@ def verify_cache?
@verify_cache
end

def stop_on_failure?
@stop_on_failure
end

def target_command_name?(name)
return false if name.nil?

Expand Down

0 comments on commit bf9786c

Please sign in to comment.