[Groonga-commit] droonga/droonga-engine at b47bb7e [master] Add more tests for all_nodes method

Back to archive index

YUKI Hiroshi null+****@clear*****
Fri May 9 11:41:41 JST 2014


YUKI Hiroshi	2014-05-09 11:41:41 +0900 (Fri, 09 May 2014)

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

  Message:
    Add more tests for all_nodes method

  Modified files:
    test/unit/catalog/test_slice.rb
    test/unit/catalog/test_volume_collection.rb

  Modified: test/unit/catalog/test_slice.rb (+11 -0)
===================================================================
--- test/unit/catalog/test_slice.rb    2014-05-09 11:34:42 +0900 (ae4d842)
+++ test/unit/catalog/test_slice.rb    2014-05-09 11:41:41 +0900 (abfe36d)
@@ -88,5 +88,16 @@ class CatalogSliceTest < Test::Unit::TestCase
       assert_equal("127.0.0.1:10047/volume.000",
                    slice.volume.address)
     end
+
+    def test_all_nodes
+      data = {
+        "volume" => {
+          "address" => "127.0.0.1:10047/volume.000",
+        },
+      }
+      slice = create_slice(data)
+      assert_equal(["127.0.0.1:10047"],
+                   slice.all_nodes)
+    end
   end
 end

  Modified: test/unit/catalog/test_volume_collection.rb (+28 -0)
===================================================================
--- test/unit/catalog/test_volume_collection.rb    2014-05-09 11:34:42 +0900 (4bc1c20)
+++ test/unit/catalog/test_volume_collection.rb    2014-05-09 11:41:41 +0900 (8a8c553)
@@ -47,4 +47,32 @@ class CatalogVolumeCollectionTest < Test::Unit::TestCase
                    @collection.select(:all))
     end
   end
+
+  class NodesTest < self
+    def create_volume_collection(volumes)
+      volumes = volumes.collect do |volume|
+        create_single_volume(volume)
+      end
+      super(volumes)
+    end
+
+    def create_single_volume(data)
+      Droonga::Catalog::SingleVolume.new(data)
+    end
+
+    def setup
+      volumes = [
+        { "address" => "volume1:10047/droonga.000" },
+        { "address" => "volume1:10047/droonga.001" },
+        { "address" => "volume2:10047/droonga.002" },
+        { "address" => "volume2:10047/droonga.003" },
+      ]
+      @collection = create_volume_collection(volumes)
+    end
+
+    def test_all_nodes
+      assert_equal(["volume1:10047", "volume2:10047"],
+                   @collection.all_nodes)
+    end
+  end
 end
-------------- next part --------------
HTML����������������������������...
Télécharger 



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