elasticsearch-test-runner 0.1.1 → 0.2.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 +5 -0
- data/README.md +22 -1
- data/lib/elasticsearch/tests/test_runner.rb +9 -8
- data/lib/elasticsearch/tests/version.rb +1 -1
- metadata +2 -3
- data/elasticsearch-tests.gemspec +0 -51
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0db95fdc124cceab0a7c1ef1de55d383a1f8025c25e12f05de3b0a3ff5bf49e
|
4
|
+
data.tar.gz: 3a6763721958e62945c886386aa8ebd65993522f71b29486a8911d2c0f02e520
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5973e272d04b24f36e5201c0f3329bea7f5dd7c5be86d89cfb08c6f3cd717c4ce623065e7aa9456cdf9b26480a44ff4b763df2e783d16d2c14d3335d8164c6a
|
7
|
+
data.tar.gz: beb4c948667c664376306d77fe49e53467b99ca1d38a15c08dcde06abded7fb63005fb5d3a00017e3e46f19cc87338284150dfcde5ec8caa701912dedc6dea76
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -35,9 +35,30 @@ You can optionally pass in an object that implements Ruby's Logger to the `TestR
|
|
35
35
|
logger = Logger.new($stdout)
|
36
36
|
logger.level = Logger::WARN unless ENV['DEBUG']
|
37
37
|
|
38
|
-
Elasticsearch::Tests::TestRunner.new(client, tests_path, logger)
|
38
|
+
runner = Elasticsearch::Tests::TestRunner.new(client, tests_path, logger)
|
39
|
+
runner.run
|
39
40
|
```
|
40
41
|
|
42
|
+
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
|
+
|
44
|
+
```ruby
|
45
|
+
runner.run('get.yml')
|
46
|
+
```
|
47
|
+
|
48
|
+
If you want to run the basic bulk tests, you can run:
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
runner.run('bulk/10_basic.yml')
|
52
|
+
```
|
53
|
+
|
54
|
+
If you want to run all the tests in a directory, you can pass in the directory:
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
runner.run('indices')
|
58
|
+
```
|
59
|
+
|
60
|
+
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
|
+
|
41
62
|
You can **download the YAML test files** from [the clients tests project](https://github.com/elastic/elasticsearch-clients-tests) with the following code:
|
42
63
|
|
43
64
|
```ruby
|
@@ -29,7 +29,7 @@ module Elasticsearch
|
|
29
29
|
|
30
30
|
def initialize(client, path = nil, logger = nil)
|
31
31
|
@client = client
|
32
|
-
@serverless =
|
32
|
+
@serverless = defined?(::ElasticsearchServerless) && client.is_a?(::ElasticsearchServerless::Client)
|
33
33
|
@path = path || File.expand_path('./tmp', __dir__)
|
34
34
|
@logger = logger || LOGGER
|
35
35
|
end
|
@@ -74,13 +74,14 @@ module Elasticsearch
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def select_test_files(test_files)
|
77
|
-
if test_files.empty?
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
77
|
+
tests_path = if test_files.empty?
|
78
|
+
"#{@path}/**/*.yml"
|
79
|
+
elsif test_files.include?('yml')
|
80
|
+
"#{@path}/#{test_files}"
|
81
|
+
else
|
82
|
+
"#{@path}/#{test_files}/*.yml"
|
83
|
+
end
|
84
|
+
Dir.glob(tests_path)
|
84
85
|
end
|
85
86
|
|
86
87
|
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.2.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-06-
|
11
|
+
date: 2024-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: elasticsearch
|
@@ -53,7 +53,6 @@ files:
|
|
53
53
|
- NOTICE
|
54
54
|
- README.md
|
55
55
|
- Rakefile
|
56
|
-
- elasticsearch-tests.gemspec
|
57
56
|
- lib/elasticsearch/tasks/download_test_suite.rake
|
58
57
|
- lib/elasticsearch/tests.rb
|
59
58
|
- lib/elasticsearch/tests/code_runner.rb
|
data/elasticsearch-tests.gemspec
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
# Licensed to Elasticsearch B.V. under one or more contributor
|
2
|
-
# license agreements. See the NOTICE file distributed with
|
3
|
-
# this work for additional information regarding copyright
|
4
|
-
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
-
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
-
# not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing,
|
12
|
-
# software distributed under the License is distributed on an
|
13
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
-
# KIND, either express or implied. See the License for the
|
15
|
-
# specific language governing permissions and limitations
|
16
|
-
# under the License.
|
17
|
-
|
18
|
-
# frozen_string_literal: true
|
19
|
-
|
20
|
-
require_relative 'lib/elasticsearch/tests/version'
|
21
|
-
|
22
|
-
Gem::Specification.new do |spec|
|
23
|
-
spec.name = 'elasticsearch-test-runner'
|
24
|
-
spec.email = ['client-libs@elastic.co']
|
25
|
-
spec.version = Elasticsearch::Tests::VERSION
|
26
|
-
spec.authors = ['Elastic Client Library Maintainers']
|
27
|
-
spec.licenses = ['Apache-2.0']
|
28
|
-
spec.summary = 'Tool to test Elasticsearch clients against the YAML clients test suite.'
|
29
|
-
spec.homepage = 'https://www.elastic.co/guide/en/elasticsearch/client/ruby-api/current/index.html'
|
30
|
-
spec.description = 'A test runner for the Elasticsearch clients YAML test suite, used in the elasticsearch and elasticsearch-serverless gems.'
|
31
|
-
spec.metadata['homepage_uri'] = spec.homepage
|
32
|
-
spec.metadata['changelog_uri'] = 'https://github.com/elastic/es-test-runner-ruby/blob/main/CHANGELOG.md'
|
33
|
-
spec.metadata['source_code_uri'] = 'https://github.com/elastic/es-test-runner-ruby/tree/main'
|
34
|
-
|
35
|
-
spec.required_ruby_version = '>= 3.0'
|
36
|
-
|
37
|
-
# Specify which files should be added to the gem when it is released.
|
38
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
39
|
-
spec.files = Dir.chdir(__dir__) do
|
40
|
-
`git ls-files -z`.split("\x0").reject do |f|
|
41
|
-
(File.expand_path(f) == __FILE__) ||
|
42
|
-
f.start_with?(*%w[bin/ test/ spec/ features/ .git appveyor Gemfile])
|
43
|
-
end
|
44
|
-
end
|
45
|
-
spec.bindir = 'exe'
|
46
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
47
|
-
spec.require_paths = ['lib']
|
48
|
-
|
49
|
-
spec.add_development_dependency 'elasticsearch'
|
50
|
-
spec.add_development_dependency 'elasticsearch-serverless'
|
51
|
-
end
|