Navigation Menu

Skip to content

Commit

Permalink
test: use event_time helper for v0.14
Browse files Browse the repository at this point in the history
TODO: need feedback to fluentd because Fluent::Test::InputTestDriver
doesn't include Fluent::Test::Helpers to use assert_equal_event_time.
  • Loading branch information
kenhys committed Apr 12, 2017
1 parent 75211d0 commit 1c1fb96
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
5 changes: 4 additions & 1 deletion test/test_input.rb
Expand Up @@ -22,15 +22,18 @@
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

Expand Down
11 changes: 7 additions & 4 deletions test/test_output.rb
Expand Up @@ -22,11 +22,14 @@
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
Expand Down Expand Up @@ -99,7 +102,7 @@ class CommandTest < self
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",
Expand All @@ -118,7 +121,7 @@ def configuration
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",
Expand All @@ -130,7 +133,7 @@ def test_one_message
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
Expand Down Expand Up @@ -230,7 +233,7 @@ def actual_output_fd
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([
Expand Down

0 comments on commit 1c1fb96

Please sign in to comment.