grntest 1.4.8 → 1.5.2
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 +4 -4
- data/doc/text/news.md +30 -0
- data/lib/grntest/execution-context.rb +3 -1
- data/lib/grntest/executors/base-executor.rb +39 -2
- data/lib/grntest/executors/http-executor.rb +18 -0
- data/lib/grntest/executors/standard-io-executor.rb +2 -0
- data/lib/grntest/test-runner.rb +4 -1
- data/lib/grntest/tester.rb +15 -2
- data/lib/grntest/version.rb +2 -2
- 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: b52bcc8e04c96ff7cbda13f71af169b3c76fcc89fe048f5906db096f92410742
         | 
| 4 | 
            +
              data.tar.gz: 96796b1ffe639b555606acdc3181a1e0fd90cd82edc6b6e914e31c378e886ae7
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 7ad0556248d06ee80940677b7e1e7419e931d06981b47875d7a363637c9a0c6d387c08daafc09fe9c2b3cbbba2e6ea75b4402a6b0209dbc4433dbba652befa3f
         | 
| 7 | 
            +
              data.tar.gz: 5a46df9665ae1aca3201b1867792e30892caca2e5a93d0ea7cb84f29e779596e80f3bfcb7056780e9f0fe0fbce5cc35abac41fce3ec2fdd0c40f03376096e897
         | 
    
        data/doc/text/news.md
    CHANGED
    
    | @@ -1,5 +1,35 @@ | |
| 1 1 | 
             
            # News
         | 
| 2 2 |  | 
| 3 | 
            +
            ## 1.5.2: 2021-08-05
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            ### Improvements
         | 
| 6 | 
            +
             | 
| 7 | 
            +
              * `stdio`: Improved may be slow command processing.
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              * `copy-path`: Handled error.
         | 
| 10 | 
            +
             | 
| 11 | 
            +
              * `generate-series`: Improved multi threading support.
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            ## 1.5.1: 2021-07-16
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            ### Improvements
         | 
| 16 | 
            +
             | 
| 17 | 
            +
              * `http`: Improved response check.
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            ## 1.5.0: 2021-07-16
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            ### Improvements
         | 
| 22 | 
            +
             | 
| 23 | 
            +
              * `http`: Added response code check.
         | 
| 24 | 
            +
             | 
| 25 | 
            +
              * `groonga-httpd`: Increased the max body size.
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            ## 1.4.9: 2021-07-12
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            ### Improvements
         | 
| 30 | 
            +
             | 
| 31 | 
            +
              * Added `synonyms-generate` directive.
         | 
| 32 | 
            +
             | 
| 3 33 | 
             
            ## 1.4.8: 2020-12-09
         | 
| 4 34 |  | 
| 5 35 | 
             
            ### Fixes
         | 
| @@ -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
         | 
| @@ -180,7 +180,14 @@ module Grntest | |
| 180 180 | 
             
                    end
         | 
| 181 181 | 
             
                    source = resolve_path(Pathname(expand_variables(source)))
         | 
| 182 182 | 
             
                    destination = resolve_path(Pathname(expand_variables(destination)))
         | 
| 183 | 
            -
                     | 
| 183 | 
            +
                    begin
         | 
| 184 | 
            +
                      FileUtils.cp_r(source.to_s, destination.to_s)
         | 
| 185 | 
            +
                    rescue SystemCallError => error
         | 
| 186 | 
            +
                      log_input(line)
         | 
| 187 | 
            +
                      details = "#{error.class}: #{error.message}"
         | 
| 188 | 
            +
                      log_error("#|e| [copy-path] failed to copy: #{details}")
         | 
| 189 | 
            +
                      @context.error
         | 
| 190 | 
            +
                    end
         | 
| 184 191 | 
             
                  end
         | 
| 185 192 |  | 
| 186 193 | 
             
                  def timeout_value(key, line, input, default)
         | 
| @@ -313,7 +320,10 @@ module Grntest | |
| 313 320 | 
             
                        end
         | 
| 314 321 | 
             
                        record << "\n"
         | 
| 315 322 | 
             
                        record << evaluator.evaluate(i).to_json
         | 
| 323 | 
            +
                        before = Time.now
         | 
