elasticsearch-test-runner 0.9.0 → 0.10.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: 7452d0963f9177b56e8dbfdbe0ee2d779e4e733ecff9f21be71263611b8bfe4a
4
- data.tar.gz: 72100349de35737ec78f2b6617b68fb9beef9a64d3ee59b3be06bfebd30cefd2
3
+ metadata.gz: 74628e9c64f4c668f6e4ef87c94afa47ee6539b22ab3a28ce4fd25e8ae69d457
4
+ data.tar.gz: e9fc240ffa3a200f1e3cb257ba73b297145117a75c19c38e4a7194695e3e5ddb
5
5
  SHA512:
6
- metadata.gz: e2709d1814074c2b29ffb9ba9066a1003ea3f074aaa13f1ceac0534c41b5b97e37e87ee42ea4525f320bf0f5e1dcafc0a55197c70afb312fad61f3c5c2d93f74
7
- data.tar.gz: b2c440af0a742182c36b1c53aae1db3adc2b52ce0930ab88383c62203c9358f2589e34265bcb0180da4db4179096f0780d4775aa5ddbbb5f3f90a36fdf862631
6
+ metadata.gz: 27b6f144c51341b040891a80a23353b328f1378a3ba33503e3dfbe6f6cf86dc501f45717fb4af9a3b7dd72fe8fa21eae2c5ce91d7e4764a7a877e3fd48ef0590
7
+ data.tar.gz: e94c3308a4733421362d13af89915db5b010ec72d76218ccd7d8efa25a3bf1c8f9e0ea1a19b0e798ba44655b7e8a2df2feab8cc7642c4d97ed1f8aeb353901ff
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.10.0] - 2024-11-13
4
+
5
+ - Using tar.gz file for downloaded tests instead of zip file.
6
+ - Updates logging and debug information. More information being logged for different levels of Logger.
7
+
3
8
  ## [0.9.0] - 2024-08-15
4
9
 
5
10
  - Better display of action and response when `ENV['DEBUG']` is true.
@@ -57,7 +57,11 @@ module Elasticsearch
57
57
  puts "Action: #{action}\nResponse: #{@response}\n\n" if ENV['DEBUG']
58
58
  @response
59
59
  rescue StandardError => e
60
- raise e unless expected_exception?(catchable, e)
60
+ if expected_exception?(catchable, e)
61
+ puts "Catchable: #{e}\nResponse: #{@response}\n" if ENV['DEBUG']
62
+ else
63
+ raise e
64
+ end
61
65
  end
62
66
 
63
67
  def expected_exception?(error_type, e)
@@ -22,18 +22,18 @@ module Elasticsearch
22
22
  # Module for downloading the test files
23
23
  module Downloader
24
24
  class << self
25
- FILENAME = 'tests.zip'.freeze
25
+ FILENAME = 'tests.tar.gz'.freeze
26
26
 
27
27
  def run(path, branch = 'main')
28
28
  delete_files(path)
29
- url = "https://api.github.com/repos/elastic/serverless-clients-tests/zipball/#{branch}"
29
+ url = "https://api.github.com/repos/elastic/serverless-clients-tests/tarball/#{branch}"
30
30
  if download_tests(url)
31
31
  puts "Successfully downloaded #{FILENAME}"
32
32
  else
33
33
  warn "[!] Couldn't download #{FILENAME}"
34
34
  return
35
35
  end
36
- unzip_file(path)
36
+ untar_file(path)
37
37
  File.delete(FILENAME)
38
38
  end
39
39
 
@@ -49,11 +49,11 @@ module Elasticsearch
49
49
 
50
50
  private
51
51
 
52
- def unzip_file(path)
53
- puts 'Unzipping files'
52
+ def untar_file(path)
53
+ puts 'Extracting tar files'
54
54
  puts path
55
- `unzip #{FILENAME} -d #{path}/`
56
- puts 'Removing zip file'
55
+ `tar -zxf #{FILENAME} --strip-components=1 -C #{path}/`
56
+ puts 'Removing tar file'
57
57
  end
58
58
 
59
59
  def delete_files(path)
@@ -70,21 +70,28 @@ module Elasticsearch
70
70
  raise error
71
71
  end
72
72
 
73
- def self.display_errors(errors)
73
+ def self.display_errors(errors, logger)
74
74
  puts "+++ ❌ Errors/Failures: #{errors.count}"
