test/helper.rb in fluentd-0.14.0 vs test/helper.rb in fluentd-0.14.1
- old
+ new
@@ -40,10 +40,11 @@
require 'test/unit/rr'
require 'fileutils'
require 'fluent/config/element'
require 'fluent/log'
require 'fluent/test'
+require 'fluent/test/helpers'
require 'fluent/plugin/base'
require 'fluent/log'
require 'fluent/plugin_id'
require 'fluent/plugin_helper'
require 'fluent/msgpack_factory'
@@ -65,33 +66,10 @@
unless defined?(Test::Unit::AssertionFailedError)
class Test::Unit::AssertionFailedError < StandardError
end
end
-def config_element(name = 'test', argument = '', params = {}, elements = [])
- Fluent::Config::Element.new(name, argument, params, elements)
-end
-
-def event_time(str=nil)
- if str
- Fluent::EventTime.parse(str)
- else
- Fluent::EventTime.now
- end
-end
-
-def msgpack(type)
- case type
- when :factory
- Fluent::MessagePackFactory.factory
- when :packer
- Fluent::MessagePackFactory.packer
- when :unpacker
- Fluent::MessagePackFactory.unpacker
- else
- raise ArgumentError, "unknown msgpack object type '#{type}'"
- end
-end
+include Fluent::Test::Helpers
def unused_port(num = 1)
ports = []
sockets = []
num.times do