[Groonga-commit] droonga/fluent-plugin-droonga at 9df912a [catalog2] Remove tests for catalog v2 at this moment

Back to archive index

Yoji Shidara null+****@clear*****
Mon Feb 24 13:25:33 JST 2014


Yoji Shidara	2014-02-24 13:25:33 +0900 (Mon, 24 Feb 2014)

  New Revision: 9df912a8441b1075477438070763da62e9f9b236
  https://github.com/droonga/fluent-plugin-droonga/commit/9df912a8441b1075477438070763da62e9f9b236

  Message:
    Remove tests for catalog v2 at this moment

  Modified files:
    test/unit/catalog/test_version2.rb

  Modified: test/unit/catalog/test_version2.rb (+0 -359)
===================================================================
--- test/unit/catalog/test_version2.rb    2014-02-24 12:00:33 +0900 (d25e8ad)
+++ test/unit/catalog/test_version2.rb    2014-02-24 13:25:33 +0900 (b3d65e5)
@@ -16,363 +16,4 @@
 require "droonga/catalog/version2"
 
 class CatalogTestVersion2 < Test::Unit::TestCase
-  class << self
-    def minimum_data
-      {
-        "effectiveDate" => "2013-09-01T00:00:00Z",
-        "zones" => [],
-        "farms" => {},
-        "datasets" => {},
-      }
-    end
-  end
-
-  private
-  def minimum_data
-    self.class.minimum_data
-  end
-
-  def create_catalog(data, path)
-    Droonga::Catalog::Version2.new(data, path)
-  end
-
-  class OptionTest < self
-    def create_catalog(options)
-      super(minimum_data.merge("options" => options), "path")
-    end
-
-    def test_nonexistent
-      catalog = create_catalog({})
-      assert_nil(catalog.option("nonexistent"))
-    end
-
-    def test_existent
-      catalog = create_catalog("plugins" => ["crud", "groonga"])
-      assert_equal(["crud", "groonga"],
-                   catalog.option("plugins"))
-    end
-  end
-
-  class PartitionTest < self
-    def setup
-      data = JSON.parse(File.read(catalog_path))
-      @catalog = create_catalog(data, catalog_path)
-    end
-
-    def test_get_partitions
-      partitions =****@catal*****_partitions("localhost:23003/test")
-      assert_equal({
-                     "localhost:23003/test.000" => {
-                       :database  => "#{base_path}/000/db",
-                       :dataset   => "Test",
-                       :plugins   => ["for_dataset"],
-                       :n_workers => 0
-                     },
-                     "localhost:23003/test.001" => {
-                       :database  => "#{base_path}/001/db",
-                       :dataset   => "Test",
-                       :plugins   => ["for_dataset"],
-                       :n_workers => 0
-                     },
-                     "localhost:23003/test.002" => {
-                       :database  => "#{base_path}/002/db",
-                       :dataset   => "Test",
-                       :plugins   => ["for_dataset"],
-                       :n_workers => 0
-                     },
-                     "localhost:23003/test.003" => {
-                       :database  => "#{base_path}/003/db",
-                       :dataset   => "Test",
-                       :plugins   => ["for_dataset"],
-                       :n_workers => 0
-                     },
-                   },
-                   partitions)
-    end
-
-    def fixture_path(base_path)
-      File.expand_path("../../fixtures/#{base_path}", __FILE__)
-    end
-
-    def catalog_path
-      @catalog_path ||= fixture_path("catalog/version2.json")
-    end
-
-    def base_path
-      File.dirname(catalog_path)
-    end
-
-    class PluginsTest < self
-      def setup
-        @data = minimum_data.merge({
-          "zones" => [farm_name],
-          "farms" => {
-            farm_name => {
-              "device" => ".",
-            },
-          },
-          "datasets" => {
-            "Droonga" => {
-              "workers" => 1,
-              "number_of_partitions" => 1,
-              "number_of_replicas" => 1,
-              "date_range" => "infinity",
-              "partition_key" => "_key",
-              "plugins" => [],
-              "ring" => {
-                "localhost:23041" => {
-                  "weight" =>  50,
-                  "partitions" => {
-                    "2014-02-09" => [
-                      "#{farm_name}.000",
-                    ],
-                  },
-                },
-              },
-            },
-          },
-        })
-      end
-
-      def farm_name
-        "localhost:23041/droonga"
-      end
-
-      def plugins(data)
-        catalog = create_catalog(data, catalog_path)
-        catalog.get_partitions(farm_name).collect do |partition, options|
-          options[:plugins]
-        end
-      end
-
-      def test_plugins
-        @data["datasets"]["Droonga"]["plugins"] = ["search", "groonga", "add"]
-        assert_equal([["search", "groonga", "add"]],
-                     plugins(@data))
-
-      end
-    end
-  end
-
-  class DataSetTest < self
-    class RingTest < self
-      class TotalWeightTest < self
-        def test_three_zones
-          dataset = {
-            "ring" => {
-              "zone1" => {
-                "weight" => 10,
-              },
-              "zone2" => {
-                "weight" => 20,
-              },
-              "zone3" => {
-                "weight" => 30,
-              },
-            }
-          }
-          assert_equal(10 + 20 + 30,
-                       total_weight(dataset))
-        end
-
-        private
-        def total_weight(dataset)
-          catalog = create_catalog(minimum_data,
-                                   "base-path")
-          catalog.send(:compute_total_weight, dataset)
-        end
-      end
-    end
-  end
-
-  class ValidationTest < self
-    class << self
-      def farm_name
-        "localhost:23041/droonga"
-      end
-
-      def ring_name
-        "localhost:23041"
-      end
-
-      def range_name
-        "2013-09-01"
-      end
-
-      def path
-        "path/to/catalog"
-      end
-
-      def valid_farms
-        {
-          farm_name => {
-            "device" => ".",
-          },
-        }
-      end
-
-      def valid_zones
-        valid_farms.keys
-      end
-
-      def valid_dataset_base
-        {
-          "workers" => 0,
-          "number_of_replicas" => 1,
-          "number_of_partitions" => 1,
-          "partition_key" => "_key",
-          "date_range" => "infinity",
-          "ring" => {},
-        }
-      end
-    end
-
-    data(
-      :missing_root_elements => {
-        :catalog => {},
-        :errors => [
-          Droonga::Catalog::MissingRequiredParameter.new(
-            "effectiveDate", path),
-          Droonga::Catalog::MissingRequiredParameter.new(
-            "zones", path),
-          Droonga::Catalog::MissingRequiredParameter.new(
-            "farms", path),
-          Droonga::Catalog::MissingRequiredParameter.new(
-            "datasets", path),
-        ],
-      },
-      :invalid_farms => {
-        :catalog => minimum_data.merge(
-          "farms" => {
-            farm_name => {
-            },
-          },
-          "zones" => [farm_name],
-        ),
-        :errors => [
-          Droonga::Catalog::MissingRequiredParameter.new(
-            "farms.#{farm_name}.device", path),
-        ],
-      },
-      :missing_dataset_parameters => {
-        :catalog => minimum_data.merge(
-          "farms" => valid_farms,
-          "zones" => valid_zones,
-          "datasets" => {
-            "Droonga" => {
-            },
-          },
-        ),
-        :errors => [
-          Droonga::Catalog::MissingRequiredParameter.new(
-            "datasets.Droonga.workers", path),
-          Droonga::Catalog::MissingRequiredParameter.new(
-            "datasets.Droonga.number_of_replicas", path),
-          Droonga::Catalog::MissingRequiredParameter.new(
-            "datasets.Droonga.number_of_partitions", path),
-          Droonga::Catalog::MissingRequiredParameter.new(
-            "datasets.Droonga.partition_key", path),
-          Droonga::Catalog::MissingRequiredParameter.new(
-            "datasets.Droonga.date_range", path),
-          Droonga::Catalog::MissingRequiredParameter.new(
-            "datasets.Droonga.ring", path),
-        ],
-      },
-      :invalid_date_parameters => {
-        :catalog => minimum_data.merge(
-          "effectiveDate" => "invalid",
-        ),
-        :errors => [
-          Droonga::Catalog::InvalidDate.new(
-            "effectiveDate", "invalid", path),
-        ],
-      },
-      :non_integer_numeric_parameters => {
-        :catalog => minimum_data.merge(
-          "farms" => valid_farms,
-          "zones" => valid_zones,
-          "datasets" => {
-            "Droonga" => valid_dataset_base.merge(
-              "workers" => 0.1,
-              "number_of_replicas" => 0.1,
-              "number_of_partitions" => 0.1,
-              "ring" => {
-                ring_name => {
-                  "weight" => 0.1,
-                  "partitions" => {},
-                },
-              },
-            ),
-          },
-        ),
-        :errors => [
-          Droonga::Catalog::MismatchedParameterType.new(
-            "datasets.Droonga.workers", Integer, Float, path),
-          Droonga::Catalog::MismatchedParameterType.new(
-            "datasets.Droonga.number_of_replicas", Integer, Float, path),
-          Droonga::Catalog::MismatchedParameterType.new(
-            "datasets.Droonga.number_of_partitions", Integer, Float, path),
-        ],
-      },
-      :negative_numeric_parameters => {
-        :catalog => minimum_data.merge(
-          "farms" => valid_farms,
-          "zones" => valid_zones,
-          "datasets" => {
-            "Droonga" => valid_dataset_base.merge(
-              "workers" => -1,
-              "number_of_replicas" => -1,
-              "number_of_partitions" => -1,
-              "ring" => {
-                ring_name => {
-                  "weight" => -1,
-                  "partitions" => {},
-                },
-              },
-            ),
-          },
-        ),
-        :errors => [
-          Droonga::Catalog::NegativeNumber.new(
-            "datasets.Droonga.workers", -1, path),
-          Droonga::Catalog::SmallerThanOne.new(
-            "datasets.Droonga.number_of_replicas", -1, path),
-          Droonga::Catalog::SmallerThanOne.new(
-            "datasets.Droonga.number_of_partitions", -1, path),
-          Droonga::Catalog::NegativeNumber.new(
-            "datasets.Droonga.ring.#{ring_name}.weight", -1, path),
-        ],
-      },
-      :broken_relations_unknown_farm => {
-        :catalog => minimum_data.merge(
-          "farms" => valid_farms,
-          "zones" => valid_zones,
-          "datasets" => {
-            "Droonga" => valid_dataset_base.merge(
-              "ring" => {
-                ring_name => {
-                  "weight" => 1,
-                  "partitions" => {
-                    range_name => [
-                      "unknown:0/unknown.000",
-                    ],
-                  },
-                },
-              },
-            ),
-          },
-        ),
-        :errors => [
-          Droonga::Catalog::UnknownFarmForPartition.new(
-            "datasets.Droonga.ring.#{ring_name}.partitions.#{range_name}[0]",
-            "unknown:0/unknown.000", path),
-        ],
-      },
-    )
-    def test_validation(data)
-      assert_raise(Droonga::MultiplexError.new(data[:errors])) do
-        create_catalog(data[:catalog], "path/to/catalog")
-      end
-    end
-  end
 end
-------------- next part --------------
HTML����������������������������...
Download 



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