Skip to content

Commit 9dcfc47

Browse files
committed
Replaces yaml test runner with gem
1 parent 1decf0e commit 9dcfc47

File tree

6 files changed

+14
-496
lines changed

6 files changed

+14
-496
lines changed

Rakefile

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -45,42 +45,9 @@ namespace :spec do
4545
t.pattern = Dir.glob('spec/**/*_spec.rb')
4646
end
4747

48-
desc 'Download test suite to ./spec/tmp'
49-
task :download_tests do
50-
require 'open-uri'
51-
path = 'spec/tmp'
52-
filename = 'tests.zip'
53-
url = 'https://api.github.com/repos/elastic/elasticsearch-clients-tests/zipball/main'
54-
55-
File.open(filename, 'w') do |downloaded_file|
56-
URI.open(
57-
url,
58-
'Accept' => 'application/vnd.github+json'
59-
) do |artifact_file|
60-
downloaded_file.write(artifact_file.read)
61-
end
62-
end
63-
if File.exist?(filename)
64-
puts "Successfully downloaded #{filename}"
65-
else
66-
warn "[!] Couldn't download #{filename}"
67-
exit 1
68-
end
69-
70-
puts "Unzipping files"
71-
`unzip #{filename} -d spec/tmp/`
72-
puts "Removing zip file"
73-
File.delete(filename)
74-
end
75-
76-
desc 'Clean tests folder'
77-
task :clean_tests do
78-
FileUtils.rm_rf(Dir.glob('./spec/tmp/**/*'), secure: true)
79-
end
80-
8148
desc 'Run YAML test runner'
8249
task :yaml do
83-
ruby './spec/yaml-test-runner/runner.rb'
50+
ruby './spec/yaml-test-runner/run.rb'
8451
end
8552
end
8653

@@ -112,7 +79,7 @@ rescue StandardError => e
11279
abort "[!!!] #{e.class} : #{e.message}"
11380
end
11481

115-
desc "Server info"
82+
desc 'Server info'
11683
task :info do
11784
require 'elasticsearch-serverless'
11885
client = ElasticsearchServerless::Client.new(url: ENV['ELASTICSEARCH_URL'], api_key: ENV['API_KEY'])

spec/yaml-test-runner/code_runner.rb

Lines changed: 0 additions & 223 deletions
This file was deleted.

spec/yaml-test-runner/printer.rb

Lines changed: 0 additions & 69 deletions
This file was deleted.

spec/yaml-test-runner/errors.rb renamed to spec/yaml-test-runner/run.rb

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,15 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
module Elastic
19-
module TestRunner
20-
class TestFailure < StandardError; end
21-
class TestError < StandardError; end
22-
end
23-
end
18+
require 'logger'
19+
require 'elasticsearch/tests/test_runner'
20+
require 'elasticsearch/tests/downloader'
21+
require_relative '../spec_helper'
22+
23+
tests_path = File.expand_path('../../tmp', __dir__)
24+
25+
logger = Logger.new($stdout)
26+
logger.level = Logger::WARN unless ENV['DEBUG']
27+
28+
Elasticsearch::Tests::Downloader::run(tests_path)
29+
Elasticsearch::Tests::TestRunner.new(CLIENT, tests_path, logger).run

0 commit comments

Comments
 (0)