Kentaro Hayashi
null+****@clear*****
Wed Apr 12 15:05:49 JST 2017
Kentaro Hayashi 2017-04-12 15:05:49 +0900 (Wed, 12 Apr 2017) New Revision: 1c1fb968d775b56bc585ea6691314685f98bce68 https://github.com/groonga/fluent-plugin-groonga/commit/1c1fb968d775b56bc585ea6691314685f98bce68 Merged 7e67b6a: Merge pull request #13 from groonga/use-test-helpers Message: test: use event_time helper for v0.14 TODO: need feedback to fluentd because Fluent::Test::InputTestDriver doesn't include Fluent::Test::Helpers to use assert_equal_event_time. Modified files: test/test_input.rb test/test_output.rb Modified: test/test_input.rb (+4 -1) =================================================================== --- test/test_input.rb 2017-04-12 14:41:53 +0900 (a6b5f89) +++ test/test_input.rb 2017-04-12 15:05:49 +0900 (ed87411) @@ -22,15 +22,18 @@ require "webrick/config" require "webrick/httpresponse" require "fluent/test" +require "fluent/test/helpers" require "fluent/plugin/in_groonga" require "http_parser" class GroongaInputTest < Test::Unit::TestCase + include Fluent::Test::Helpers + setup :before => :append def setup_fluent Fluent::Test.setup - @now = Time.parse("2012-10-26T08:45:42Z").to_i + @now = event_time("2012-10-26T08:45:42Z") Fluent::Engine.now = @now end Modified: test/test_output.rb (+7 -4) =================================================================== --- test/test_output.rb 2017-04-12 14:41:53 +0900 (e0d85ca) +++ test/test_output.rb 2017-04-12 15:05:49 +0900 (94fe9df) @@ -22,11 +22,14 @@ require "webrick/config" require "webrick/httpresponse" require "fluent/test" +require "fluent/test/helpers" require "fluent/plugin/out_groonga" require "http_parser" class GroongaOutputTest < Test::Unit::TestCase + include Fluent::Test::Helpers + setup :before => :append def setup_fluent Fluent::Test.setup @@ -99,7 +102,7 @@ EOC def test_basic_command @response_body = JSON.generate([[0, 0.0, 0.0], true]) driver = create_driver("groonga.command.table_create") - time = Time.parse("2012-10-26T08:45:42Z").to_i + time = event_time("2012-10-26T08:45:42Z") driver.emit({"name" => "Users"}, time) driver.run assert_equal("/d/table_create?name=Users", @@ -118,7 +121,7 @@ EOC def test_one_message @response_body = JSON.generate([[0, 0.0, 0.0], [1]]) driver = create_driver("log") - time = Time.parse("2012-10-26T08:45:42Z").to_i + time = event_time("2012-10-26T08:45:42Z") driver.emit({"message" => "1st message"}, time) driver.run assert_equal("/d/load?table=Logs", @@ -130,7 +133,7 @@ EOC def test_multiple_messages @response_body = JSON.generate([[0, 0.0, 0.0], [2]]) driver = create_driver("log") - time = Time.parse("2012-10-26T08:45:42Z").to_i + time = event_time("2012-10-26T08:45:42Z") driver.emit({"message" => "1st message"}, time) driver.emit({"message" => "2nd message"}, time + 1) driver.run @@ -230,7 +233,7 @@ EOC class CommandTest < self def test_basic_command driver = create_driver("groonga.command.table_create") - time = Time.parse("2012-10-26T08:45:42Z").to_i + time = event_time("2012-10-26T08:45:42Z") driver.emit({"name" => "Users"}, time) driver.run assert_equal([ -------------- next part -------------- HTML����������������������������... Télécharger