elasticsearch-test-runner 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +17 -0
- data/lib/elasticsearch/tests/downloader.rb +1 -0
- data/lib/elasticsearch/tests/test_runner.rb +16 -1
- data/lib/elasticsearch/tests/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0271385db599d8551f6a83a8cc3c349fb9e9e419404e2a6551ad1a79a609530b'
|
4
|
+
data.tar.gz: d7c7a28831431f41c3b60b63fa6a0f56ce6683b87bbaabd7531414e3cd45e12b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf8130ff5fd1161285c9f9c0bcecd545ea10e2c28788febf0e19ff180c3088eec9090b7dc73da0d7902f7c3cef88a0617aa24079ac737ec80e7733662606dfa7
|
7
|
+
data.tar.gz: 296a138149fb4c1fd8388dff6ab0ebcf492daf07650c5b2c5df865d7bf99227dc3b450097474a6c55be2bb511a6bb1e6cc38c93a3358a88a86d357855c880e8f
|
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
|
@@ -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)
|
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.
|
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
|
+
date: 2024-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: elasticsearch
|