Skip to content

Commit

Permalink
Removes dev dependency on extensions in elasticsearch-dsl
Browse files Browse the repository at this point in the history
  • Loading branch information
picandocodigo committed Mar 4, 2021
1 parent c4f562f commit cb60c34
Show file tree
Hide file tree
Showing 12 changed files with 2 additions and 72 deletions.
4 changes: 0 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ if File.exist? File.expand_path('../../elasticsearch-api', __FILE__)
gem 'elasticsearch-api', path: File.expand_path('../../elasticsearch-api', __FILE__), require: false
end

if File.exist? File.expand_path('../../elasticsearch-extensions', __FILE__)
gem 'elasticsearch-extensions', path: File.expand_path('../../elasticsearch-extensions', __FILE__), require: false
end

group :development do
gem 'rspec'
if defined?(JRUBY_VERSION)
Expand Down
16 changes: 0 additions & 16 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,6 @@ namespace :test do
Rake::Task['test:unit'].invoke
Rake::Task['test:integration'].invoke
end

namespace :cluster do
desc "Start Elasticsearch nodes for tests"
task :start do
$LOAD_PATH << File.expand_path('../../elasticsearch-transport/lib', __FILE__) << File.expand_path('../test', __FILE__)
require 'elasticsearch/extensions/test/cluster'
Elasticsearch::Extensions::Test::Cluster.start
end

desc "Stop Elasticsearch nodes for tests"
task :stop do
$LOAD_PATH << File.expand_path('../../elasticsearch-transport/lib', __FILE__) << File.expand_path('../test', __FILE__)
require 'elasticsearch/extensions/test/cluster'
Elasticsearch::Extensions::Test::Cluster.stop
end
end
end

# ----- Documentation tasks ---------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion elasticsearch-dsl.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ Gem::Specification.new do |s|
s.add_development_dependency 'rake', '~> 12.3'

s.add_development_dependency 'elasticsearch'
s.add_development_dependency 'elasticsearch-extensions'

s.add_development_dependency 'cane'
s.add_development_dependency 'minitest', '~> 5'
Expand Down
4 changes: 0 additions & 4 deletions test/integration/search_aggregation_children_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ class ChildrenAggregationIntegrationTest < ::Elasticsearch::Test::IntegrationTes
include Elasticsearch::DSL::Search

context "A children aggregation" do
startup do
Elasticsearch::Extensions::Test::Cluster.start(number_of_nodes: 1) if ENV['SERVER'] and not Elasticsearch::Extensions::Test::Cluster.running?(number_of_nodes: 1)
end

