[Groonga-commit] groonga/fluent-plugin-droonga at 54b7b1b [master] add: return failure if table doesn't exist

Back to archive index

Kosuke Asami null+****@clear*****
Thu Jul 18 16:38:43 JST 2013


Kosuke Asami	2013-07-18 16:38:43 +0900 (Thu, 18 Jul 2013)

  New Revision: 54b7b1b88a2fa7c8e7534110ad8f7c9670cf25df
  https://github.com/groonga/fluent-plugin-droonga/commit/54b7b1b88a2fa7c8e7534110ad8f7c9670cf25df

  Message:
    add: return failure if table doesn't exist

  Modified files:
    lib/droonga/plugin/handler_add.rb
    test/plugin/test_handler_add.rb

  Modified: lib/droonga/plugin/handler_add.rb (+1 -0)
===================================================================
--- lib/droonga/plugin/handler_add.rb    2013-07-18 16:34:38 +0900 (3f07de7)
+++ lib/droonga/plugin/handler_add.rb    2013-07-18 16:38:43 +0900 (ad00972)
@@ -31,6 +31,7 @@ module Droonga
 
     def process_add(request)
       table = @context[request["table"]]
+      return [false] unless table
       if table.class == Groonga::Array
         table.add(request["values"])
       else

  Modified: test/plugin/test_handler_add.rb (+9 -0)
===================================================================
--- test/plugin/test_handler_add.rb    2013-07-18 16:34:38 +0900 (636ee26)
+++ test/plugin/test_handler_add.rb    2013-07-18 16:38:43 +0900 (622d56d)
@@ -106,4 +106,13 @@ class AddHandlerTest < Test::Unit::TestCase
     table =****@worke*****["Books"]
     assert_equal(["CSS"], table.collect(&:title))
   end
+
+  def test_failure
+    request = {
+      "table"  => "XXX",
+      "values" => {},
+    }
+    @handler.add(request)
+    assert_equal([false], @worker.body)
+  end
 end
-------------- next part --------------
HTML����������������������������...
Download 



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