Class: Grntest::Executors::HTTPExecutor

Inherits:
BaseExecutor show all
Defined in:
lib/grntest/executors/http-executor.rb

Instance Attribute Summary

Attributes inherited from BaseExecutor

#context

Instance Method Summary collapse

Methods inherited from BaseExecutor

#execute

Constructor Details

#initialize(host, port, context = nil) ⇒ HTTPExecutor

Returns a new instance of HTTPExecutor.



25
26
27
28
29
30
# File 'lib/grntest/executors/http-executor.rb', line 25

def initialize(host, port, context=nil)
  super(context)
  @host = host
  @port = port
  @read_timeout = 3
end

Instance Method Details

#create_sub_executor(context) ⇒ Object



56
57
58
# File 'lib/grntest/executors/http-executor.rb', line 56

def create_sub_executor(context)
  self.class.new(@host, @port, context)
end

#ensure_groonga_readyObject



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/grntest/executors/http-executor.rb', line 40

def ensure_groonga_ready
  n_retried = 0
  begin
    send_command(command("status"))
  rescue SystemCallError
    n_retried += 1
    sleep(0.1)
    retry if n_retried < 10
    raise
  end
end

#send_command(command) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/grntest/executors/http-executor.rb', line 32

def send_command(command)
  if command.name == "load"
    send_load_command(command)
  else
    send_normal_command(command)
  end
end

#shutdownObject



52
53
54
# File 'lib/grntest/executors/http-executor.rb', line 52

def shutdown
  send_command(command("shutdown"))
end