grntest 1.4.4 → 1.4.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/text/news.md +31 -0
- data/lib/grntest/execution-context.rb +3 -1
- data/lib/grntest/executors/base-executor.rb +105 -16
- data/lib/grntest/executors/http-executor.rb +1 -1
- data/lib/grntest/executors/standard-io-executor.rb +1 -1
- data/lib/grntest/test-runner.rb +3 -1
- data/lib/grntest/tester.rb +15 -2
- data/lib/grntest/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e027a36e3f3e1206e89cf0cc617a5e892074bd207ee46f29ebccf9b68bf25bc0
|
4
|
+
data.tar.gz: 4393ff236546341e6abba56083164ed4bdd51564a3acc0b3087ac2bf1cc6fec1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14748646fa504319011a9cd649c732ae644ef2b7ec73a402f9740dda5a0f125e38dba7b227a4873766cc31777daf5d9407e9ab7ea5dd328f20eb858474c9a028
|
7
|
+
data.tar.gz: f34f315596201dec45cc177bfd0edba7f40f3dede8c6d8a046a28cf85fabf47ef1703340bc6008c60c751eda5712e38ea3bb0e52447118556536a93804a6a817
|
data/doc/text/news.md
CHANGED
@@ -1,5 +1,36 @@
|
|
1
1
|
# News
|
2
2
|
|
3
|
+
## 1.4.9: 2021-07-12
|
4
|
+
|
5
|
+
### Improvements
|
6
|
+
|
7
|
+
* Added `synonyms-generate` directive.
|
8
|
+
|
9
|
+
## 1.4.8: 2020-12-09
|
10
|
+
|
11
|
+
### Fixes
|
12
|
+
|
13
|
+
* `require-apache-arrow`: Fixed inverted Apache Arrow version check condition.
|
14
|
+
|
15
|
+
## 1.4.7: 2020-12-08
|
16
|
+
|
17
|
+
### Improvements
|
18
|
+
|
19
|
+
* `require-apache-arrow`: Added support for version check of Apache
|
20
|
+
Arrow in Groonga.
|
21
|
+
|
22
|
+
## 1.4.6: 2020-12-08
|
23
|
+
|
24
|
+
### Improvements
|
25
|
+
|
26
|
+
* Added `require-feature` directive.
|
27
|
+
|
28
|
+
## 1.4.5: 2020-11-11
|
29
|
+
|
30
|
+
### Improvements
|
31
|
+
|
32
|
+
* Added `sleep-after-command` directive.
|
33
|
+
|
3
34
|
## 1.4.4: 2020-07-18
|
4
35
|
|
5
36
|
### Improvements
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2012-
|
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-
|
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
|
@@ -44,6 +44,9 @@ module Grntest
|
|
44
44
|
@context = context
|
45
45
|
@custom_important_log_levels = []
|
46
46
|
@ignore_log_patterns = {}
|
47
|
+
@sleep_after_command = nil
|
48
|
+
@raw_status_response = nil
|
49
|
+
@features = nil
|
47
50
|
end
|
48
51
|
|
49
52
|
def execute(script_path)
|
@@ -321,30 +324,48 @@ module Grntest
|
|
321
324
|
parser << "#{expand_variables(groonga_command)}\n"
|
322
325
|
end
|
323
326
|
|
324
|
-
def execute_directive_require_input_type(
|
327
|
+
def execute_directive_require_input_type(line, content, options)
|
325
328
|
input_type, = options
|
326
329
|
unless @context.input_type == input_type
|
327
330
|
omit("require input type: #{input_type}")
|
328
331
|
end
|
329
332
|
end
|
330
333
|
|
331
|
-
def execute_directive_require_testee(
|
334
|
+
def execute_directive_require_testee(line, content, options)
|
332
335
|
testee, = options
|
333
336
|
unless @context.testee == testee
|
334
337
|
omit("require testee: #{testee}")
|
335
338
|
end
|
336
339
|
end
|
337
340
|
|
338
|
-
def execute_directive_require_interface(
|
341
|
+
def execute_directive_require_interface(line, content, options)
|
339
342
|
interface, = options
|
340
343
|
unless @context.interface == interface
|
341
344
|
omit("require interface: #{interface}")
|
342
345
|
end
|
343
346
|
end
|
344
347
|
|
345
|
-
def
|
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
|
+
|
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
|
346
362
|
unless defined?(::Arrow)
|
347
|
-
omit("require
|
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)
|
348
369
|
end
|
349
370
|
end
|
350
371
|
|
@@ -364,17 +385,17 @@ module Grntest
|
|
364
385
|
end
|
365
386
|
end
|
366
387
|
|
367
|
-
def execute_directive_add_ignore_log_pattern(
|
388
|
+
def execute_directive_add_ignore_log_pattern(line, content, options)
|
368
389
|
pattern = content.split(" ", 2)[1]
|
369
390
|
@ignore_log_patterns[pattern] = compile_pattern(pattern)
|
370
391
|
end
|
371
392
|
|
372
|
-
def execute_directive_remove_ignore_log_pattern(
|
393
|
+
def execute_directive_remove_ignore_log_pattern(line, content, options)
|
373
394
|
pattern = content.split(" ", 2)[1]
|
374
395
|
@ignore_log_patterns.delete(pattern)
|
375
396
|
end
|
376
397
|
|
377
|
-
def execute_directive_require_platform(
|
398
|
+
def execute_directive_require_platform(line, content, options)
|
378
399
|
platform, = options
|
379
400
|
if platform.start_with?("!")
|
380
401
|
if @context.platform == platform[1..-1]
|
@@ -387,6 +408,67 @@ module Grntest
|
|
387
408
|
end
|
388
409
|
end
|
389
410
|
|
411
|
+
def execute_directive_sleep_after_command(line, content, options)
|
412
|
+
if options[0]
|
413
|
+
time = options[0].to_f
|
414
|
+
else
|
415
|
+
time = nil
|
416
|
+
end
|
417
|
+
@sleep_after_command = time
|
418
|
+
end
|
419
|
+
|
420
|
+
def features
|
421
|
+
return @features if @features
|
422
|
+
@features = []
|
423
|
+
status_response["features"].each do |name, available|
|
424
|
+
@features << name if available
|
425
|
+
end
|
426
|
+
@features.sort!
|
427
|
+
@features
|
428
|
+
end
|
429
|
+
|
430
|
+
def formatted_features
|
431
|
+
features.join(", ")
|
432
|
+
end
|
433
|
+
|
434
|
+
def execute_directive_require_feature(line, content, options)
|
435
|
+
feature, = options
|
436
|
+
if feature.start_with?("!")
|
437
|
+
if features.include?(feature[1..-1])
|
438
|
+
omit("require feature: #{feature} (#{formatted_features})")
|
439
|
+
end
|
440
|
+
else
|
441
|
+
unless features.include?(feature)
|
442
|
+
omit("require feature: #{feature} (#{formatted_features})")
|
443
|
+
end
|
444
|
+
end
|
445
|
+
end
|
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
|
+
|
390
472
|
def execute_directive(parser, line, content)
|
391
473
|
command, *options = Shellwords.split(content)
|
392
474
|
case command
|
@@ -423,19 +505,25 @@ module Grntest
|
|
423
505
|
when "eval"
|
424
506
|
execute_directive_eval(parser, line, content, options)
|
425
507
|
when "require-input-type"
|
426
|
-
execute_directive_require_input_type(
|
508
|
+
execute_directive_require_input_type(line, content, options)
|
427
509
|
when "require-testee"
|
428
|
-
execute_directive_require_testee(
|
510
|
+
execute_directive_require_testee(line, content, options)
|
429
511
|
when "require-interface"
|
430
|
-
execute_directive_require_interface(
|
512
|
+
execute_directive_require_interface(line, content, options)
|
431
513
|
when "require-apache-arrow"
|
432
|
-
execute_directive_require_apache_arrow(
|
514
|
+
execute_directive_require_apache_arrow(line, content, options)
|
433
515
|
when "add-ignore-log-pattern"
|
434
|
-
execute_directive_add_ignore_log_pattern(
|
516
|
+
execute_directive_add_ignore_log_pattern(line, content, options)
|
435
517
|
when "remove-ignore-log-pattern"
|
436
|
-
execute_directive_remove_ignore_log_pattern(
|
518
|
+
execute_directive_remove_ignore_log_pattern(line, content, options)
|
437
519
|
when "require-platform"
|
438
|
-
execute_directive_require_platform(
|
520
|
+
execute_directive_require_platform(line, content, options)
|
521
|
+
when "sleep-after-command"
|
522
|
+
execute_directive_sleep_after_command(line, content, options)
|
523
|
+
when "require-feature"
|
524
|
+
execute_directive_require_feature(line, content, options)
|
525
|
+
when "synonym-generate"
|
526
|
+
execute_directive_synonym_generate(parser, line, content, options)
|
439
527
|
else
|
440
528
|
log_input(line)
|
441
529
|
log_error("#|e| unknown directive: <#{command}>")
|
@@ -501,6 +589,7 @@ module Grntest
|
|
501
589
|
else
|
502
590
|
type = @output_type
|
503
591
|
log_output(response)
|
592
|
+
sleep(@sleep_after_command) if @sleep_after_command
|
504
593
|
log_error(extract_important_messages(read_all_log))
|
505
594
|
log_query_log_content(read_all_query_log)
|
506
595
|
|
data/lib/grntest/test-runner.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2012-
|
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?
|
data/lib/grntest/tester.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2012-
|
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
|
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
|
data/lib/grntest/version.rb
CHANGED
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.
|
4
|
+
version: 1.4.9
|
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:
|
12
|
+
date: 2021-07-12 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.
|
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
|