[Groonga-commit] droonga/fluent-plugin-droonga at 369e33f [master] Add tests for gathering phase about offset and limit

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Nov 28 16:52:18 JST 2013


YUKI Hiroshi	2013-11-28 16:52:18 +0900 (Thu, 28 Nov 2013)

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

  Message:
    Add tests for gathering phase about offset and limit

  Modified files:
    test/unit/plugin/collector/test_basic.rb

  Modified: test/unit/plugin/collector/test_basic.rb (+75 -2)
===================================================================
--- test/unit/plugin/collector/test_basic.rb    2013-11-28 16:49:46 +0900 (5e736b3)
+++ test/unit/plugin/collector/test_basic.rb    2013-11-28 16:52:18 +0900 (0295a2e)
@@ -63,7 +63,7 @@ class BasicCollectorTest < Test::Unit::TestCase
         },
         "id" => nil,
         "value" => {
-          "count" => 0,
+          "count" => 3,
           "records" => [
             create_record(0),
             create_record(1),
@@ -77,7 +77,7 @@ class BasicCollectorTest < Test::Unit::TestCase
       }
       @plugin.process("collector_gather", request)
       gathered = {
-        "count" => 0,
+        "count" => 3,
         "records" => [
           create_record(0),
           create_record(1),
@@ -86,6 +86,79 @@ class BasicCollectorTest < Test::Unit::TestCase
       }
       assert_equal([gathered, "search_result"], @messages.last)
     end
+
+    def test_offset_and_limit
+      request = {
+        "task" => {
+          "values" => nil,
+          "component" => {
+            "body" => nil,
+            "outputs" => nil,
+          },
+        },
+        "id" => nil,
+        "value" => {
+          "count" => 3,
+          "records" => [
+            create_record(0),
+            create_record(1),
+            create_record(2),
+          ],
+        },
+        "name" => {
+          "output" => "search_result",
+          "element" => "records",
+          "offset" => 1,
+          "limit" => 1,
+        },
+        "descendants" => nil,
+      }
+      @plugin.process("collector_gather", request)
+      gathered = {
+        "count" => 3,
+        "records" => [
+          create_record(1),
+        ],
+      }
+      assert_equal([gathered, "search_result"], @messages.last)
+    end
+
+    def test_offset_and_unlimited_limit
+      request = {
+        "task" => {
+          "values" => nil,
+          "component" => {
+            "body" => nil,
+            "outputs" => nil,
+          },
+        },
+        "id" => nil,
+        "value" => {
+          "count" => 3,
+          "records" => [
+            create_record(0),
+            create_record(1),
+            create_record(2),
+          ],
+        },
+        "name" => {
+          "output" => "search_result",
+          "element" => "records",
+          "offset" => 1,
+          "limit" => -1,
+        },
+        "descendants" => nil,
+      }
+      @plugin.process("collector_gather", request)
+      gathered = {
+        "count" => 3,
+        "records" => [
+          create_record(1),
+          create_record(2),
+        ],
+      }
+      assert_equal([gathered, "search_result"], @messages.last)
+    end
   end
 
   class ReduceTest < self
-------------- next part --------------
HTML����������������������������...
다운로드 



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