elasticsearch-test-runner 0.5.0 → 0.7.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: a279ed35dcdcebb3992365f237f70fd6c1c9d8ee49e71d622d74a76280832203
|
4
|
+
data.tar.gz: 3d7e8fd20126eda08aa0e452d4dd2806a143a9fa1a227206c157e7b42090406b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af99ab6771f0dd2b94d600ef119c420e8a43ac06a7e06d5dc4414e31bb9ee96377689a52a98652db8069bd9a5181b892c11c973e186e868d44b020445d604175
|
7
|
+
data.tar.gz: dd69419f48f9f895e9d9d2646e210f0746a5696d29f4695c3066988106590fa493dd89e98e57022be38c5e110a4c12b05e62e3eb582f2b1f2907842acc8923ab
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,14 @@
|
|
1
|
-
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## [0.7.0] - 2024-08-08
|
4
|
+
|
5
|
+
- Improves test (file) name display
|
6
|
+
- Updates QUIET environment variable check
|
7
|
+
|
8
|
+
## [0.6.0] - 2024-08-07
|
9
|
+
|
10
|
+
- Adds `header` support, headers can be specified for an action.
|
11
|
+
- Show response in errors.
|
2
12
|
|
3
13
|
## [0.5.0] - 2024-07-30
|
4
14
|
|
@@ -38,6 +38,12 @@ module Elasticsearch
|
|
38
38
|
@response = nil
|
39
39
|
catchable = action.delete('catch')
|
40
40
|
client = @client
|
41
|
+
if action['headers']
|
42
|
+
client.transport.options[:transport_options][:headers].merge(
|
43
|
+
{ headers: action.delete('headers') }
|
44
|
+
)
|
45
|
+
end
|
46
|
+
|
41
47
|
action = action.first if action.is_a?(Array)
|
42
48
|
method, params = action.is_a?(String) ? [action, {}] : action.first
|
43
49
|
|
@@ -28,15 +28,15 @@ module Elasticsearch
|
|
28
28
|
else
|
29
29
|
@response.status
|
30
30
|
end
|
31
|
-
if ENV['QUIET']
|
31
|
+
if ENV['QUIET'] == 'true'
|
32
32
|
print '🟢 '
|
33
33
|
else
|
34
|
-
puts "🟢 #{@
|
34
|
+
puts "🟢 #{@short_name} #{@title} passed. Response: #{response}"
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
def print_failure(action, response)
|
39
|
-
puts "🔴 #{@
|
39
|
+
puts "🔴 #{@short_name} #{@title} failed"
|
40
40
|
puts "Expected result: #{action}" # TODO: Show match/length differently
|
41
41
|
if defined?(ElasticsearchServerless) &&
|
42
42
|
response.is_a?(ElasticsearchServerless::API::Response) ||
|
@@ -46,7 +46,7 @@ module Elasticsearch
|
|
46
46
|
else
|
47
47
|
pp response
|
48
48
|
end
|
49
|
-
raise Elasticsearch::Tests::ActionError.new(response.body, @
|
49
|
+
raise Elasticsearch::Tests::ActionError.new(response.body, @short_name, action)
|
50
50
|
end
|
51
51
|
|
52
52
|
def print_match_failure(action)
|
@@ -54,15 +54,16 @@ module Elasticsearch
|
|
54
54
|
value = action['match'].values.first
|
55
55
|
|
56
56
|
message = <<~MSG
|
57
|
-
🔴 #{@
|
57
|
+
🔴 #{@short_name} #{@title} failed
|
58
58
|
Expected: { #{keys}: #{value} }
|
59
59
|
Actual : { #{keys}: #{search_in_response(action['match'].keys.first)} }
|
60
|
+
Response: #{@response}
|
60
61
|
MSG
|
61
62
|
raise Elasticsearch::Tests::TestFailure.new(message)
|
62
63
|
end
|
63
64
|
|
64
65
|
def print_error(error)
|
65
|
-
puts "❌ ERROR: #{@
|
66
|
+
puts "❌ ERROR: #{@short_name} #{@title} failed\n"
|
66
67
|
logger.error error.display
|
67
68
|
backtrace = error.backtrace.join("\n")
|
68
69
|
logger.error "#{backtrace}\n"
|
@@ -33,7 +33,9 @@ module Elasticsearch
|
|
33
33
|
@teardown = extract_teardown!(yaml)
|
34
34
|
@title = yaml.first.keys.first
|
35
35
|
@actions = yaml.first[@title]
|
36
|
-
@file =
|
36
|
+
@file = file
|
37
|
+
name = file.split('/')
|
38
|
+
@short_name = "#{name[-2]}/#{name[-1]}"
|
37
39
|
@client = client
|
38
40
|
end
|
39
41
|
|
@@ -93,11 +95,6 @@ module Elasticsearch
|
|
93
95
|
@actions.select { |a| a.keys.first == 'do' }.count
|
94
96
|
end
|
95
97
|
|
96
|
-
def test_filename(file)
|
97
|
-
name = file.split('/')
|
98
|
-
"#{name[-2]}/#{name[-1]}"
|
99
|
-
end
|
100
|
-
|
101
98
|
def extract_setup!(yaml)
|
102
99
|
yaml.map.with_index do |a, i|
|
103
100
|
yaml.delete_at(i) if a.keys.first == 'setup'
|
@@ -53,8 +53,9 @@ module Elasticsearch
|
|
53
53
|
@tests_count = 0
|
54
54
|
@errors = []
|
55
55
|
|
56
|
-
@test_files.map do |
|
57
|
-
|
56
|
+
@test_files.map do |test_path|
|
57
|
+
test_file = test_filename(test_path)
|
58
|
+
build_and_run_tests(test_path)
|
58
59
|
rescue Psych::SyntaxError => e
|
59
60
|
@errors << { error: e, file: test_file }
|
60
61
|
@logger.warn("YAML error in #{test_file}")
|
@@ -70,19 +71,24 @@ module Elasticsearch
|
|
70
71
|
end
|
71
72
|
end
|
72
73
|
|
73
|
-
def build_and_run_tests(
|
74
|
-
yaml = YAML.load_stream(File.read(
|
74
|
+
def build_and_run_tests(test_path)
|
75
|
+
yaml = YAML.load_stream(File.read(test_path))
|
75
76
|
requires = extract_requires!(yaml).compact.first['requires']
|
76
77
|
return unless (requires['serverless'] == true && @serverless) ||
|
77
78
|
(requires['stack'] == true && !@serverless)
|
78
79
|
|
79
|
-
test = Elasticsearch::Tests::Test.new(yaml,
|
80
|
+
test = Elasticsearch::Tests::Test.new(yaml, test_path, @client)
|
80
81
|
test.execute
|
81
82
|
@tests_count += test.count
|
82
83
|
rescue StandardError => e
|
83
84
|
raise e
|
84
85
|
end
|
85
86
|
|
87
|
+
def test_filename(file)
|
88
|
+
name = file.split('/')
|
89
|
+
"#{name[-2]}/#{name[-1]}"
|
90
|
+
end
|
91
|
+
|
86
92
|
def select_test_files(test_files)
|
87
93
|
tests_path = if test_files.empty?
|
88
94
|
"#{@path}/**/*.yml"
|
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.7.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-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: elasticsearch
|