elasticsearch-test-runner 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ee56a5237bb5f84f1736eadf3d0bc16368cccd7889bbaf2a5a9f39f4c252e821
4
- data.tar.gz: 102d52581d5663b0848d3b2a794b12c20bc11f195a79f2cb8ac57c94e1b818c5
3
+ metadata.gz: a279ed35dcdcebb3992365f237f70fd6c1c9d8ee49e71d622d74a76280832203
4
+ data.tar.gz: 3d7e8fd20126eda08aa0e452d4dd2806a143a9fa1a227206c157e7b42090406b
5
5
  SHA512:
6
- metadata.gz: c0bdd05bd218933af4dc65c51917829bc68f07e312c959fbce1b0efbf6446444af48fd1ae72620a98cd9ce8836a5454807a988f007de0ccd7201a13f3868de9e
7
- data.tar.gz: 1cfb660fe7e81c143e42e6aaf886b4f2b3d5f33dbee48a78234f27518725bfacf52af1ca5a27d6f65521de9a8139e18fbe6926c6fdc93c13fb54eaebd182009a
6
+ metadata.gz: af99ab6771f0dd2b94d600ef119c420e8a43ac06a7e06d5dc4414e31bb9ee96377689a52a98652db8069bd9a5181b892c11c973e186e868d44b020445d604175
7
+ data.tar.gz: dd69419f48f9f895e9d9d2646e210f0746a5696d29f4695c3066988106590fa493dd89e98e57022be38c5e110a4c12b05e62e3eb582f2b1f2907842acc8923ab
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.7.0] - 2024-08-08
4
+
5
+ - Improves test (file) name display
6
+ - Updates QUIET environment variable check
7
+
3
8
  ## [0.6.0] - 2024-08-07
4
9
 
5
10
  - Adds `header` support, headers can be specified for an action.
@@ -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 "🟢 #{@file} #{@title} passed. Response: #{response}"
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 "🔴 #{@file} #{@title} failed"
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, @file, action)
49
+ raise Elasticsearch::Tests::ActionError.new(response.body, @short_name, action)
50
50
  end
51
51
 
52
52
  def print_match_failure(action)
@@ -54,7 +54,7 @@ module Elasticsearch
54
54
  value = action['match'].values.first
55
55
 
56
56
  message = <<~MSG
57
- 🔴 #{@file} #{@title} failed
57
+ 🔴 #{@short_name} #{@title} failed
58
58
  Expected: { #{keys}: #{value} }
59
59
  Actual : { #{keys}: #{search_in_response(action['match'].keys.first)} }
60
60
  Response: #{@response}
@@ -63,7 +63,7 @@ module Elasticsearch
63
63
  end
64
64
 
65
65
  def print_error(error)
66
- puts "❌ ERROR: #{@file} #{@title} failed\n"
66
+ puts "❌ ERROR: #{@short_name} #{@title} failed\n"
67
67
  logger.error error.display
68
68
  backtrace = error.backtrace.join("\n")
69
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 = test_filename(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 |test_file|
57
- build_and_run_tests(test_file)
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(test_file)
74
- yaml = YAML.load_stream(File.read(test_file))
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, test_file, @client)
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"
@@ -19,6 +19,6 @@
19
19
 
20
20
  module Elasticsearch
21
21
  module Tests
22
- VERSION = '0.6.0'
22
+ VERSION = '0.7.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.6.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-08-07 00:00:00.000000000 Z
11
+ date: 2024-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: elasticsearch