[Groonga-commit] droonga/fluent-plugin-droonga at ded1db5 [master] Migrate test for output-records

Back to archive index

YUKI Hiroshi null+****@clear*****
Fri Jan 31 16:17:09 JST 2014


YUKI Hiroshi	2014-01-31 16:17:09 +0900 (Fri, 31 Jan 2014)

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

  Message:
    Migrate test for output-records

  Modified files:
    test/unit/plugin/distributor/test_search_planner.rb

  Modified: test/unit/plugin/distributor/test_search_planner.rb (+71 -0)
===================================================================
--- test/unit/plugin/distributor/test_search_planner.rb    2014-01-31 16:11:47 +0900 (4fc52f8)
+++ test/unit/plugin/distributor/test_search_planner.rb    2014-01-31 16:17:09 +0900 (ead9d8b)
@@ -340,6 +340,77 @@ class DistributedSearchPlannerTest < Test::Unit::TestCase
                        gather_message["body"]["users_reduced"])
         end
       end
+
+      class RecordsTest < self
+        def setup
+          @request = {
+            "type" => "search",
+            "dataset" => "Droonga",
+            "body" => {
+              "queries" => {
+                "users" => {
+                  "source" => "User",
+                  "output" => {
+                    "elements" => ["records"],
+                    "attributes" => ["_key", "name", "age"],
+                    "limit" => 1,
+                  },
+                },
+              },
+            },
+          }
+        end
+
+        def test_dependencies
+          reduce_inputs = ["errors", "users"]
+          gather_inputs = ["errors_reduced", "users_reduced"]
+          assert_equal(expected_dependencies(reduce_inputs, gather_inputs),
+                       dependencies)
+        end
+
+        def test_broadcast_message
+          assert_valid_broadcast_message
+          assert_equal({
+                         "queries" => {
+                           "users" => {
+                             "output" => {
+                               "elements" => ["records"],
+                               "attributes" => ["_key", "name", "age"],
+                               "limit" => 1,
+                             },
+                             "source" => "User",
+                           },
+                         },
+                       },
+                       broadcast_message["body"])
+        end
+
+        def test_reduce_body
+          assert_equal({
+                         "users_reduced" => {
+                           "records" => {
+                             "type" => "sort",
+                             "operators" => [],
+                             "limit" => 1,
+                           },
+                         },
+                       },
+                       reduce_message["body"]["users"])
+        end
+
+        def test_gather_body
+          assert_equal({
+                       "elements" => {
+                         "records" => {
+                           "attributes" => ["_key", "name", "age"],
+                           "limit"      => 1,
+                         },
+                       },
+                         "output" => "users",
+                       },
+                       gather_message["body"]["users_reduced"])
+        end
+      end
     end
 
     class FormatTest < self
-------------- next part --------------
HTML����������������������������...
Download 



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