grntest 1.4.7 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 79fb44c3eebc5c70ba4d7a0c6821d653d77b6bb7c20791a86cd973bbf90fa970
4
- data.tar.gz: 95ed0edd5d3f25e2f9d450edda7f0f58ad16354ab66c8163d9cfdc353610db6c
3
+ metadata.gz: f74f96285e7ff0f9537ae2165f7fba29a9fb705a686e98f1281f7203b46521c5
4
+ data.tar.gz: 89d86885e7b67cb0f98312856be0ed6cbb2f0264a4ba281fe8ca542f06e39dad
5
5
  SHA512:
6
- metadata.gz: bdfaf0c54e4dd784827fbb3f2ff34acfe1dce69ef168260ede87f6d570dd190490199aec105fc2a1357c6cd46a1b4da80c993373402044d0655dac821680921e
7
- data.tar.gz: 583b24ab3901660faa706728df925c592dfaf8746df548f4bfee78a710b1bf10951bad1087b3df951ca8d8e8baecd5a00852b2cebd2eccd5fbf0f22f962e1332
6
+ metadata.gz: a6964575dd5fd1e3ec6160416795e10f6ac720f7bedee4413167196b055278f0196dac8dc017f620843c485cb4277ee20dbebddc0ab5ce3a242577d0008214f3
7
+ data.tar.gz: 4ab4f3f9925b14ef915eb781e0a02e53d1039549b035b830f51a0016f421fb31372631d8398824bb41563bc50b966eca7ad67916e2ef660123e0672235de9080
data/doc/text/news.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # News
2
2
 
3
+ ## 1.5.1: 2021-07-16
4
+
5
+ ### Improvements
6
+
7
+ * `http`: Improved response check.
8
+
9
+ ## 1.5.0: 2021-07-16
10
+
11
+ ### Improvements
12
+
13
+ * `http`: Added response code check.
14
+
15
+ * `groonga-httpd`: Increased the max body size.
16
+
17
+ ## 1.4.9: 2021-07-12
18
+
19
+ ### Improvements
20
+
21
+ * Added `synonyms-generate` directive.
22
+
23
+ ## 1.4.8: 2020-12-09
24
+
25
+ ### Fixes
26
+
27
+ * `require-apache-arrow`: Fixed inverted Apache Arrow version check condition.
28
+
3
29
  ## 1.4.7: 2020-12-08
4
30
 
5
31
  ### Improvements
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2020 Sutou Kouhei <kou@clear-code.com>
1
+ # Copyright (C) 2012-2021 Sutou Kouhei <kou@clear-code.com>
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU General Public License as published by
@@ -20,6 +20,7 @@ module Grntest
20
20
  attr_accessor :plugins_directory
21
21
  attr_accessor :plugin_extension
22
22
  attr_accessor :groonga_suggest_create_dataset
23
+ attr_accessor :groonga_synonym_generate
23
24
  attr_accessor :testee
24
25
  attr_accessor :interface
25
26
  attr_accessor :result
@@ -46,6 +47,7 @@ module Grntest
46
47
  @plugins_directory = nil
47
48
  @plugin_extension = guess_plugin_extension
48
49
  @groonga_suggest_create_dataset = "groonga-suggest-create-dataset"
50
+ @groonga_synonym_generate = "groonga-synonym-generate"
49
51
  @testee = "groonga"
50
52
  @interface = "stdio"
51
53
  @n_nested = 0
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2020 Sutou Kouhei <kou@clear-code.com>
1
+ # Copyright (C) 2012-2021 Sutou Kouhei <kou@clear-code.com>
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU General Public License as published by
@@ -363,7 +363,7 @@ module Grntest
363
363
  omit("require Red Arrow in grntest")
364
364
  end
365
365
  return if version.nil?
366
- if Gem::Version.new(version) < Gem::Version.new(_apache_arrow_version)
366
+ if Gem::Version.new(version) > Gem::Version.new(_apache_arrow_version)
367
367
  omit("require Apache Arrow #{version} in Groonga: " +
368
368
  _apache_arrow_version)
369
369
  end
@@ -444,6 +444,31 @@ module Grntest
444
444
  end
445
445
  end
446
446
 
447
+ def execute_directive_synonym_generate(parser, line, content, options)
448
+ if @context.groonga_synonym_generate.nil?
449
+ omit("groonga-synonym-generate isn't specified")
450
+ end
451
+
452
+ table, *args = options
453
+ command_line = [
454
+ @context.groonga_synonym_generate,
455
+ *args,
456
+ ]
457
+ packed_command_line = command_line.join(" ")
458
+ log_input("#{packed_command_line}\n")
459
+ begin
460
+ IO.popen(command_line, "r:ascii-8bit") do |io|
461
+ parser << "load --table #{table}\n"
462
+ io.each_line do |line|
463
+ parser << line
464
+ end
465
+ end
466
+ rescue SystemCallError
467
+ raise Error.new("failed to run groonga-synonym-generate: " +
468
+ "<#{packed_command_line}>: #{$!}")
469
+ end
470
+ end
471
+
447
472
  def execute_directive(parser, line, content)
448
473
  command, *options = Shellwords.split(content)
449
474
  case command
@@ -497,6 +522,8 @@ module Grntest
497
522
  execute_directive_sleep_after_command(line, content, options)
498
523
  when "require-feature"
499
524
  execute_directive_require_feature(line, content, options)
525
+ when "synonym-generate"
526
+ execute_directive_synonym_generate(parser, line, content, options)
500
527
  else
501
528
  log_input(line)
502
529
  log_error("#|e| unknown directive: <#{command}>")
