lib/elasticsearch/extensions/test/cluster.rb in elasticsearch-extensions-0.0.13 vs lib/elasticsearch/extensions/test/cluster.rb in elasticsearch-extensions-0.0.14

- old
+ new

@@ -137,10 +137,15 @@ # @see Cluster#start Cluster.start # def stop(arguments={}) arguments[:port] ||= (ENV['TEST_CLUSTER_PORT'] || 9250).to_i - nodes = JSON.parse(Net::HTTP.get(URI("http://localhost:#{arguments[:port]}/_nodes/?process"))) rescue nil + nodes = begin + JSON.parse(Net::HTTP.get(URI("http://localhost:#{arguments[:port]}/_nodes/?process"))) + rescue Exception => e + STDERR.puts "[!] Exception raised when stopping the cluster: #{e.inspect}".ansi(:red) + nil + end return false if nodes.nil? or nodes.empty? pids = nodes['nodes'].map { |id, info| info['process']['id'] }