Module: Elasticsearch::Extensions::Test::Cluster

Defined in:
lib/elasticsearch/extensions/test/cluster.rb

Overview

A convenience Ruby class for starting and stopping an Elasticsearch cluster, eg. for integration tests

require 'elasticsearch/extensions/test/cluster'
Elasticsearch::Extensions::Test::Cluster.start

system 'wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.tar.gz'
system 'tar -xvf elasticsearch-5.1.1.tar.gz'

require 'elasticsearch/extensions/test/cluster'
Elasticsearch::Extensions::Test::Cluster.start command: 'elasticsearch-5.1.1/bin/elasticsearch'

Examples:

Start a cluster with default configuration,

assuming `elasticsearch` is on $PATH.

Start a cluster with a specific Elasticsearch launch script,

eg. from a downloaded `.tar.gz` distribution

See Also:

Defined Under Namespace

Classes: Cluster

Class Method Summary collapse

Class Method Details

.running?(arguments = {}) ⇒ Boolean

Returns true when a specific test node is running within the cluster



82
83
84
# File 'lib/elasticsearch/extensions/test/cluster.rb', line 82

def running?(arguments = {})
  Cluster.new(arguments).running?
end

.start(arguments = {}) ⇒ Object

Starts a cluster



66
67
68
# File 'lib/elasticsearch/extensions/test/cluster.rb', line 66

def start(arguments = {})
  Cluster.new(arguments).start
end

.stop(arguments = {}) ⇒ Object

Stops a cluster



74
75
76
# File 'lib/elasticsearch/extensions/test/cluster.rb', line 74

def stop(arguments = {})
  Cluster.new(arguments).stop
end

.wait_for_green(arguments = {}) ⇒ Object

Waits until the cluster is green and prints information



90
91
92
# File 'lib/elasticsearch/extensions/test/cluster.rb', line 90

def wait_for_green(arguments = {})
  Cluster.new(arguments).wait_for_green
end