Skip to content

Commit 1009cd4

Browse files
committed
[API] Test Runner: Refactors X-Pack test tasks
1 parent aa71c74 commit 1009cd4

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

.github/workflows/7.x.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- name: elasticsearch-api
4343
run: cd elasticsearch-api && bundle exec rake test:spec
4444
- name: elasticsearch-xpack
45-
run: cd elasticsearch-xpack && bundle exec rake test:unit
45+
run: cd elasticsearch-xpack && bundle exec rake test:unit test:spec
4646
- name: elasticsearch-transport
4747
run: cd elasticsearch-transport && bundle exec rake test:all
4848

elasticsearch-xpack/Rakefile

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,30 @@ Rake::TestTask.new('test:unit') do |test|
3131
end
3232

3333
namespace :test do
34-
RSpec::Core::RakeTask.new(:spec)
34+
desc 'Run REST API YAML tests'
35+
RSpec::Core::RakeTask.new(:rest_api) do |t|
36+
t.pattern = 'spec/xpack/rest_api_yaml_spec.rb'
37+
end
3538

36-
desc 'Run rest api yaml tests'
37-
Rake::TestTask.new(:rest_api) do |test|
38-
`rm Gemfile.lock`
39-
test.deps = [:spec]
39+
RSpec::Core::RakeTask.new(:spec) do |t|
40+
t.pattern = 'spec/xpack/**/*_spec.rb'
41+
t.exclude_pattern = 'spec/xpack/rest_api_yaml_spec.rb'
4042
end
4143

4244
desc "Run integration tests"
43-
task :integration
45+
task :integration do
46+
Rake::Task['test:rest_api'].invoke
47+
end
48+
49+
desc "Run all tests"
50+
task :all do
51+
Rake::Task['test:unit'].invoke
52+
Rake::Task['test:spec'].invoke
53+
Rake::Task['test:rest_api'].invoke
54+
end
4455

4556
desc "Run Elasticsearch with X-Pack installed (Docker)"
46-
task :elasticsearch do
57+
task :elasticsearch, :stack_version do |_, args|
4758
sh <<-COMMAND.gsub(/^\s*/, '').gsub(/\s{1,}/, ' ')
4859
docker run \
4960
--name elasticsearch-xpack \
@@ -56,14 +67,13 @@ namespace :test do
5667
--env "path.repo=/tmp" \
5768
--env "repositories.url.allowed_urls=http://snapshot.test*" \
5869
--env "bootstrap.memory_lock=true" \
59-
--env "ELASTIC_PASSWORD=MagicWord" \
70+
--env "ELASTIC_PASSWORD=changeme" \
6071
--ulimit nofile=65536:65536 \
6172
--ulimit memlock=-1:-1 \
6273
--publish 9260:9200 \
63-
--volume $(pwd)/tmp/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
6474
--memory 4g \
6575
--rm \
66-
docker.elastic.co/elasticsearch/elasticsearch:7.0.0-SNAPSHOT
76+
docker.elastic.co/elasticsearch/elasticsearch:#{args[:stack_version]}
6777
COMMAND
6878
end
6979
end

0 commit comments

Comments
 (0)