elasticsearch-test-runner 0.3.1 โ 0.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:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: f7aaf5fcd5db6429d758a6c1aec62248b04bd36c4b6a2b664382222429364546
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 1956840598048cfe9ec25d41a0cc4150048c6099d4d63f6a36783cc9700a9202
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 462f62c87dd7a8ebbaa7b63992d12f02f89b6c7109532e701aa678a94dc4caf0bf65444962c9bc8dc13f51d842fcb5188995ec8579e6fa76be36e669899b5ae8
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 79bf2ece186c677fcb2c99ef975996dc64b6769bc4414f435ef135eedd4776eb18c07f75bc70b858ef290ec7b1a4537d8963bac5d0e389336422a2772b7e2eaf
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,5 +1,17 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ## [Unreleased]
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            ## [0.5.0] - 2024-07-30
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            - Clears `@response` before running a new action
         
     | 
| 
      
 6 
     | 
    
         
            +
            - Fixes `expected_exception?` for failures
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            ## [0.4.0] - 2024-07-08
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            - Refactors display of errors/passing tests. Adds `QUIET` environment variable parsing. If `true`, display for passing tests will be more compact (not showing file/test names).
         
     | 
| 
      
 11 
     | 
    
         
            +
            - Updates count for better accuracy in test results.
         
     | 
| 
      
 12 
     | 
    
         
            +
            - Rescues SystemExit, Interrupt to actually exit the script
         
     | 
| 
      
 13 
     | 
    
         
            +
            - Adds support for catch in tests: If the arguments to `do` include `catch`, then we are expecting an error, which should be caught and tested.
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
       3 
15 
     | 
    
         
             
            ## [0.3.1] - 2024-06-27
         
     | 
| 
       4 
16 
     | 
    
         | 
| 
       5 
17 
     | 
    
         
             
            - Fixes in error handling.
         
     | 
| 
         @@ -35,6 +35,8 @@ module Elasticsearch 
     | 
|
| 
       35 
35 
     | 
    
         
             
                  # specifications. These are function calls to the Elasticsearch clients.
         
     | 
| 
       36 
36 
     | 
    
         
             
                  #
         
     | 
| 
       37 
37 
     | 
    
         
             
                  def do_action(action)
         
     | 
| 
      
 38 
     | 
    
         
            +
                    @response = nil
         
     | 
| 
      
 39 
     | 
    
         
            +
                    catchable = action.delete('catch')
         
     | 
| 
       38 
40 
     | 
    
         
             
                    client = @client
         
     | 
| 
       39 
41 
     | 
    
         
             
                    action = action.first if action.is_a?(Array)
         
     | 
| 
       40 
42 
     | 
    
         
             
                    method, params = action.is_a?(String) ? [action, {}] : action.first
         
     | 
| 
         @@ -45,11 +47,41 @@ module Elasticsearch 
     | 
|
| 
       45 
47 
     | 
    
         
             
                      client = @client.send(arrayed_method.first)
         
     | 
| 
       46 
48 
     | 
    
         
             
                      method = arrayed_method.last
         
     | 
| 
       47 
49 
     | 
    
         
             
                    end
         
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
50 
     | 
    
         
             
                    @response = client.send(method.to_sym, process_params(params))
         
     | 
| 
      
 51 
     | 
    
         
            +
                    puts @response if ENV['DEBUG']
         
     | 
| 
       50 
52 
     | 
    
         
             
                    @response
         
     | 
| 
       51 
53 
     | 
    
         
             
                  rescue StandardError => e
         
     | 
| 
       52 
     | 
    
         
            -
                    raise e
         
     | 
| 
      
 54 
     | 
    
         
            +
                    raise e unless expected_exception?(catchable, e)
         
     | 
| 
      
 55 
     | 
    
         
            +
                  end
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
                  def expected_exception?(error_type, e)
         
     | 
| 
      
 58 
     | 
    
         
            +
                    return false if error_type.nil?
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
                    case error_type
         
     | 
| 
      
 61 
     | 
    
         
            +
                    when 'request_timeout'
         
     | 
| 
      
 62 
     | 
    
         
            +
                      e.is_a?(Elastic::Transport::Transport::Errors::RequestTimeout)
         
     | 
| 
      
 63 
     | 
    
         
            +
                    when 'missing'
         
     | 
| 
      
 64 
     | 
    
         
            +
                      e.is_a?(Elastic::Transport::Transport::Errors::NotFound)
         
     | 
| 
      
 65 
     | 
    
         
            +
                    when 'conflict'
         
     | 
| 
      
 66 
     | 
    
         
            +
                      e.is_a?(Elastic::Transport::Transport::Errors::Conflict)
         
     | 
| 
      
 67 
     | 
    
         
            +
                    when 'request'
         
     | 
| 
      
 68 
     | 
    
         
            +
                      e.is_a?(Elastic::Transport::Transport::Errors::InternalServerError)
         
     | 
| 
      
 69 
     | 
    
         
            +
                    when 'bad_request'
         
     | 
| 
      
 70 
     | 
    
         
            +
                      e.is_a?(Elastic::Transport::Transport::Errors::BadRequest)
         
     | 
| 
      
 71 
     | 
    
         
            +
                    when 'param'
         
     | 