75
75
  errors.map do |error|
76
- puts "🧪 Test: #{error[:file]}"
77
- puts " Action: #{error[:action].first}" if error[:action]
78
- puts "🔬 #{error.class} - #{error[:error].message}"
79
- pp error[:error].backtrace.join("$/\n") if ENV['DEBUG']
80
- puts
76
+ message = []
77
+ message << "🧪 Test: #{error[:file]}"
78
+ message << " Action: #{error[:action].first}" if error[:action]
79
+ message << "🔬 #{error.class} - #{error[:error].message}"
80
+ message << error[:error].backtrace.join("$/\n") if ENV['DEBUG']
81
+ puts message.join("\n")
82
+ logger.error(message.join("\n"))
81
83
  end
82
84
  end
83
85
 
84
- def self.display_summary(tests_count, errors_count, start_time)
86
+ def self.display_summary(tests_count, errors_count, start_time, logger)
85
87
  puts
86
- puts "--- 🧪 Tests: #{tests_count} | Passed: #{tests_count - errors_count} | Failed: #{errors_count}"
87
- puts "--- ⏲ Elapsed time: #{Time.at(Time.now - start_time).utc.strftime("%H:%M:%S")}"
88
+ summary = "🧪 Tests: #{tests_count} | Passed: #{tests_count - errors_count} | Failed: #{errors_count}"
89
+ logger.info summary
90
+ puts "--- #{summary}"
91
+
92
+ duration = "⏲ Elapsed time: #{Time.at(Time.now - start_time).utc.strftime('%H:%M:%S')}"
93
+ logger.info duration
94
+ puts "--- #{duration}"
88
95
  end
89
96
  end
90
97
  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 = Logger::WARN unless ENV['DEBUG']
28
+ LOGGER.level = ENV['DEBUG'] ? Logger::DEBUG : Logger::WARN
29
29
 
30
30
  def initialize(client, path = nil, logger = nil)
31
31
  @client = client
@@ -39,8 +39,8 @@ module Elasticsearch
39
39
 
40
40
  @test_files = select_test_files(test_files)
41
41
  run_the_tests
42
- Elasticsearch::Tests::Printer::display_errors(@errors) unless @errors.empty?
43
- Elasticsearch::Tests::Printer::display_summary(@tests_count, @errors.count, @start_time)
42
+ Elasticsearch::Tests::Printer::display_errors(@errors, @logger) unless @errors.empty?
43
+ Elasticsearch::Tests::Printer::display_summary(@tests_count, @errors.count, @start_time, @logger)
44
44
  if @errors.empty?
45
45
  exit 0
46
46
  else
@@ -93,7 +93,7 @@ module Elasticsearch
93
93
  tests_path = if test_files.empty?
94
94
  "#{@path}/**/*.yml"
95
95
  elsif test_files.include?('yml')
96
- "#{@path}/#{test_files}"
96
+ return ["#{@path}/tests/#{test_files}"]
97
97
  else
98
98
  "#{@path}/#{test_files}/*.yml"
99
99
  end
@@ -19,6 +19,6 @@
19
19
 
20
20
  module Elasticsearch
21
21
  module Tests
22
- VERSION = '0.9.0'
22
+ VERSION = '0.10.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.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic Client Library Maintainers
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-15 00:00:00.000000000 Z
11
+ date: 2024-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: elasticsearch
@@ -69,7 +69,7 @@ metadata:
69
69
  homepage_uri: https://www.elastic.co/guide/en/elasticsearch/client/ruby-api/current/index.html
70
70
  changelog_uri: https://github.com/elastic/es-test-runner-ruby/blob/main/CHANGELOG.md
71
71
  source_code_uri: https://github.com/elastic/es-test-runner-ruby/tree/main
72
- post_install_message:
72
+ post_install_message:
73
73
  rdoc_options: []
74
74
  require_paths:
75
75
  - lib
@@ -84,8 +84,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
84
  - !ruby/object:Gem::Version
85
85
  version: '0'
86
86
  requirements: []
87
- rubygems_version: 3.5.11
88
- signing_key:
87
+ rubygems_version: 3.5.20
88
+ signing_key:
89
89
  specification_version: 4
90
90
  summary: Tool to test Elasticsearch clients against the YAML clients test suite.
91
91
  test_files: []