elasticsearch-test-runner 0.2.0 โ†’ 0.3.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: e0db95fdc124cceab0a7c1ef1de55d383a1f8025c25e12f05de3b0a3ff5bf49e
4
- data.tar.gz: 3a6763721958e62945c886386aa8ebd65993522f71b29486a8911d2c0f02e520
3
+ metadata.gz: 736ee5a6506aad22d554ba00880706b6641192297e69c42a815050e4e6d784fd
4
+ data.tar.gz: 2faea7eacfc8c421675cbae4783fcce40866daf380a8d5fd417b297cd9de7e51
5
5
  SHA512:
6
- metadata.gz: f5973e272d04b24f36e5201c0f3329bea7f5dd7c5be86d89cfb08c6f3cd717c4ce623065e7aa9456cdf9b26480a44ff4b763df2e783d16d2c14d3335d8164c6a
7
- data.tar.gz: beb4c948667c664376306d77fe49e53467b99ca1d38a15c08dcde06abded7fb63005fb5d3a00017e3e46f19cc87338284150dfcde5ec8caa701912dedc6dea76
6
+ metadata.gz: '0529c7247fe886df1ac6f99f95b45f2fd576dce42bcc80e01d032d57e3adda91f0556da62000201fa447fe7895b7799844c4479077f7136df382bcabb69f5ab8'
7
+ data.tar.gz: 90f5be281f003fb63ad11bb1180d47d5b3d50ab3db4914ff7652e2eb89cbfc828a78f2118ebf665e60e688f0e065011154b3bf7c4703b562d9f7a3f3256cc3e1
data/CHANGELOG.md CHANGED
@@ -1,9 +1,14 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.3.0] - 2024-06-27
4
+
5
+ - Fixes exit code.
6
+ - Refactors error handling for more detailed information.
7
+
3
8
  ## [0.2.0] - 2024-06-25
4
9
 
5
- - Renames gemspec from elasticsearch-tests to elasticsearch-test-runner
6
- - Adds ability to run individual test files or directories
10
+ - Renames gemspec from elasticsearch-tests to elasticsearch-test-runner.
11
+ - Adds ability to run individual test files or directories.
7
12
 
8
13
  ## [0.1.1] - 2024-06-20
9
14
 
@@ -19,5 +19,16 @@ module Elasticsearch
19
19
  module Tests
20
20
  class TestFailure < StandardError; end
21
21
  class TestError < StandardError; end
22
+
23
+ # Class to track exactly which action errored
24
+ class ActionError < StandardError
25
+ attr_reader :test_file, :action
26
+
27
+ def initialize(message, test_file, action)
28
+ super(message)
29
+ @test_file = test_file
30
+ @action = action
31
+ end
32
+ end
22
33
  end
23
34
  end
@@ -40,7 +40,7 @@ module Elasticsearch
40
40
  else
41
41
  pp response
42
42
  end
43
- raise Elasticsearch::Tests::TestFailure
43
+ raise Elasticsearch::Tests::ActionError.new('ERROR', @file, action)
44
44
  end
45
45
 
46
46
  def print_match_failure(action)
@@ -65,7 +65,9 @@ module Elasticsearch
65
65
  def self.display_errors(errors)
66
66
  puts "+++ โŒ Errors/Failures: #{errors.count}"
67
67
  errors.map do |error|
68
- puts "* Test: #{error[:file]}\n #{error[:error].message}"
68
+ puts "๐Ÿงช Test: #{error[:file]}"
69
+ puts "โ–ถ Action: #{error[:action]['do']}" if error[:action]
70
+ puts "๐Ÿ”ฌ #{error[:error].message}"
69
71
  pp error[:error].backtrace.join("$/\n") if ENV['DEBUG']
70
72
  puts
71
73
  end
@@ -16,6 +16,7 @@
16
16
  # under the License.
17
17
 
18
18
  require_relative 'code_runner'
19
+ require_relative 'errors'
19
20
 
20
21
  module Elasticsearch
21
22
  module Tests
@@ -70,6 +71,8 @@ module Elasticsearch
70
71
  when 'gt', 'gte', 'lt', 'lte'
71
72
  compare(action)
72
73
  end
74
+ rescue StandardError => e
75
+ raise ActionError.new(e.message, @file, action)
73
76
  end
74
77
 
75
78
  def run_setup
@@ -41,6 +41,11 @@ module Elasticsearch
41
41
  run_the_tests
42
42
  Elasticsearch::Tests::Printer::display_errors(@errors) unless @errors.empty?
43
43
  Elasticsearch::Tests::Printer::display_summary(@tests_count, @errors.count, @start_time)
44
+ if @errors.empty?
45
+ exit 0
46
+ else
47
+ exit 1
48
+ end
44
49
  end
45
50
 
46
51
  def run_the_tests
@@ -54,6 +59,9 @@ module Elasticsearch
54
59
  @errors << { error: e, file: test_file }
55
60
  @logger.warn("YAML error in #{test_file}")
56
61
  @logger.warn e
62
+ rescue ActionError => e
63
+ @errors << { error: e, file: test_file, action: e.action }
64
+ @logger.debug e
57
65
  rescue StandardError => e
58
66
  @errors << { error: e, file: test_file }
59
67
  @logger.debug e
@@ -19,6 +19,6 @@
19
19
 
20
20
  module Elasticsearch
21
21
  module Tests
22
- VERSION = '0.2.0'
22
+ VERSION = '0.3.0'
23
23
  end
24
24
  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.2.0
4
+ version: 0.3.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-06-25 00:00:00.000000000 Z
11
+ date: 2024-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: elasticsearch