elasticsearch-test-runner 0.9.0 → 0.10.1

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: 7452d0963f9177b56e8dbfdbe0ee2d779e4e733ecff9f21be71263611b8bfe4a
4
- data.tar.gz: 72100349de35737ec78f2b6617b68fb9beef9a64d3ee59b3be06bfebd30cefd2
3
+ metadata.gz: bde01ffcc7b5491ae480bae5b2e56266ac260e2f8b2ac2b59398198b322a6878
4
+ data.tar.gz: c1d71ed1c9cf48fb385523432708079257b9125a851b001167e2730a65e9287e
5
5
  SHA512:
6
- metadata.gz: e2709d1814074c2b29ffb9ba9066a1003ea3f074aaa13f1ceac0534c41b5b97e37e87ee42ea4525f320bf0f5e1dcafc0a55197c70afb312fad61f3c5c2d93f74
7
- data.tar.gz: b2c440af0a742182c36b1c53aae1db3adc2b52ce0930ab88383c62203c9358f2589e34265bcb0180da4db4179096f0780d4775aa5ddbbb5f3f90a36fdf862631
6
+ metadata.gz: 8f196cf82543f702eab710a0c45e6a1b8cc8fa3924d15c88962aeebb29a078b39bdb3f4f5cc740a8d3908c24a093cc08baa7abec2f262738470fc2678dcf66c6
7
+ data.tar.gz: 4ccc45276182e019c918d2f3400f9c459cfd8f886e20d781120489ae643048c7ae080b93c007d4afd13a96f94c163d98cb8cb1bbb5590cd6d226d2a8f1ff7e20
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.10.1] - 2024-11-13
4
+
5
+ - Creates directory for tests if it doesn't exist.
6
+
7
+ ## [0.10.0] - 2024-11-13
8
+
9
+ - Using tar.gz file for downloaded tests instead of zip file.
10
+ - Updates logging and debug information. More information being logged for different levels of Logger.
11
+
3
12
  ## [0.9.0] - 2024-08-15
4
13
 
5
14
  - 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,12 @@ 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
+ FileUtils.mkdir_p(path) unless File.directory?(path)
56
+ `tar -zxf #{FILENAME} --strip-components=1 -C #{path}/`
57
+ puts 'Removing tar file'
57
58
  end
58
59
 
59
60
  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.1'
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.1
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: []