elasticsearch-test-runner 0.10.1 → 0.11.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: '0271385db599d8551f6a83a8cc3c349fb9e9e419404e2a6551ad1a79a609530b'
4
+ data.tar.gz: d7c7a28831431f41c3b60b63fa6a0f56ce6683b87bbaabd7531414e3cd45e12b
5
5
  SHA512:
6
- metadata.gz: 8f196cf82543f702eab710a0c45e6a1b8cc8fa3924d15c88962aeebb29a078b39bdb3f4f5cc740a8d3908c24a093cc08baa7abec2f262738470fc2678dcf66c6
7
- data.tar.gz: 4ccc45276182e019c918d2f3400f9c459cfd8f886e20d781120489ae643048c7ae080b93c007d4afd13a96f94c163d98cb8cb1bbb5590cd6d226d2a8f1ff7e20
6
+ metadata.gz: bf8130ff5fd1161285c9f9c0bcecd545ea10e2c28788febf0e19ff180c3088eec9090b7dc73da0d7902f7c3cef88a0617aa24079ac737ec80e7733662606dfa7
7
+ data.tar.gz: 296a138149fb4c1fd8388dff6ab0ebcf492daf07650c5b2c5df865d7bf99227dc3b450097474a6c55be2bb511a6bb1e6cc38c93a3358a88a86d357855c880e8f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.11.0] - 2024-12-12
4
+
5
+ - Adds skipping tests.
6
+
3
7
  ## [0.10.1] - 2024-11-13
4
8
 
5
9
  - 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
@@ -32,6 +32,15 @@ module Elasticsearch
32
32
  @serverless = defined?(::ElasticsearchServerless) && client.is_a?(::ElasticsearchServerless::Client)
33
33
  @path = path || File.expand_path('./tmp', __dir__)
34
34
  @logger = logger || LOGGER
35
+ @tests_to_skip = []
36
+ end
37
+
38
+ def add_tests_to_skip(tests)
39
+ if tests.is_a? String
40
+ @tests_to_skip << tests
41
+ else
42
+ @tests_to_skip.merge!(tests)
43
+ end
35
44
  end
36
45
 
37
46
  def run(test_files = [])
@@ -97,7 +106,13 @@ module Elasticsearch
97
106
  else
98
107
  "#{@path}/#{test_files}/*.yml"
99
108
  end
100
- Dir.glob(tests_path)
109
+ tests = Dir.glob(tests_path)
110
+ tests.each do |test|
111
+ @tests_to_skip.each do |skip|
112
+ tests.delete(test) if test.match?(skip)
113
+ end
114
+ end
115
+ tests
101
116
  end
102
117
 
103
118
  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.11.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.10.1
4
+ version: 0.11.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-13 00:00:00.000000000 Z
11
+ date: 2024-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: elasticsearch