elasticsearch-test-runner 0.18.2 β†’ 0.20.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: 6f353417226574d9f9f31aad08493921ff64ddc0442eb3b1c78ca810dd6d5f05
4
+ data.tar.gz: 8c665f93673ae59cefc2c621b37dd270acda75f1ce15e0ddacdf7b3ba8fdd0fd
5
5
  SHA512:
6
- metadata.gz: 55eb04dafbb6347cce1f1125fd90e35d2fed0db9549152f39a0e6b608160822aa6ea4c69ac41ed5e49f3e9a7dd9addd38c8a998409f6fc72ac2193046ad4b0ef
7
- data.tar.gz: c1c83a61546a0fcb49127b5bc5a98af5196a21ce61481445632f22b880525b46445fd4d0796fec54d125a03929d7f86e5f7e078b22dfb2bd8764d1cc54f1b4d0
6
+ metadata.gz: 51a23ebbdd4550e88083a38d9ae953a87cbc6555175f72e3cfb8798531e980772d6ff19d6aa075e52336355779e041dddfc87b713ddb8941816022e6d0a32340
7
+ data.tar.gz: a5dd823bd406475e67ddf632051d1102f981ad6b9813134d452c6eb3df8da1fec71fb0752d5ab9f24801754b00b1f57a7345fbbc7bc1c6ce1c0d2dedfca786a0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.20.0] - 2026-05-20
4
+
5
+ - Replaces variables in arrays, update for the latest tests update.
6
+
7
+ ## [0.19.0] - 2026-05-12
8
+
9
+ - Adds exception to print_failure if there is one.
10
+ - Better formatting when printing match failures.
11
+ - Raise error if the requires section is missing from a test.
12
+
3
13
  ## [0.18.2] - 2026-03-06
4
14
 
5
15
  - 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:
@@ -109,7 +109,16 @@ module Elasticsearch
109
109
  #
110
110
  def do_match(action)
111
111
  k, v = action['match'].first
112
- v = instance_variable_get(v.gsub('$', '@')) if v.is_a?(String) && v.include?('$')
112
+
113
+ v = if v.is_a?(String) && v.include?('$')
114
+ instance_variable_get(v.gsub('$', '@'))
115
+ elsif v.is_a?(Array)
116
+ v.map do |a|
117
+ a.is_a?(String) && a.start_with?('$') ? instance_variable_get(a.gsub('$', '@')) : a
118
+ end
119
+ else
120
+ v
121
+ end
113
122
  result = search_in_response(k)
114
123
 
115
124
  if !result.nil? && (
@@ -236,9 +245,9 @@ module Elasticsearch
236
245
  return unless param.is_a?(String) && param.include?('$')
237
246
 
238
247
  # Param can be a single '$value' string or '{ something: $value }'
239
- repleacable = param.match(/(\$[0-9a-z_-]+)/)[0]
240
- value = instance_variable_get(repleacable.gsub('$', '@'))
241
- content = param.gsub(repleacable, value)
248
+ replaceable = param.match(/(\$[0-9a-z_-]+)/)[0]
249
+ value = instance_variable_get(replaceable.gsub('$', '@'))
250
+ content = param.gsub(replaceable, value)
242
251
  params[key] = content
243
252
  end
244
253
 
@@ -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.20.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.20.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.10
141
141
  specification_version: 4
142
142
  summary: Tool to test Elasticsearch clients against the YAML clients test suite.
143
143
  test_files: []