| 316 324 | 
             
                        parser << record
         | 
| 325 | 
            +
                        elapsed = Time.now - before
         | 
| 326 | 
            +
                        Thread.pass if elapsed > 1.0
         | 
| 317 327 | 
             
                      end
         | 
| 318 328 | 
             
                      parser << "\n]\n"
         | 
| 319 329 | 
             
                    end
         | 
| @@ -444,6 +454,31 @@ module Grntest | |
| 444 454 | 
             
                    end
         | 
| 445 455 | 
             
                  end
         | 
| 446 456 |  | 
| 457 | 
            +
                  def execute_directive_synonym_generate(parser, line, content, options)
         | 
| 458 | 
            +
                    if @context.groonga_synonym_generate.nil?
         | 
| 459 | 
            +
                      omit("groonga-synonym-generate isn't specified")
         | 
| 460 | 
            +
                    end
         | 
| 461 | 
            +
             | 
| 462 | 
            +
                    table, *args = options
         | 
| 463 | 
            +
                    command_line = [
         | 
| 464 | 
            +
                      @context.groonga_synonym_generate,
         | 
| 465 | 
            +
                      *args,
         | 
| 466 | 
            +
                    ]
         | 
| 467 | 
            +
                    packed_command_line = command_line.join(" ")
         | 
| 468 | 
            +
                    log_input("#{packed_command_line}\n")
         | 
| 469 | 
            +
                    begin
         | 
| 470 | 
            +
                      IO.popen(command_line, "r:ascii-8bit") do |io|
         | 
| 471 | 
            +
                        parser << "load --table #{table}\n"
         | 
| 472 | 
            +
                        io.each_line do |line|
         | 
| 473 | 
            +
                          parser << line
         | 
| 474 | 
            +
                        end
         | 
| 475 | 
            +
                      end
         | 
| 476 | 
            +
                    rescue SystemCallError
         | 
| 477 | 
            +
                      raise Error.new("failed to run groonga-synonym-generate: " +
         | 
| 478 | 
            +
                                      "<#{packed_command_line}>: #{$!}")
         | 
| 479 | 
            +
                    end
         | 
| 480 | 
            +
                  end
         | 
| 481 | 
            +
             | 
| 447 482 | 
             
                  def execute_directive(parser, line, content)
         | 
| 448 483 | 
             
                    command, *options = Shellwords.split(content)
         | 
| 449 484 | 
             
                    case command
         | 
| @@ -497,6 +532,8 @@ module Grntest | |
| 497 532 | 
             
                      execute_directive_sleep_after_command(line, content, options)
         | 
| 498 533 | 
             
                    when "require-feature"
         | 
| 499 534 | 
             
                      execute_directive_require_feature(line, content, options)
         | 
| 535 | 
            +
                    when "synonym-generate"
         | 
| 536 | 
            +
                      execute_directive_synonym_generate(parser, line, content, options)
         | 
| 500 537 | 
             
                    else
         | 
| 501 538 | 
             
                      log_input(line)
         | 
| 502 539 | 
             
                      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 |  | 
| @@ -65,10 +65,12 @@ module Grntest | |
| 65 65 |  | 
| 66 66 | 
             
                  MAY_SLOW_COMMANDS = [
         | 
| 67 67 | 
             
                    "column_create",
         | 
| 68 | 
            +
                    "delete",
         | 
| 68 69 | 
             
                    "load",
         | 
| 69 70 | 
             
                    "logical_table_remove",
         | 
| 70 71 | 
             
                    "plugin_register",
         | 
| 71 72 | 
             
                    "register",
         | 
| 73 | 
            +
                    "wal_recover",
         | 
| 72 74 | 
             
                  ]
         | 
| 73 75 | 
             
                  def may_slow_command?(command)
         | 
| 74 76 | 
             
                    MAY_SLOW_COMMANDS.include?(command.name)
         | 
    
        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?
         | 
| @@ -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 | 
             
            }
         | 
    
        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
    
    | @@ -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
         | 
| @@ -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. | 
| 17 | 
            +
              VERSION = "1.5.2"
         | 
| 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 | 
            +
              version: 1.5.2
         | 
| 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-08-05 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
         |