@@ -78,6 +78,18 @@ module Grntest
78
78
  DEBUG = (ENV["GRNTEST_HTTP_DEBUG"] == "yes")
79
79
  LOAD_DEBUG = (DEBUG or (ENV["GRNTEST_HTTP_LOAD_DEBUG"] == "yes"))
80
80
 
81
+ def check_response(response)
82
+ case response
83
+ when Net::HTTPBadRequest,
84
+ Net::HTTPNotFound
85
+ # Groonga returns them for an invalid request.
86
+ when Net::HTTPInternalServerError
87
+ # Groonga returns this for an internal error.
88
+ else
89
+ response.value
90
+ end
91
+ end
92
+
81
93
  MAX_URI_SIZE = 4096
82
94
  def send_load_command(command)
83
95
  lines = command.original_source.lines
@@ -122,6 +134,7 @@ module Grntest
122
134
  http.read_timeout = read_timeout
123
135
  http.request(request)
124
136
  end
137
+ check_response(response)
125
138
  normalize_response_data(command, response.body)
126
139
  end
127
140
  end
@@ -144,6 +157,7 @@ module Grntest
144
157
  http.read_timeout = read_timeout
145
158
  http.request(request)
146
159
  end
160
+ check_response(response)
147
161
  normalize_response_data(command, response.body)
148
162
  end
149
163
  end
@@ -174,6 +188,10 @@ module Grntest
174
188
  message = "bad HTTP header syntax in Groonga response: <#{url}>: "
175
189
  message << "#{$!.class}: #{$!.message}"
176
190
  raise Error.new(message)
191
+ rescue Net::HTTPServerException
192
+ message = "exception from Groonga: <#{url}>: "
193
+ message << "#{$!.class}: #{$!.message}"
194
+ raise Error.new(message)
177
195
  end
178
196
  end
179
197
 
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2020 Sutou Kouhei <kou@clear-code.com>
1
+ # Copyright (C) 2012-2021 Sutou Kouhei <kou@clear-code.com>
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU General Public License as published by
@@ -137,6 +137,8 @@ module Grntest
137
137
  context.plugins_directory = @tester.plugins_directory.expand_path
138
138
  context.groonga_suggest_create_dataset =
139
139
  @tester.groonga_suggest_create_dataset
140
+ context.groonga_synonym_generate =
141
+ @tester.groonga_synonym_generate
140
142
  context.testee = @tester.testee
141
143
  context.interface = @tester.interface
142
144
  context.use_http_post = @tester.use_http_post?
@@ -543,6 +545,7 @@ http {
543
545
  groonga_log_path #{context.log_path};
544
546
  groonga_query_log_path #{context.query_log_path};
545
547
  groonga on;
548
+ client_max_body_size 500m;
546
549
  }
547
550
  }
548
551
  }
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2020 Sutou Kouhei <kou@clear-code.com>
1
+ # Copyright (C) 2012-2021 Sutou Kouhei <kou@clear-code.com>
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU General Public License as published by
@@ -56,6 +56,12 @@ module Grntest
56
56
  tester.groonga_suggest_create_dataset = normalize_command(command)
57
57
  end
58
58
 
59
+ parser.on("--groonga-synonym-generate=COMMAND",
60
+ "Use COMMAND as groonga_synonym_generate command",
61
+ "(#{tester.groonga_synonym_generate})") do |command|
62
+ tester.groonga_synonym_generate = normalize_command(command)
63
+ end
64
+
59
65
  available_interfaces = ["stdio", "http"]
60
66
  available_interface_labels = available_interfaces.join(", ")
61
67
  parser.on("--interface=INTERFACE", available_interfaces,
@@ -303,7 +309,10 @@ module Grntest
303
309
  end
304
310
  end
305
311
 
306
- attr_accessor :groonga, :groonga_httpd, :groonga_suggest_create_dataset
312
+ attr_accessor :groonga
313
+ attr_accessor :groonga_httpd
314
+ attr_accessor :groonga_suggest_create_dataset
315
+ attr_accessor :groonga_synonym_generate
307
316
  attr_accessor :interface
308
317
  attr_writer :use_http_post
309
318
  attr_writer :use_http_chunked
@@ -334,6 +343,10 @@ module Grntest
334
343
  unless command_exist?(@groonga_suggest_create_dataset)
335
344
  @groonga_suggest_create_dataset = nil
336
345
  end
346
+ @groonga_synonym_generate = "groonga-synonym-generate"
347
+ unless command_exist?(@groonga_synonym_generate)
348
+ @groonga_synonym_generate = nil
349
+ end
337
350
  @interface = "stdio"
338
351
  @use_http_post = false
339
352
  @use_http_chunked = false
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2020 Sutou Kouhei <kou@clear-code.com>
1
+ # Copyright (C) 2012-2021 Sutou Kouhei <kou@clear-code.com>
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU General Public License as published by
@@ -14,5 +14,5 @@
14
14
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
15
 
16
16
  module Grntest
17
- VERSION = "1.4.7"
17
+ VERSION = "1.5.1"
18
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grntest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.7
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-12-08 00:00:00.000000000 Z
12
+ date: 2021-07-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: diff-lcs
@@ -270,7 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
270
270
  - !ruby/object:Gem::Version
271
271
  version: '0'
272
272
  requirements: []
273
- rubygems_version: 3.2.0.rc.2
273
+ rubygems_version: 3.3.0.dev
274
274
  signing_key:
275
275
  specification_version: 4
276
276
  summary: Grntest is a testing framework for Groonga. You can write a test for Groonga