grntest 1.4.6 → 1.5.0

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: 88fbad2fdde680dc3110737087f9818240bd130ea4c61c14478d89577dd99420
4
- data.tar.gz: e98f331062e055f4fd914ef1916dc4859614e1ef0c9f3a16c978d00d73d05a23
3
+ metadata.gz: 482d04165fd7dc5994528ae65d9c869440e45e6bad2c1851a96288f4a65c08a6
4
+ data.tar.gz: 479ba023a7ed7f2ccb9554160a102ed73fe4de173e7b225f63af6f72c9990750
5
5
  SHA512:
6
- metadata.gz: 4e51b3927eb61e1232ade4c179a140eddd68d41d5231f4bee0e7b356cce389d8b72c110f5217418d9e214fa071486bd3ffe55e61e2e9def19b90b425e193e2ca
7
- data.tar.gz: bd7a5ad8f297572b51f797f359ae2c42d9a01a013d6c48c6d3e168d648bf32af405ec0f8af36f1e0fef84a86756ccb2b918988a35696ed3af505e50dd23350bc
6
+ metadata.gz: 8e4f5687fbf84811d5ca93193407f00041fe5549a685e0181c1cde62564898c168386b94ce9c5882762309f0b6b91d30c18a25e09db3e4bb3fe76aa0d2e651a8
7
+ data.tar.gz: 05ccec382c7f186b3dad5fe75a10b50e10b3bf213e8021c4d22d288dcaffd94c7f79f03c625f718f593bcbea8d140937b10c8937de2962b426dfec6d38870682
data/doc/text/news.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # News
2
2
 
3
+ ## 1.5.0: 2021-07-16
4
+
5
+ ### Improvements
6
+
7
+ * `http`: Added response code check.
8
+
9
+ * `groonga-httpd`: Increased the max body size.
10
+
11
+ ## 1.4.9: 2021-07-12
12
+
13
+ ### Improvements
14
+
15
+ * Added `synonyms-generate` directive.
16
+
17
+ ## 1.4.8: 2020-12-09
18
+
19
+ ### Fixes
20
+
21
+ * `require-apache-arrow`: Fixed inverted Apache Arrow version check condition.
22
+
23
+ ## 1.4.7: 2020-12-08
24
+
25
+ ### Improvements
26
+
27
+ * `require-apache-arrow`: Added support for version check of Apache
28
+ Arrow in Groonga.
29
+
3
30
  ## 1.4.6: 2020-12-08
4
31
 
5
32
  ### 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
@@ -45,7 +45,7 @@ module Grntest
45
45
  @custom_important_log_levels = []
46
46
  @ignore_log_patterns = {}
47
47
  @sleep_after_command = nil
48
- @status_response = nil
48
+ @raw_status_response = nil
49
49
  @features = nil
50
50
  end
51
51
 
@@ -345,9 +345,27 @@ module Grntest
345
345
  end
346
346
  end
347
347
 
348
+ def status_response
349
+ @status_response ||= JSON.parse(@raw_status_response)[1]
350
+ end
351
+
352
+ def apache_arrow_version
353
+ (status_response["apache_arrow"] || {})["version"]
354
+ end
355
+
348
356
  def execute_directive_require_apache_arrow(line, content, options)
357
+ version, = options
358
+ _apache_arrow_version = apache_arrow_version
359
+ if _apache_arrow_version.nil?
360
+ omit("require Apache Arrow support in Groonga")
361
+ end
349
362
  unless defined?(::Arrow)
350
- omit("require Apache Arrow")
363
+ omit("require Red Arrow in grntest")
364
+ end
365
+ return if version.nil?
366
+ if Gem::Version.new(version) > Gem::Version.new(_apache_arrow_version)
367
+ omit("require Apache Arrow #{version} in Groonga: " +
368
+ _apache_arrow_version)
351
369
  end
352
370
  end
353
371
 
@@ -402,7 +420,7 @@ module Grntest
402
420
  def features
403
421
  return @features if @features
404
422
  @features = []
405
- JSON.parse(@status_response)[1]["features"].each do |name, available|
423
+ status_response["features"].each do |name, available|
406
424
  @features << name if available
407
425
  end
408
426
  @features.sort!
@@ -426,6 +444,31 @@ module Grntest
426
444
  end
427
445
  end
428
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
+
429
472
  def execute_directive(parser, line, content)
430
473
  command, *options = Shellwords.split(content)
431
474
  case command
@@ -479,6 +522,8 @@ module Grntest
479
522
  execute_directive_sleep_after_command(line, content, options)
480
523
  when "require-feature"
481
524
  execute_directive_require_feature(line, content, options)
525
+ when "synonym-generate"
526
+ execute_directive_synonym_generate(parser, line, content, options)
482
527
  else
483
528
  log_input(line)
484
529
  log_error("#|e| unknown directive: <#{command}>")
@@ -61,7 +61,7 @@ module Grntest
61
61
  def ensure_groonga_ready
62
62
  n_retried = 0
63
63
  begin
64
- @status_response = send_command(command("status"))
64
+ @raw_status_response = send_command(command("status"))
65
65
  rescue Error
66
66
  n_retried += 1
67
67
  sleep(0.1)
@@ -78,6 +78,10 @@ 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
+ response.value
83
+ end
84
+
81
85
  MAX_URI_SIZE = 4096
82
86
  def send_load_command(command)
83
87
  lines = command.original_source.lines
@@ -122,6 +126,7 @@ module Grntest
122
126
  http.read_timeout = read_timeout
123
127
  http.request(request)
124
128
  end
129
+ check_response(response)
125
130
  normalize_response_data(command, response.body)
126
131
  end
127
132
  end
@@ -144,6 +149,7 @@ module Grntest
144
149
  http.read_timeout = read_timeout
145
150
  http.request(request)
146
151
  end
152
+ check_response(response)
147
153
  normalize_response_data(command, response.body)
148
154
  end
149
155
  end
@@ -174,6 +180,10 @@ module Grntest
174
180
  message = "bad HTTP header syntax in Groonga response: <#{url}>: "
175
181
  message << "#{$!.class}: #{$!.message}"
176
182
  raise Error.new(message)
183
+ rescue Net::HTTPServerException
184
+ message = "exception from Groonga: <#{url}>: "
185
+ message << "#{$!.class}: #{$!.message}"
186
+ raise Error.new(message)
177
187
  end
178
188
  end
179
189
 
@@ -44,7 +44,7 @@ module Grntest
44
44
  def ensure_groonga_ready
45
45
  @input.print("status\n")
46
46
  @input.flush
47
- @status_response = @output.gets
47
+ @raw_status_response = @output.gets
48
48
  end
49
49
 
50
50
  def create_sub_executor(context)
@@ -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.6"
17
+ VERSION = "1.5.0"
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.6
4
+ version: 1.5.0
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