[Groonga-commit] groonga/fluent-plugin-groonga at 026a3b1 [master] Support command_format option

Back to archive index

Yasuhiro Horimoto null+****@clear*****
Mon Jan 15 15:39:27 JST 2018


Yasuhiro Horimoto	2018-01-15 15:39:27 +0900 (Mon, 15 Jan 2018)

  New Revision: 026a3b1e28ec9b2a39a22aaca1094671e1dec187
  https://github.com/groonga/fluent-plugin-groonga/commit/026a3b1e28ec9b2a39a22aaca1094671e1dec187

  Merged 6b83da9: Merge pull request #22 from komainu8/add_new_command_format

  Message:
    Support command_format option
    
    Support "command_format" option.
    When setting "command_format record" option
    send command which with fixed tag from "in_groonga".

  Modified files:
    lib/fluent/plugin/out_groonga.rb
    test/test_output.rb

  Modified: lib/fluent/plugin/out_groonga.rb (+4 -0)
===================================================================
--- lib/fluent/plugin/out_groonga.rb    2018-01-15 15:19:16 +0900 (c303868)
+++ lib/fluent/plugin/out_groonga.rb    2018-01-15 15:39:27 +0900 (f7fdcf0)
@@ -586,6 +586,10 @@ module Fluent
                 records.clear
               end
               @client.execute(name, record)
+            elsif tag == "groonga.command"
+              name = record["name"]
+              arguments = record["arguments"]
+              @client.execute(name, arguments)
             else
               records << record
             end

  Modified: test/test_output.rb (+30 -0)
===================================================================
--- test/test_output.rb    2018-01-15 15:19:16 +0900 (c6ec6fd)
+++ test/test_output.rb    2018-01-15 15:39:27 +0900 (124ae79)
@@ -102,6 +102,17 @@ EOC
         assert_equal("/d/table_create?name=Users",
                      @request_parser.request_url)
       end
+
+      def test_basic_command_with_command_format_record
+        @response_body = JSON.generate([[0, 0.0, 0.0], true])
+        driver = create_driver
+        time = event_time("2012-10-26T08:45:42Z")
+        driver.run(default_tag: "groonga.command") do
+          driver.feed(time, {"name" => "table_create", "arguments" => {"name" => "Users"}})
+        end
+        assert_equal("/d/table_create?name=Users",
+                     @request_parser.request_url)
+      end
     end
 
     class StoreTest < self
@@ -246,6 +257,25 @@ EOC
                        actual_input,
                      ])
       end
+      def test_basic_command_with_command_format_record
+        driver = create_driver
+        time = event_time("2012-10-26T08:45:42Z")
+        driver.run(default_tag: "groonga.command") do
+          driver.feed(time, {"name" => "table_create", "arguments" => {"name" => "Users"}})
+        end
+        assert_equal([
+                       [
+                         "--input-fd", actual_input_fd,
+                         "--output-fd", actual_output_fd,
+                         "-n", @database_path,
+                       ],
+                       "/d/table_create?name=Users\n",
+                     ],
+                     [
+                       actual_command_line,
+                       actual_input,
+                     ])
+      end
     end
   end
 end
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180115/0031509e/attachment-0001.htm 



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