setup do
@client.indices.create index: 'articles-and-comments', body: {
mappings: {
Expand Down
4 changes: 0 additions & 4 deletions test/integration/search_aggregation_geo_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ class GeoAggregationIntegrationTest < ::Elasticsearch::Test::IntegrationTestCase
include Elasticsearch::DSL::Search

context "A geo aggregation" do
startup do
Elasticsearch::Extensions::Test::Cluster.start(number_of_nodes: 1) if ENV['SERVER'] and not Elasticsearch::Extensions::Test::Cluster.running?(number_of_nodes: 1)
end

setup do
@client.indices.create index: 'venues-test', body: {
mappings: {
Expand Down
4 changes: 0 additions & 4 deletions test/integration/search_aggregation_nested_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ class NestedAggregationIntegrationTest < ::Elasticsearch::Test::IntegrationTestC
include Elasticsearch::DSL::Search

context "A nested aggregation" do
startup do
Elasticsearch::Extensions::Test::Cluster.start(number_of_nodes: 1) if ENV['SERVER'] and not Elasticsearch::Extensions::Test::Cluster.running?(number_of_nodes: 1)
end

setup do
@client.indices.create index: 'products-test', body: {
mappings: {
Expand Down
4 changes: 0 additions & 4 deletions test/integration/search_filters_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ class FiltersIntegrationTest < ::Elasticsearch::Test::IntegrationTestCase
include Elasticsearch::DSL::Search

context "Filters integration" do
startup do
Elasticsearch::Extensions::Test::Cluster.start(number_of_nodes: 1) if ENV['SERVER'] and not Elasticsearch::Extensions::Test::Cluster.running?(number_of_nodes: 1)
end

setup do
@client.indices.create index: 'test'
@client.index index: 'test', id: 1,
Expand Down
4 changes: 0 additions & 4 deletions test/integration/search_query_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ class QueryIntegrationTest < ::Elasticsearch::Test::IntegrationTestCase
include Elasticsearch::DSL::Search

context "Queries integration" do
startup do
Elasticsearch::Extensions::Test::Cluster.start(number_of_nodes: 1) if ENV['SERVER'] and not Elasticsearch::Extensions::Test::Cluster.running?(number_of_nodes: 1)
end

setup do
@client.indices.create index: 'test'
@client.index index: 'test', id: '1', body: { title: 'Test', tags: ['one'] }
Expand Down
4 changes: 0 additions & 4 deletions test/integration/search_sort_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ class SortingIntegrationTest < ::Elasticsearch::Test::IntegrationTestCase
include Elasticsearch::DSL::Search

context "Sorting integration" do
startup do
Elasticsearch::Extensions::Test::Cluster.start(number_of_nodes: 1) if ENV['SERVER'] and not Elasticsearch::Extensions::Test::Cluster.running?(number_of_nodes: 1)
end

setup do
@client.indices.create index: 'test'
@client.index index: 'test', id: '1', body: { tags: ['one'], clicks: 15 }
Expand Down
4 changes: 0 additions & 4 deletions test/integration/search_suggest_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ class SuggestIntegrationTest < ::Elasticsearch::Test::IntegrationTestCase
include Elasticsearch::DSL::Search

context "Suggest integration" do
startup do
Elasticsearch::Extensions::Test::Cluster.start(number_of_nodes: 1) if ENV['SERVER'] and not Elasticsearch::Extensions::Test::Cluster.running?(number_of_nodes: 1)
end

setup do
@client.indices.create index: 'test', body: {
mappings: {
Expand Down
4 changes: 0 additions & 4 deletions test/integration/search_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ def search_definition
end

context "The Search class" do
startup do
Elasticsearch::Extensions::Test::Cluster.start(number_of_nodes: 1) if ENV['SERVER'] and not Elasticsearch::Extensions::Test::Cluster.running?(number_of_nodes: 1)
end

setup do
@client.indices.create index: 'test'
@client.index index: 'test', id: '1', body: { title: 'Test', tags: ['one'] }
Expand Down
21 changes: 2 additions & 19 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
SimpleCov.start { add_filter "/test|test_" }
end

at_exit { Elasticsearch::Test::IntegrationTestCase.__run_at_exit_hooks }

require 'minitest/autorun'
require 'shoulda-context'
require 'mocha/setup'
Expand All @@ -43,10 +41,9 @@
# Minitest::Reporters::HtmlReporter.new ]

require 'elasticsearch'
require 'elasticsearch/extensions/test/cluster'
require 'elasticsearch/extensions/test/startup_shutdown'

require 'elasticsearch/dsl'
require 'logger'
require 'ansi'

module Elasticsearch
module Test
Expand All @@ -67,20 +64,6 @@ class IntegrationTestCase < ::Minitest::Test
alias_method :assert_not_nil, :refute_nil
alias_method :assert_raise, :assert_raises

include Elasticsearch::Extensions::Test
extend StartupShutdown

startup do
Cluster.start(number_of_nodes: 1) if ENV['SERVER'] \
&& ! Elasticsearch::Extensions::Test::Cluster.running?(number_of_nodes: 1)
end

shutdown do
Cluster.stop if ENV['SERVER'] \
&& started? \
&& Elasticsearch::Extensions::Test::Cluster.running?
end

def setup
@port = (ENV['TEST_CLUSTER_PORT'] || 9250).to_i

Expand Down

0 comments on commit cb60c34

Please sign in to comment.