Class: CrateRuby::TestCluster

Inherits:
Object
  • Object
show all
Defined in:
lib/crate_ruby/utils.rb

Instance Method Summary collapse

Constructor Details

#initialize(num_nodes = 1, http_port = 44200) ⇒ TestCluster

Returns a new instance of TestCluster.



28
29
30
31
32
33
34
35
36
37
# File 'lib/crate_ruby/utils.rb', line 28

def initialize(num_nodes = 1, http_port=44200)
  @nodes = []
  idx = 0
  while idx < num_nodes do
    name = "crate#{idx-1}"
    port = http_port + idx
    @nodes << TestServer.new(name, port)
    idx += 1
  end
end

Instance Method Details

#start_nodesObject



39
40
41
42
43
# File 'lib/crate_ruby/utils.rb', line 39

def start_nodes
  @nodes.each do |node|
    node.start
  end
end

#stop_nodesObject



45
46
47
48
49
# File 'lib/crate_ruby/utils.rb', line 45

def stop_nodes
  @nodes.each do |node|
    node.stop
  end
end