Navigation Menu

Skip to content

Commit

Permalink
Add --timeout option to work on slow environment such as Travis CI
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Apr 30, 2014
1 parent b4505d3 commit 30d5db5
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/drntest/configuration.rb
Expand Up @@ -19,6 +19,7 @@ class Configuration
attr_accessor :base_path, :engine_config
attr_accessor :droonga_engine, :droonga_engine_options
attr_accessor :catalog_version
attr_accessor :timeout

def initialize
@port = 24224
Expand All @@ -29,6 +30,7 @@ def initialize
@droonga_engine = "droonga-engine"
@droonga_engine_options = []
@catalog_version = "2"
@timeout = 1
end

def suite_path
Expand Down
2 changes: 1 addition & 1 deletion lib/drntest/engine.rb
Expand Up @@ -117,7 +117,7 @@ def setup(target_path)
}
options = {
:chdir => temporary_dir.to_s,
STDERR => STDOUT,
:err => :out,
}
arguments = [env, *command]
arguments << options
Expand Down
7 changes: 6 additions & 1 deletion lib/drntest/test-executor.rb
Expand Up @@ -29,7 +29,12 @@ def initialize(config, test_path, results)
def execute
catch do |abort_tag|
begin
Droonga::Client.open(tag: @config.tag, port: @config.port) do |client|
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)
Expand Down
6 changes: 6 additions & 0 deletions lib/drntest/tester.rb
Expand Up @@ -123,6 +123,12 @@ def create_option_parser
@suite_pattern = pattern
end

parser.on("--timeout=TIMEOUT", Float,
"Wait TIMEOUT seconds for " +
"receiving responses from Droonga engine") do |timeout|
@config.timeout = timeout
end

parser
end

Expand Down

0 comments on commit 30d5db5

Please sign in to comment.