elasticsearch-test-runner 0.16.0 → 0.17.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 +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +1 -1
- data/lib/elasticsearch/tests/code_runner.rb +6 -2
- data/lib/elasticsearch/tests/printer.rb +6 -2
- data/lib/elasticsearch/tests/test.rb +1 -1
- data/lib/elasticsearch/tests/test_runner.rb +1 -1
- data/lib/elasticsearch/tests/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ce6c6e7adcbf6ba2d8f592f776d51bb1903b8ae2da6591981413fda1e44ce6e7
|
|
4
|
+
data.tar.gz: e3d92c1626835a8c5eec26b85b1050c35b02e62c9f9e5e30abd64add7c0afe45
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: be441d1a5d468c450cd282f650134f4bd333d91b4c1bd373affb73c0f451283b0fe2a92f6e91cd9688e8b26e5e698edcd319b0c7c7759bb5ddb5e1ad3e0e1237
|
|
7
|
+
data.tar.gz: 24850372db7b732513f58005e838044a8e637890b220fcd5a1f363beacff1bafe8747f5bf8af6c92ba9a388b85fabf815682b6ea025ff8acf9508b91a9a5e198
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.17.0] - 2026-03-04
|
|
4
|
+
|
|
5
|
+
- Better debugging detection, check for `ENV['DEBUG']` to be equal to `true`, not just if it's set.
|
|
6
|
+
|
|
7
|
+
## [0.16.1] - 2026-02-26
|
|
8
|
+
|
|
9
|
+
- Updates debug display message for String response bodies.
|
|
10
|
+
|
|
3
11
|
## [0.16.0] - 2026-02-25
|
|
4
12
|
|
|
5
13
|
- Lets Ruby handle successful exit code at the end of the test run, only uses `exit 1` if there are errors.
|
data/README.md
CHANGED
|
@@ -36,7 +36,7 @@ You can optionally pass in an object that implements Ruby's Logger to the `TestR
|
|
|
36
36
|
|
|
37
37
|
```ruby
|
|
38
38
|
logger = Logger.new($stdout)
|
|
39
|
-
logger.level = Logger::WARN unless ENV['DEBUG']
|
|
39
|
+
logger.level = Logger::WARN unless ENV['DEBUG'] == 'true'
|
|
40
40
|
|
|
41
41
|
runner = Elasticsearch::Tests::TestRunner.new(client, tests_path, logger)
|
|
42
42
|
runner.run
|
|
@@ -57,12 +57,12 @@ module Elasticsearch
|
|
|
57
57
|
end
|
|
58
58
|
params = process_params(params)
|
|
59
59
|
@response = client.send(method.to_sym, params)
|
|
60
|
-
print_debug_message(method.to_sym, params) if
|
|
60
|
+
print_debug_message(method.to_sym, params) if debug?
|
|
61
61
|
@response
|
|
62
62
|
rescue StandardError => e
|
|
63
63
|
raise e unless expected_exception?(catchable, e)
|
|
64
64
|
|
|
65
|
-
puts "Catchable: #{e}\nResponse: #{@response}\n" if
|
|
65
|
+
puts "Catchable: #{e}\nResponse: #{@response}\n" if debug?
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
def expected_exception?(error_type, e)
|
|
@@ -183,6 +183,10 @@ module Elasticsearch
|
|
|
183
183
|
|
|
184
184
|
private
|
|
185
185
|
|
|
186
|
+
def debug?
|
|
187
|
+
ENV['DEBUG'] == 'true'
|
|
188
|
+
end
|
|
189
|
+
|
|
186
190
|
# Given a key coming from a test definition, search the response body for a matching value.
|
|
187
191
|
#
|
|
188
192
|
def search_in_response(keys)
|
|
@@ -85,7 +85,7 @@ module Elasticsearch
|
|
|
85
85
|
message << "🧪 Test: #{error[:file]}"
|
|
86
86
|
message << "▶ Action: #{error[:action].first}" if error[:action]
|
|
87
87
|
message << "🔬 #{error.class} - #{error[:error].message}"
|
|
88
|
-
message << error[:error].backtrace.join("$/\n") if ENV['DEBUG']
|
|
88
|
+
message << error[:error].backtrace.join("$/\n") if ENV['DEBUG'] == 'true'
|
|
89
89
|
print TTY::Box.frame(message.join("\n"), width: BOX_WIDTH, style: { border: { fg: :red } })
|
|
90
90
|
logger.error(message.join("\n"))
|
|
91
91
|
end
|
|
@@ -115,7 +115,11 @@ module Elasticsearch
|
|
|
115
115
|
else
|
|
116
116
|
message << "Response status: #{@response.status}"
|
|
117
117
|
message << 'Response body:'
|
|
118
|
-
|
|
118
|
+
if @response.body.is_a?(String)
|
|
119
|
+
message.push(@response.body.empty? ? ' ""' : @response.body)
|
|
120
|
+
elsif @response.body.is_a?(Hash)
|
|
121
|
+
message.push(*@response.body.map { |k, v| " #{k}: #{v}" })
|
|
122
|
+
end
|
|
119
123
|
message << 'Response headers:'
|
|
120
124
|
message.push(*@response.headers.map { |k, v| " #{k}: #{v}" })
|
|
121
125
|
end
|
|
@@ -25,7 +25,7 @@ module Elasticsearch
|
|
|
25
25
|
# Main YAML test runner
|
|
26
26
|
class TestRunner
|
|
27
27
|
LOGGER = Logger.new($stdout)
|
|
28
|
-
LOGGER.level = ENV['DEBUG'] ? Logger::DEBUG : Logger::WARN
|
|
28
|
+
LOGGER.level = ENV['DEBUG'] == 'true' ? Logger::DEBUG : Logger::WARN
|
|
29
29
|
|
|
30
30
|
def initialize(client, path = nil, logger = nil)
|
|
31
31
|
@client = client
|