YUKI Hiroshi
null+****@clear*****
Fri Dec 5 13:16:42 JST 2014
YUKI Hiroshi 2014-12-05 13:16:42 +0900 (Fri, 05 Dec 2014) New Revision: dbd8f17514bf220c4036ca440c92d42c02610692 https://github.com/droonga/droonga-engine/commit/dbd8f17514bf220c4036ca440c92d42c02610692 Merged e0f9f34: Merge pull request #30 from piroor/replicas-in-a-branch Message: Add more tests for deeply nested cases Modified files: test/unit/catalog/test_slice.rb test/unit/catalog/test_slices.rb Modified: test/unit/catalog/test_slice.rb (+20 -1) =================================================================== --- test/unit/catalog/test_slice.rb 2014-12-05 12:53:14 +0900 (96ed049) +++ test/unit/catalog/test_slice.rb 2014-12-05 13:16:42 +0900 (550fce8) @@ -100,7 +100,7 @@ class CatalogSliceTest < Test::Unit::TestCase slice.all_nodes) end - def test_deeply_nested + def test_nested data = { "replicas" => [ { @@ -114,5 +114,24 @@ class CatalogSliceTest < Test::Unit::TestCase assert_equal(["127.0.0.1:10047/volume"], slice.all_nodes) end + + def test_deeply_nested + data = { + "replicas" => [ + { + "slices" => [ + { + "volume" => { + "address" => "127.0.0.1:10047/volume.000", + }, + }, + ], + }, + ], + } + slice = create_slice(data) + assert_equal(["127.0.0.1:10047/volume"], + slice.all_nodes) + end end end Modified: test/unit/catalog/test_slices.rb (+31 -1) =================================================================== --- test/unit/catalog/test_slices.rb 2014-12-05 12:53:14 +0900 (db5c7ae) +++ test/unit/catalog/test_slices.rb 2014-12-05 13:16:42 +0900 (8c957a5) @@ -116,7 +116,7 @@ class CatalogSingleVolumeTest < Test::Unit::TestCase volume.all_nodes) end - def test_deeply_nested + def test_nested data = { "slices" => [ { @@ -137,5 +137,35 @@ class CatalogSingleVolumeTest < Test::Unit::TestCase assert_equal(["127.0.0.1:23003/droonga", "127.0.0.1:23004/droonga"], volume.all_nodes) end + + def test_deeply_nested + data = { + "slices" => [ + { + "replicas" => [ + { + "slices" => [ + { "volume" => { "address" => "127.0.0.1:23003/droonga.000" } }, + { "volume" => { "address" => "127.0.0.1:23003/droonga.001" } }, + ], + }, + ], + }, + { + "replicas" => [ + { + "slices" => [ + { "volume" => { "address" => "127.0.0.1:23004/droonga.100" } }, + { "volume" => { "address" => "127.0.0.1:23004/droonga.101" } }, + ], + }, + ], + }, + ], + } + volume = create_slices(data) + assert_equal(["127.0.0.1:23003/droonga", "127.0.0.1:23004/droonga"], + volume.all_nodes) + end end end -------------- next part -------------- HTML����������������������������... 다운로드