YUKI Hiroshi
null+****@clear*****
Mon Nov 25 18:14:47 JST 2013
YUKI Hiroshi 2013-11-25 18:14:47 +0900 (Mon, 25 Nov 2013) New Revision: 96ab46b32e4f5e578da971c969e62e46a9155b93 https://github.com/droonga/drntest/commit/96ab46b32e4f5e578da971c969e62e46a9155b93 Message: Don't setup temporary engine if no configuration is specified Modified files: lib/drntest/test-runner.rb Modified: lib/drntest/test-runner.rb (+28 -19) =================================================================== --- lib/drntest/test-runner.rb 2013-11-25 18:05:21 +0900 (056795d) +++ lib/drntest/test-runner.rb 2013-11-25 18:14:47 +0900 (ed1fd82) @@ -41,12 +41,12 @@ module Drntest end def config_dir - retur****@confi***** if @config - @target_path.parent + return nil unless @config + @config.parent end def config - @config || @config_dir + "fluentd.conf" + @config end def config=(path) @@ -56,7 +56,13 @@ module Drntest end def catalog - @catalog || @config_dir + "catalog.json" + path = @catalog + path ||= config_dir + "catalog.json" if config_dir + if path + Pathname(path) + else + nil + end end def port @@ -74,27 +80,24 @@ module Drntest private def prepare self.config = owner.config if owner.config - @catalog = Pathname(owner.catalog) if owner.catalog - self.config = @options[:config] if @options[:config] - @catalog = Pathname(@options[:catalog]) if @options[:catalog] - unless config.exist? - raise "Missing config file: #{config.to_s}" - end - unless catalog.exist? - raise "Missing catalog file: #{catalog.to_s}" - end + @catalog = owner.catalog if owner.catalog + @catalog = @options[:catalog] if @options[:catalog] - catalog_json = JSON.parse(catalog.read, :symbolize_names => true) - zone = catalog_json[:zones].first - /\A([^:]+):(\d+)/(.+)\z/ =~ zone - # @host = $1 - @port = $2.to_i - @tag = $3 + if catalog.exist? + catalog_json = JSON.parse(catalog.read, :symbolize_names => true) + zone = catalog_json[:zones].first + /\A([^:]+):(\d+)/(.+)\z/ =~ zone + @host = "localhost" # $1 + @port = $2.to_i + @tag = $3 + end end def setup + return unless temporary_engine? + FileUtils.rm_rf(temporary_dir) FileUtils.mkdir_p(temporary_dir) @@ -115,6 +118,8 @@ module Drntest end def teardown + return unless temporary_engine? + Process.kill(:KILL, @engine_pid) FileUtils.rm_rf(temporary_dir.to_s) end @@ -123,6 +128,10 @@ module Drntest config_dir + "tmp" end + def temporary_engine? + config && config.exist? + end + def process_requests results = TestResults.new(target_path) -------------- next part -------------- HTML����������������������������...Download