elasticsearch-test-runner 0.18.2 β†’ 0.19.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: 7b2a29eb379b8bc1f6d31d93add7befd179122d2dc08d19312b7cda9ebc36d95
4
- data.tar.gz: 47989e967e79cc64a901d8d2e3a8e2b206134c20b48c532040cc6f79cd4586fb
3
+ metadata.gz: 76d8a85b1a7cf721007f537c842cb45939081382b7789eb2a9ceb8390561b252
4
+ data.tar.gz: 3969ab39997854e6cbb64abb169e4fd195ddb1ab2eb85e5fe4d3a0deecea2b79
5
5
  SHA512:
6
- metadata.gz: 55eb04dafbb6347cce1f1125fd90e35d2fed0db9549152f39a0e6b608160822aa6ea4c69ac41ed5e49f3e9a7dd9addd38c8a998409f6fc72ac2193046ad4b0ef
7
- data.tar.gz: c1c83a61546a0fcb49127b5bc5a98af5196a21ce61481445632f22b880525b46445fd4d0796fec54d125a03929d7f86e5f7e078b22dfb2bd8764d1cc54f1b4d0
6
+ metadata.gz: 007e1d0ace05b315eb0b1f7b45e1ade975f0d37383f91f5ef5c8a2d12cf1831a8db6c938d74aa4c724a3495dbed6b764551e733c3797cf6f92d29a9568017324
7
+ data.tar.gz: 1752221ae3f4c22ce94f09c4211cc08e88b27c76a40e34acbf738e0d0def604f51a1b381fe236f533b9d5952ef749e0b0d85e92067bdf97dc45503a6c47e7035
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.19.0] - 2026-05-12
4
+
5
+ - Adds exception to print_failure if there is one.
6
+ - Better formatting when printing match failures.
7
+ - Raise error if the requires section is missing from a test.
8
+
3
9
  ## [0.18.2] - 2026-03-06
4
10
 
5
11
  - Fixes skipping multiple tests.
data/README.md CHANGED
@@ -85,6 +85,40 @@ Elasticsearch::Tests::Downloader::run(tests_path)
85
85
 
86
86
  Additionally, you can run the rake task `rake es_tests:download` included in `lib/elasticsearch/tasks`.
87
87
 
88
+ ### Environment variables
89
+
90
+ You can set the following environment variables when using the test runner:
91
+
92
+ #### `DEBUG`
93
+
94
+ If you set `DEBUG` to `true`, you'll see debug messages for each tests, including the response status, body and headers sent from Elasticsearch:
95
+
96
+ ```
97
+ 🟒 cluster/put_settings.yml - is_true: acknowledged passed [200]
98
+ β”Œ[DEBUG]──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
99
+ β”‚File: cluster/remote_info.yml | Action: remote_info β”‚
100
+ β”‚Parameters: {} β”‚
101
+ β”‚ β”‚
102
+ β”‚Response status: 200 β”‚
103
+ β”‚Response body: β”‚
104
+ β”‚Response headers: β”‚
105
+ β”‚ x-elastic-product: Elasticsearch β”‚
106
+ β”‚ content-type: application/vnd.elasticsearch+json;compatible-with=9 β”‚
107
+ β”‚ content-length: 2 β”‚
108
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
109
+ ```
110
+
111
+ #### `QUIET`
112
+
113
+ If you set `QUIET` to anything other than `false` or the String `"false"`, tests will run in quiet mode, where you'll only see the green (success) and/or red (failure) output for the tests:
114
+
115
+ ```
116
+ $ QUIET=1 be rake test:yaml
117
+ 🟒 🟒 🟒 🟒 🟒 πŸ”΄ 🟒 🟒 🟒 🟒 🟒 🟒 🟒 🟒 🟒 🟒 🟒 🟒 🟒 🟒 🟒 🟒 🟒 🟒 🟒 🟒 🟒 🟒 🟒 🟒 🟒 🟒 🟒 🟒 🟒
118
+ ```
119
+
120
+ It will still print out the summary and information about failures and/or errors at the bottom.
121
+
88
122
  ## Development
89
123
 
90
124
  See [CONTRIBUTING](./CONTRIBUTING.md).
@@ -62,7 +62,7 @@ module Elasticsearch
62
62
  rescue StandardError => e
63
63
  # Raise if it's an actual error:
64
64
  unless expected_exception?(catchable, e)
65
- print_failure(action, @response)
65
+ print_failure(action, @response, e)
66
66
  raise e
67
67
  end
68
68
  # Show success if we caught an expected exception:
@@ -44,7 +44,7 @@ module Elasticsearch
44
44
  !ENV['QUIET'].nil? && ![false, 'false'].include?(ENV['QUIET'])
45
45
  end
46
46
 
47
- def print_failure(action, response)
47
+ def print_failure(action, response, exception = nil)
48
48
  if quiet?
49
49
  print 'πŸ”΄ '
50
50
  else
@@ -56,6 +56,7 @@ module Elasticsearch
56
56
  else
57
57
  message << response
58
58
  end
59
+ message << "Exception: #{exception}" if exception
59
60
  end
60
61
 
61
62
  def print_match_failure(action)
@@ -69,9 +70,9 @@ module Elasticsearch
69
70
  end
70
71
  message = <<~MSG
71
72
  #{@short_name} #{@title} failed
72
- Expected: { #{keys}: #{value} }
73
- Actual : { #{keys}: #{search_in_response(action['match'].keys.first)} }
74
- Response: #{@response}
73
+ \e[31m\e[1mExpected: { #{keys}: #{value} }\e[0m
74
+ \e[32m\e[1mGot : { #{keys}: #{search_in_response(action['match'].keys.first)} }\e[0m
75
+ \e[1mResponse\e[0m:\n\e[36m #{@response}\e[0m
75
76
  MSG
76
77
  raise Elasticsearch::Tests::TestFailure.new(message)
77
78
  end
@@ -79,7 +79,11 @@ module Elasticsearch
79
79
 
80
80
  def build_and_run_tests(test_path)
81
81
  yaml = YAML.load_stream(File.read(test_path))
82
- requires = extract_requires!(yaml).compact.first['requires']
82
+ begin
83
+ requires = extract_requires!(yaml).compact.first['requires']
84
+ rescue StandardError => e
85
+ raise ArgumentError, "Could not find requires key in test file:\n #{test_path}\n#{e}"
86
+ end
83
87
  return unless (requires['serverless'] == true && @serverless) ||
84
88
  (requires['stack'] == true && !@serverless)
85
89
 
@@ -19,6 +19,6 @@
19
19
 
20
20
  module Elasticsearch
21
21
  module Tests
22
- VERSION = '0.18.2'
22
+ VERSION = '0.19.0'
23
23
  end
24
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch-test-runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.2
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic Client Library Maintainers
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  requirements: []
140
- rubygems_version: 4.0.3
140
+ rubygems_version: 4.0.6
141
141
  specification_version: 4
142
142
  summary: Tool to test Elasticsearch clients against the YAML clients test suite.
143
143
  test_files: []