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 +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +17 -0
- data/lib/elasticsearch/tests/test_runner.rb +18 -2
- data/lib/elasticsearch/tests/version.rb +1 -1
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa516016a59871aaa1b443d42c4889d3e5b02ae157562c6086c13fbadb0d492d
|
4
|
+
data.tar.gz: 802d0d4f3806bdf979ec8e5c7a8fe90a5951622920ed917e4efe83a33d6a6b56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1614a894297a381fbb1e45a254d61b31ba42dd7a8fef54179d78866c336196b35445e5b737253b7efb226f98d1015853409c9550cd65ec966605c5ee6e980a6b
|
7
|
+
data.tar.gz: e28f157416ab9baac80b33b4c9584da23d333dcecbfef64191e76437b44d9ea3615be13b4006746c9fca8fa64f645ddcfaa8eb9e82b2c0736f17e0557a5fe3a3
|
data/CHANGELOG.md
CHANGED
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)
|
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.
|
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:
|
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.
|
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: []
|