Class: Drntest::TestExecutor

Inherits:
Object
  • Object
show all
Defined in:
lib/drntest/test-executor.rb

Defined Under Namespace

Classes: Context

Instance Method Summary collapse

Constructor Details

#initialize(config, test_path, results) ⇒ TestExecutor

Returns a new instance of TestExecutor.



24
25
26
27
28
# File 'lib/drntest/test-executor.rb', line 24

def initialize(config, test_path, results)
  @config = config
  @test_path = test_path
  @results = results
end

Instance Method Details

#executeObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/drntest/test-executor.rb', line 30

def execute
  catch do |abort_tag|
    begin
      options = {
        :tag     => @config.tag,
        :port    => @config.port,
        :timeout => @config.timeout,
      }
      Droonga::Client.open(options) do |client|
        context = Context.new(client, @config, @results, abort_tag)
        operations.each do |operation|
          context.execute(operation)
        end
        context.finish
      end
    rescue
      @results.errors << $!
    end
  end
end