[Groonga-commit] droonga/fluent-plugin-droonga at 164e1a3 [master] Test: don't close existing database connection

Back to archive index

YUKI Hiroshi null+****@clear*****
Wed Nov 20 15:07:39 JST 2013


YUKI Hiroshi	2013-11-20 15:07:39 +0900 (Wed, 20 Nov 2013)

  New Revision: 164e1a34b5c2627214e0dc7484e795b1562d4435
  https://github.com/droonga/fluent-plugin-droonga/commit/164e1a34b5c2627214e0dc7484e795b1562d4435

  Message:
    Test: don't close existing database connection

  Modified files:
    test/helper/sandbox.rb
    test/plugin/handler/test_handler_search.rb

  Modified: test/helper/sandbox.rb (+9 -5)
===================================================================
--- test/helper/sandbox.rb    2013-11-20 14:58:59 +0900 (151e722)
+++ test/helper/sandbox.rb    2013-11-20 15:07:39 +0900 (a8cf8e9)
@@ -61,11 +61,15 @@ module Sandbox
   end
 
   def restore(dumped_command)
-    context = Groonga::Context.new
-    database = context.create_database(@database_path.to_s)
-    context.restore(dumped_command)
-    database.close
-    context.close
+    if @database
+      Groonga::Context.default.restore(dumped_command)
+    else
+      context = Groonga::Context.new
+      database = context.create_database(@database_path.to_s)
+      context.restore(dumped_command)
+      database.close
+      context.close
+    end
   end
 
   def teardown_sandbox

  Modified: test/plugin/handler/test_handler_search.rb (+1 -5)
===================================================================
--- test/plugin/handler/test_handler_search.rb    2013-11-20 14:58:59 +0900 (00e39f5)
+++ test/plugin/handler/test_handler_search.rb    2013-11-20 15:07:39 +0900 (2dbb965)
@@ -20,6 +20,7 @@ class SearchHandlerTest < Test::Unit::TestCase
 
   def setup
     setup_database
+    restore(fixture_data("document.grn"))
     setup_handler(Droonga::SearchHandler)
   end
 
@@ -29,11 +30,6 @@ class SearchHandlerTest < Test::Unit::TestCase
   end
 
   private
-  def setup_database
-    restore(fixture_data("document.grn"))
-    super
-  end
-
   def search(request)
     @handler.search(request)
     normalize_result_set(@messages.last)
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index