[Groonga-commit] droonga/droonga-engine at c8604ac [master] Always return boolean by EngineNode#live?

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Apr 30 12:34:41 JST 2015


YUKI Hiroshi	2015-04-30 12:34:41 +0900 (Thu, 30 Apr 2015)

  New Revision: c8604ac2d73e38ce9054eae0ede8972dceeff16d
  https://github.com/droonga/droonga-engine/commit/c8604ac2d73e38ce9054eae0ede8972dceeff16d

  Message:
    Always return boolean by EngineNode#live?

  Modified files:
    lib/droonga/engine_node.rb
    test/unit/test_engine_node.rb

  Modified: lib/droonga/engine_node.rb (+2 -1)
===================================================================
--- lib/droonga/engine_node.rb    2015-04-30 11:59:07 +0900 (1a48de1)
+++ lib/droonga/engine_node.rb    2015-04-30 12:34:41 +0900 (876157a)
@@ -119,7 +119,8 @@ module Droonga
     end
 
     def live?
-      @state.nil? or @state["live"]
+      @state.nil? or
+        @state["live"] == true
     end
 
     def forwardable?

  Modified: test/unit/test_engine_node.rb (+30 -0)
===================================================================
--- test/unit/test_engine_node.rb    2015-04-30 11:59:07 +0900 (3510b4c)
+++ test/unit/test_engine_node.rb    2015-04-30 12:34:41 +0900 (13c7d37)
@@ -59,4 +59,34 @@ class EngineNodeTest < Test::Unit::TestCase
     assert_false(node(:name => "node29:2929/droonga",
                       :state => state).live?)
   end
+
+  class FromServiceProvider < self
+    class EngineNode < Droonga::EngineNode
+      private
+      def sender_role
+        Droonga::NodeRole::SERVICE_PROVIDER
+      end
+    end
+
+    class ToServiceProvider < self
+      def node(params)
+        EngineNode.new(params)
+      end
+
+      data(:same_role => {
+             "live" => true,
+             "role" => Droonga::NodeRole::SERVICE_PROVIDER,
+           })
+      def test_forwardable(state)
+        assert_true(node(:name => "node29:2929/droonga",
+                         :state => state).forwardable?)
+      end
+
+      data(:dead => { "live" => false })
+      def test_not_forwardable(state)
+        assert_false(node(:name => "node29:2929/droonga",
+                          :state => state).forwardable?)
+      end
+    end
+  end
 end
-------------- next part --------------
HTML����������������������������...
다운로드 



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