elasticsearch-extensions 0.0.17 → 0.0.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d7b7b3061fef7f7c6741547566298952a9d3cd30
4
- data.tar.gz: c886b9cf1e4d612967124f8fb5bec6fe82c2729a
3
+ metadata.gz: e107c0460b65ea557da0d707c1d04876e5c09148
4
+ data.tar.gz: 24c97d1fb54ceddc82bfb832ba8e4e7b4f53107f
5
5
  SHA512:
6
- metadata.gz: 907242c0b88d063acd24e1967077b4b2697fd32825630619ae0a1525acb5906fb234ce2b114bf222b4035be08726d2fa51fc9ade9d9f9fbcfb5422d6ff17292d
7
- data.tar.gz: 44c49a14eea1c7ad742225a2274be9bd8b5302fb6dd338204da9592e947075d21006ff4fdbffca158113c21873f2f6144270a21ecf4c68d803dc23dd97ee2879
6
+ metadata.gz: 111ae93ac52d93ad54240d735a0d8373d075d25fb3769c830be10024f422a5b9fb803f033e1f9bb03e58cd660678f9fda44f7c6d97b404a493a44216871dd3bc
7
+ data.tar.gz: 6912205e7419ed78da8520fe15138cea7c4b759209bdc047fcde678b724e78e0d61c4d3de910a5d093f440f04c68dc17b7beae44a7b3e4d349a32e08bc2b262a
data/README.md CHANGED
@@ -25,7 +25,7 @@ Display a table with the output of the `_analyze` API:
25
25
 
26
26
  Allows to programatically start and stop an Elasticsearch cluster suitable for isolating tests.
27
27
 
28
- HTTP service is running on ports `9250-*` by default, and the cluster runs in-memory only.
28
+ The HTTP service is running on ports `9250-*` by default.
29
29
 
30
30
  Start and stop the default cluster:
31
31
 
@@ -51,6 +51,10 @@ Gem::Specification.new do |s|
51
51
  s.add_development_dependency "cane"
52
52
  end
53
53
 
54
+ if defined?(RUBY_VERSION) && RUBY_VERSION > '2.2'
55
+ s.add_development_dependency "test-unit", '~> 2'
56
+ end
57
+
54
58
  # Gems for testing integrations
55
59
  s.add_development_dependency "patron"
56
60
  s.add_development_dependency "oj"
@@ -1,5 +1,6 @@
1
1
  require 'timeout'
2
2
  require 'net/http'
3
+ require 'fileutils'
3
4
  require 'uri'
4
5
  require 'json'
5
6
  require 'ansi'
@@ -69,21 +70,27 @@ module Elasticsearch
69
70
 
70
71
  arguments[:command] ||= ENV['TEST_CLUSTER_COMMAND'] || 'elasticsearch'
71
72
  arguments[:port] ||= (ENV['TEST_CLUSTER_PORT'] || 9250).to_i
72
- arguments[:cluster_name] ||= ENV['TEST_CLUSTER_NAME'] || 'elasticsearch_test'
73
- arguments[:gateway_type] ||= 'none'
74
- arguments[:index_store] ||= 'memory'
73
+ arguments[:cluster_name] ||= (ENV['TEST_CLUSTER_NAME'] || 'elasticsearch_test').chomp
75
74
  arguments[:path_data] ||= ENV['TEST_CLUSTER_DATA'] || '/tmp'
76
75
  arguments[:es_params] ||= ENV['TEST_CLUSTER_PARAMS'] || ''
77
76
  arguments[:path_work] ||= '/tmp'
78
77
  arguments[:node_name] ||= 'node'
79
78
  arguments[:timeout] ||= (ENV['TEST_CLUSTER_TIMEOUT'] || 30).to_i
80
79
 
80
+ # Make sure `cluster_name` is not dangerous
81
+ if arguments[:cluster_name] =~ /^[\/\\]?$/
82
+ raise ArgumentError, "The `cluster_name` parameter cannot be empty string or a slash"
83
+ end
84
+
81
85
  if running? :on => arguments[:port], :as => arguments[:cluster_name]
82
86
  print "[!] Elasticsearch cluster already running".ansi(:red)
83
87
  wait_for_green(arguments[:port], arguments[:timeout])
84
88
  return false
85
89
  end
86
90
 
91
+ # Wipe out data for this cluster name
92
+ FileUtils.rm_rf "#{arguments[:path_data]}/#{arguments[:cluster_name]}"
93
+
87
94
  print "Starting ".ansi(:faint) +
88
95
  @@number_of_nodes.to_s.ansi(:bold, :faint) +
89
96
  " Elasticsearch nodes..".ansi(:faint)
@@ -98,8 +105,6 @@ module Elasticsearch
98
105
  -D es.cluster.name=#{arguments[:cluster_name]} \
99
106
  -D es.node.name=#{arguments[:node_name]}-#{n} \
100
107
  -D es.http.port=#{arguments[:port].to_i + (n-1)} \
101
- -D es.gateway.type=#{arguments[:gateway_type]} \
102
- -D es.index.store.type=#{arguments[:index_store]} \
103
108
  -D es.path.data=#{arguments[:path_data]} \
104
109
  -D es.path.work=#{arguments[:path_work]} \
105
110
  -D es.cluster.routing.allocation.disk.threshold_enabled=false \
@@ -154,10 +159,10 @@ module Elasticsearch
154
159
  pids = nodes['nodes'].map { |id, info| info['process']['id'] }
155
160
 
156
161
  unless pids.empty?
157
- print "Stopping Elasticsearch nodes... ".ansi(:faint)
162
+ print "\nStopping Elasticsearch nodes... ".ansi(:faint)
158
163
  pids.each_with_index do |pid, i|
159
164
  begin
160
- print "stopped PID #{pid}. ".ansi(:green) if Process.kill 'KILL', pid
165
+ print "stopped PID #{pid}. ".ansi(:green) if Process.kill 'INT', pid
161
166
  rescue Exception => e
162
167
  print "[#{e.class}] PID #{pid} not found. ".ansi(:red)
163
168
  end
@@ -1,5 +1,5 @@
1
1
  module Elasticsearch
2
2
  module Extensions
3
- VERSION = "0.0.17"
3
+ VERSION = "0.0.18"
4
4
  end
5
5
  end
@@ -89,6 +89,7 @@ class Elasticsearch::Extensions::BackupTest < Test::Unit::TestCase
89
89
  .expects(:search)
90
90
  .with do |params|
91
91
  assert_equal 'test', params[:index]
92
+ true # Thanks, Ruby 2.2
92
93
  end
93
94
  .returns({"_scroll_id" => "abc123"})
94
95
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch-extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karel Minarik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-16 00:00:00.000000000 Z
11
+ date: 2015-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ansi