elasticsearch-extensions 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile CHANGED
@@ -45,7 +45,7 @@ namespace :test do
45
45
  test.test_files = FileList["test/profile/**/*_test.rb"]
46
46
  end
47
47
 
48
- namespace :server do
48
+ namespace :cluster do
49
49
  desc "Start Elasticsearch nodes for tests"
50
50
  task :start do
51
51
  $LOAD_PATH << File.expand_path('../lib', __FILE__) << File.expand_path('../test', __FILE__)
@@ -30,7 +30,7 @@ module Elasticsearch
30
30
  # @see Cluster#stop Cluster.stop
31
31
  #
32
32
  module Cluster
33
- @@number_of_nodes = 0
33
+ @@number_of_nodes = (ENV['TEST_CLUSTER_NODES'] || 2).to_i
34
34
 
35
35
  # Starts a cluster
36
36
  #
@@ -88,11 +88,13 @@ module Elasticsearch
88
88
  @@number_of_nodes.to_s.ansi(:bold, :faint) +
89
89
  " Elasticsearch nodes..".ansi(:faint)
90
90
 
91
+ pids = []
92
+
91
93
  @@number_of_nodes.times do |n|
92
94
  n += 1
93
95
  pid = Process.spawn <<-COMMAND
94
96
  #{arguments[:command]} \
95
- -D es.foreground=no \
97
+ -D es.foreground=yes \
96
98
  -D es.cluster.name=#{arguments[:cluster_name]} \
97
99
  -D es.node.name=#{arguments[:node_name]}-#{n} \
98
100
  -D es.http.port=#{arguments[:port].to_i + (n-1)} \
@@ -104,9 +106,16 @@ module Elasticsearch
104
106
  -D es.discovery.zen.ping.multicast.enabled=true \
105
107
  -D es.node.test=true \
106
108
  #{arguments[:es_params]} \
107
- > /dev/null 2>&1
109
+ > /dev/null
108
110
  COMMAND
109
111
  Process.detach pid
112
+ pids << pid
113
+ end
114
+
115
+ # Check for proceses running
116
+ if `ps -p #{pids.join(' ')}`.split("\n").size < @@number_of_nodes+1
117
+ STDERR.puts "", "[!!!] Process failed to start (see output above)".ansi(:red)
118
+ exit(1)
110
119
  end
111
120
 
112
121
  wait_for_green(arguments[:port], arguments[:timeout])
@@ -207,6 +216,8 @@ module Elasticsearch
207
216
  nil
208
217
  end
209
218
 
219
+ puts response.inspect if ENV['DEBUG']
220
+
210
221
  if response && response['status'] == status && ( @@number_of_nodes.nil? || @@number_of_nodes == response['number_of_nodes'].to_i )
211
222
  __print_cluster_info(port) and break
212
223
  end
@@ -1,5 +1,5 @@
1
1
  module Elasticsearch
2
2
  module Extensions
3
- VERSION = "0.0.8"
3
+ VERSION = "0.0.9"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch-extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-12-29 00:00:00.000000000 Z
12
+ date: 2014-01-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: elasticsearch