Class: GroongaQueryLog::Command::RunRegressionTest

Inherits:
Object
  • Object
show all
Defined in:
lib/groonga-query-log/command/run-regression-test.rb

Defined Under Namespace

Modules: Loggable Classes: GroongaServer, MailNotifier, Tester

Instance Method Summary collapse

Constructor Details

#initializeRunRegressionTest

Returns a new instance of RunRegressionTest.



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/groonga-query-log/command/run-regression-test.rb', line 35

def initialize
  @input_directory = Pathname.new(".")
  @working_directory = Pathname.new(".")

  @n_clients = 1

  @old_groonga = "groonga"
  @old_database = "db.old/db"
  @old_groonga_options = []
  @old_groonga_env = {}
  @old_groonga_warm_up_commands = []

  @new_groonga = "groonga"
  @new_database = "db.new/db"
  @new_groonga_options = []
  @new_groonga_env = {}
  @new_groonga_warm_up_commands = []

  @recreate_database = false
  @warm_up = true
  @load_data = true
  @run_queries = true
  @skip_finished_queries = false
  @output_query_log = false
  @stop_on_failure = false
  @rewrite_vector_equal = false
  @rewrite_vector_not_equal_empty_string = false
  @vector_accessors = []
  @rewrite_nullable_reference_number = false
  @nullable_reference_number_accessors = []
  @rewrite_not_or_regular_expression = false
  @rewrite_and_not_operator = false
  @debug_rewrite = false
  @omit_rate = 0.0
  @max_limit = -1
  @verify_cancel = false
  @cancel_max_wait = 5.0

  @care_order = true
  @ignored_drilldown_keys = []
  @target_command_names = ServerVerifier::Options.new.target_command_names

  @verify_performance = false
  @performance_verfifier_options = PerformanceVerifier::Options.new

  @read_timeout = Groonga::Client::Default::READ_TIMEOUT

  @notifier_options = {
    mail_subject_on_start: "Start",
    mail_subject_on_success: "Success",
    mail_subject_on_failure: "Failure",
    mail_from: "groonga-query-log@#{Socket.gethostname}",
    mail_to: nil,
    mail_only_on_failure: false,
    smtp_server: "localhost",
    smtp_auth_user: nil,
    smtp_auth_password: nil,
    smtp_starttls: false,
    smtp_port: 25,
  }
end

Instance Method Details

#run(command_line) ⇒ Object



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/groonga-query-log/command/run-regression-test.rb', line 97

def run(command_line)
  option_parser = create_option_parser
  begin
    option_parser.parse!(command_line)
  rescue OptionParser::ParseError => error
    $stderr.puts(error.message)
    return false
  end

  notifier = MailNotifier.new(@notifier_options)
  notifier.notify_started

  start_time = Time.now
  tester = Tester.new(old_groonga_server,
                      new_groonga_server,
                      tester_options)
  success = tester.run
  elapsed_time = Time.now - start_time
  n_leaked_objects = tester.new.n_leaked_objects

  report = format_report(success,
                         elapsed_time,
                         n_leaked_objects,
                         tester.n_executed_commands)
  notifier.notify_finished(success, report)
  puts(report)

  success and n_leaked_objects.zero?
end