YUKI Hiroshi
null+****@clear*****
Fri Sep 27 19:08:47 JST 2013
YUKI Hiroshi 2013-09-27 19:08:47 +0900 (Fri, 27 Sep 2013) New Revision: 306807bb80af3905ffa6178cdf4414c3a65e3e84 https://github.com/droonga/fluent-plugin-droonga/commit/306807bb80af3905ffa6178cdf4414c3a65e3e84 Message: Add test for Catalog Added files: test/fixtures/catalog.json test/test_catalog.rb Added: test/fixtures/catalog.json (+43 -0) 100644 =================================================================== --- /dev/null +++ test/fixtures/catalog.json 2013-09-27 19:08:47 +0900 (cd50fc5) @@ -0,0 +1,43 @@ +{ + "effective_date": "2013-09-01T00:00:00Z", + "zones": ["localhost:23003/test"], + "farms": { + "localhost:23003/test": { + "device": ".", + "capacity": 10 + } + }, + "datasets": { + "Test": { + "workers": 0, + "plugins": ["for_dataset"], + "number_of_replicas": 2, + "number_of_partitions": 2, + "partition_key": "_key", + "date_range": "infinity", + "ring": { + "localhost:23041": { + "weight": 50, + "partitions": { + "2013-09-01": [ + "localhost:23003/test.000", + "localhost:23003/test.001" + ] + } + }, + "localhost:23042": { + "weight": 50, + "partitions": { + "2013-09-01": [ + "localhost:23003/test.002", + "localhost:23003/test.003" + ] + } + } + } + } + }, + "options": { + "plugins": ["for_global"] + } +} Added: test/test_catalog.rb (+59 -0) 100644 =================================================================== --- /dev/null +++ test/test_catalog.rb 2013-09-27 19:08:47 +0900 (c09409d) @@ -0,0 +1,59 @@ +# Copyright (C) 2013 droonga project +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1 as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +require "droonga/catalog" + +class CatalogTest < Test::Unit::TestCase + def setup + @catalog = Droonga::Catalog.new(catalog_path) + end + + def test_option + assert_equal(["for_global"], @catalog.option("plugins")) + end + + def test_get_engines + engines =****@catal*****_engines("localhost:23003/test") + base_path = File.expand_path("../fixtures", __FILE__) + assert_equal({ + "localhost:23003/test.000" => { + :database => "#{base_path}/000/db", + :handlers => ["for_dataset"], + :n_workers => 0 + }, + "localhost:23003/test.001" => { + :database => "#{base_path}/001/db", + :handlers => ["for_dataset"], + :n_workers => 0 + }, + "localhost:23003/test.002" => { + :database => "#{base_path}/002/db", + :handlers => ["for_dataset"], + :n_workers => 0 + }, + "localhost:23003/test.003" => { + :database => "#{base_path}/003/db", + :handlers => ["for_dataset"], + :n_workers => 0 + }, + }, + engines) + end + + private + def catalog_path + @catalog_path ||= File.expand_path("../fixtures/catalog.json", __FILE__) + end +end -------------- next part -------------- HTML����������������������������... Download