| 
      
 72 
     | 
    
         
            +
                      actual_error.is_a?(ArgumentError)
         
     | 
| 
      
 73 
     | 
    
         
            +
                    when 'unauthorized'
         
     | 
| 
      
 74 
     | 
    
         
            +
                      e.is_a?(Elastic::Transport::Transport::Errors::Unauthorized)
         
     | 
| 
      
 75 
     | 
    
         
            +
                    when 'forbidden'
         
     | 
| 
      
 76 
     | 
    
         
            +
                      e.is_a?(Elastic::Transport::Transport::Errors::Forbidden)
         
     | 
| 
      
 77 
     | 
    
         
            +
                    when /error parsing field/, /illegal_argument_exception/
         
     | 
| 
      
 78 
     | 
    
         
            +
                      e.message =~ /\[400\]/ ||
         
     | 
| 
      
 79 
     | 
    
         
            +
                        e.is_a?(Elastic::Transport::Transport::Errors::BadRequest)
         
     | 
| 
      
 80 
     | 
    
         
            +
                    when /NullPointerException/
         
     | 
| 
      
 81 
     | 
    
         
            +
                      e.message =~ /\[400\]/
         
     | 
| 
      
 82 
     | 
    
         
            +
                    else
         
     | 
| 
      
 83 
     | 
    
         
            +
                      e.message =~ /#{error_type}/
         
     | 
| 
      
 84 
     | 
    
         
            +
                    end
         
     | 
| 
       53 
85 
     | 
    
         
             
                  end
         
     | 
| 
       54 
86 
     | 
    
         | 
| 
       55 
87 
     | 
    
         
             
                  # Code for matching expectations and response
         
     | 
| 
         @@ -28,7 +28,11 @@ module Elasticsearch 
     | 
|
| 
       28 
28 
     | 
    
         
             
                               else
         
     | 
| 
       29 
29 
     | 
    
         
             
                                 @response.status
         
     | 
| 
       30 
30 
     | 
    
         
             
                               end
         
     | 
| 
       31 
     | 
    
         
            -
                     
     | 
| 
      
 31 
     | 
    
         
            +
                    if ENV['QUIET']
         
     | 
| 
      
 32 
     | 
    
         
            +
                      print '๐ข '
         
     | 
| 
      
 33 
     | 
    
         
            +
                    else
         
     | 
| 
      
 34 
     | 
    
         
            +
                      puts "๐ข #{@file} #{@title} passed. Response: #{response}"
         
     | 
| 
      
 35 
     | 
    
         
            +
                    end
         
     | 
| 
       32 
36 
     | 
    
         
             
                  end
         
     | 
| 
       33 
37 
     | 
    
         | 
| 
       34 
38 
     | 
    
         
             
                  def print_failure(action, response)
         
     | 
| 
         @@ -70,13 +74,14 @@ module Elasticsearch 
     | 
|
| 
       70 
74 
     | 
    
         
             
                    errors.map do |error|
         
     | 
| 
       71 
75 
     | 
    
         
             
                      puts "๐งช Test: #{error[:file]}"
         
     | 
| 
       72 
76 
     | 
    
         
             
                      puts "โถ Action: #{error[:action].first}" if error[:action]
         
     | 
| 
       73 
     | 
    
         
            -
                      puts "๐ฌ #{error[:error].message}"
         
     | 
| 
      
 77 
     | 
    
         
            +
                      puts "๐ฌ #{error.class} - #{error[:error].message}"
         
     | 
| 
       74 
78 
     | 
    
         
             
                      pp error[:error].backtrace.join("$/\n") if ENV['DEBUG']
         
     | 
| 
       75 
79 
     | 
    
         
             
                      puts
         
     | 
| 
       76 
80 
     | 
    
         
             
                    end
         
     | 
| 
       77 
81 
     | 
    
         
             
                  end
         
     | 
| 
       78 
82 
     | 
    
         | 
| 
       79 
83 
     | 
    
         
             
                  def self.display_summary(tests_count, errors_count, start_time)
         
     | 
| 
      
 84 
     | 
    
         
            +
                    puts
         
     | 
| 
       80 
85 
     | 
    
         
             
                    puts "--- ๐งช Tests: #{tests_count} | Passed: #{tests_count - errors_count} | Failed: #{errors_count}"
         
     | 
| 
       81 
86 
     | 
    
         
             
                    puts "--- โฒ  Elapsed time: #{Time.at(Time.now - start_time).utc.strftime("%H:%M:%S")}"
         
     | 
| 
       82 
87 
     | 
    
         
             
                  end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: elasticsearch-test-runner
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.5.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Elastic Client Library Maintainers
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2024- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2024-07-30 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: elasticsearch
         
     | 
| 
         @@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       84 
84 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       85 
85 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       86 
86 
     | 
    
         
             
            requirements: []
         
     | 
| 
       87 
     | 
    
         
            -
            rubygems_version: 3.5. 
     | 
| 
      
 87 
     | 
    
         
            +
            rubygems_version: 3.5.11
         
     | 
| 
       88 
88 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       89 
89 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       90 
90 
     | 
    
         
             
            summary: Tool to test Elasticsearch clients against the YAML clients test suite.
         
     |