elasticsearch-test-runner 0.10.1 → 0.12.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: bde01ffcc7b5491ae480bae5b2e56266ac260e2f8b2ac2b59398198b322a6878
4
- data.tar.gz: c1d71ed1c9cf48fb385523432708079257b9125a851b001167e2730a65e9287e
3
+ metadata.gz: aa516016a59871aaa1b443d42c4889d3e5b02ae157562c6086c13fbadb0d492d
4
+ data.tar.gz: 802d0d4f3806bdf979ec8e5c7a8fe90a5951622920ed917e4efe83a33d6a6b56
5
5
  SHA512:
6
- metadata.gz: 8f196cf82543f702eab710a0c45e6a1b8cc8fa3924d15c88962aeebb29a078b39bdb3f4f5cc740a8d3908c24a093cc08baa7abec2f262738470fc2678dcf66c6
7
- data.tar.gz: 4ccc45276182e019c918d2f3400f9c459cfd8f886e20d781120489ae643048c7ae080b93c007d4afd13a96f94c163d98cb8cb1bbb5590cd6d226d2a8f1ff7e20
6
+ metadata.gz: 1614a894297a381fbb1e45a254d61b31ba42dd7a8fef54179d78866c336196b35445e5b737253b7efb226f98d1015853409c9550cd65ec966605c5ee6e980a6b
7
+ data.tar.gz: e28f157416ab9baac80b33b4c9584da23d333dcecbfef64191e76437b44d9ea3615be13b4006746c9fca8fa64f645ddcfaa8eb9e82b2c0736f17e0557a5fe3a3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.12.0] - 2025-01-14
4
+
5
+ - Check TEST_SUITE variable for `serverless`.
6
+
7
+ ## [0.11.0] - 2024-12-12
8
+
9
+ - Adds skipping tests.
10
+
3
11
  ## [0.10.1] - 2024-11-13
4
12
 
5
13
  - Creates directory for tests if it doesn't exist.
data/README.md CHANGED
@@ -29,6 +29,9 @@ Elasticsearch::Tests::TestRunner.new(client, tests_path).run
29
29
 
30
30
  [The tests](https://github.com/elastic/elasticsearch-clients-tests) are designed for the Elasticsearch REST API and the Elasticsearch Serverless REST API. If you pass in an `ElasticsearchServerless::Client`, it will only run the tests that have the `requires.serverless: true` statement. Otherwise, it will only run the ones with `requires.stack: true`.
31
31
 
32
+
33
+ ### Logging
34
+
32
35
  You can optionally pass in an object that implements Ruby's Logger to the `TestRunner` initializer. This will log more information, particularly useful in the case of errors where it'll log stacktraces for exceptions and more:
33
36
 
34
37
  ```ruby
@@ -39,6 +42,8 @@ runner = Elasticsearch::Tests::TestRunner.new(client, tests_path, logger)
39
42
  runner.run
40
43
  ```
41
44
 
45
+ ### Running particular tests
46
+
42
47
  When you run the tests, you can pass in the name of a particular test or a whole test folder, to run only those tests. Tests in the clients project are located [in the `tests` directory](https://github.com/elastic/elasticsearch-clients-tests/tree/main/tests) either as single yaml files or inside a specific directory, referring to a specific namespace. For example [`tests/get.yml`](https://github.com/elastic/elasticsearch-clients-tests/blob/main/tests/get.yml) and [`tests/bulk/10_basic.yml`](https://github.com/elastic/elasticsearch-clients-tests/blob/main/tests/bulk/10_basic.yml). If you want to run the `get.yml` test, you can pass in the file name to `run`:
43
48
 
44
49
  ```ruby
@@ -59,6 +64,18 @@ runner.run('indices')
59
64
 
60
65
  This will run all the tests in [`tests/indices`](https://github.com/elastic/elasticsearch-clients-tests/tree/main/tests/indices) such as `alias.yml`, `analyze.yml`, and so on.
61
66
 
67
+ ### Skipping tests
68
+
69
+ If you want to skip any given tests, you can do it using `add_tests_to_skip` before calling `run` like this:
70
+
71
+ ```ruby
72
+ runner.add_tests_to_skip(['bulk/10_basic.yml', 'get.yml'])
73
+ ```
74
+
75
+ You need to pass in an Array of file or folder names, or a single test file as a String.
76
+
77
+ ### Downloading the test suite
78
+
62
79
  You can **download the YAML test files** from [the clients tests project](https://github.com/elastic/elasticsearch-clients-tests) with the following code:
63
80
 
64
81
  ```ruby
@@ -29,9 +29,19 @@ module Elasticsearch
29
29
 
30
30
  def initialize(client, path = nil, logger = nil)
31
31
  @client = client
32
- @serverless = defined?(::ElasticsearchServerless) && client.is_a?(::ElasticsearchServerless::Client)
32
+ @serverless = defined?(::ElasticsearchServerless) && client.is_a?(::ElasticsearchServerless::Client) ||
33
+ ENV['TEST_SUITE'] == 'serverless'
33
34
  @path = path || File.expand_path('./tmp', __dir__)
34
35
  @logger = logger || LOGGER
36
+ @tests_to_skip = []
37
+ end
38
+
39
+ def add_tests_to_skip(tests)
40
+ if tests.is_a? String
41
+ @tests_to_skip << tests
42
+ else
43
+ @tests_to_skip.merge!(tests)
44
+ end
35
45
  end
36
46
 
37
47
  def run(test_files = [])
@@ -97,7 +107,13 @@ module Elasticsearch
97
107
  else
98
108
  "#{@path}/#{test_files}/*.yml"
99
109
  end
100
- Dir.glob(tests_path)
110
+ tests = Dir.glob(tests_path)
111
+ tests.each do |test|
112
+ @tests_to_skip.each do |skip|
113
+ tests.delete(test) if test.match?(skip)
114
+ end
115
+ end
116
+ tests
101
117
  end
102
118
 
103
119
  def extract_requires!(yaml)
@@ -19,6 +19,6 @@
19
19
 
20
20
  module Elasticsearch
21
21
  module Tests
22
- VERSION = '0.10.1'
22
+ VERSION = '0.12.0'
23
23
  end
24
24
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch-test-runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic Client Library Maintainers
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-11-13 00:00:00.000000000 Z
10
+ date: 2025-01-14 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: elasticsearch
@@ -69,7 +68,6 @@ metadata:
69
68
  homepage_uri: https://www.elastic.co/guide/en/elasticsearch/client/ruby-api/current/index.html
70
69
  changelog_uri: https://github.com/elastic/es-test-runner-ruby/blob/main/CHANGELOG.md
71
70
  source_code_uri: https://github.com/elastic/es-test-runner-ruby/tree/main
72
- post_install_message:
73
71
  rdoc_options: []
74
72
  require_paths:
75
73
  - lib
@@ -84,8 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
82
  - !ruby/object:Gem::Version
85
83
  version: '0'
86
84
  requirements: []
87
- rubygems_version: 3.5.20
88
- signing_key:
85
+ rubygems_version: 3.6.2
89
86
  specification_version: 4
90
87
  summary: Tool to test Elasticsearch clients against the YAML clients test suite.
91
88
  test_files: []