spec/spec_helper.rb in fluent-plugin-elb-access-log-0.4.4 vs spec/spec_helper.rb in fluent-plugin-elb-access-log-0.5.0

- old
+ new

@@ -1,10 +1,15 @@ require 'coveralls' Coveralls.wear! +require 'fluent/version' require 'fluent/test' -require 'fluent/test/driver/input' + +if Gem::Version.new(Fluent::VERSION) >= Gem::Version.new('0.14') + require 'fluent/test/driver/input' +end + require 'fluent/plugin/in_elb_access_log' require 'aws-sdk-s3' require 'time' require 'timecop' @@ -38,17 +43,30 @@ s3_bucket #{s3_bucket} region #{region} #{additional_options} EOS - Fluent::Test::Driver::Input.new(Fluent::Plugin::ElbAccessLogInput).configure(fluentd_conf) + if Gem::Version.new(Fluent::VERSION) >= Gem::Version.new('0.14') + Fluent::Test::Driver::Input.new(FluentPluginElbAccessLogInput).configure(fluentd_conf) + else + Fluent::Test::OutputTestDriver.new(FluentPluginElbAccessLogInput).configure(fluentd_conf) + end end def driver_run(driver) driver.run do coolio_loop = driver.instance.instance_variable_get(:@loop) sleep 0.1 until coolio_loop.instance_variable_get(:@running) sleep 0.1 + end +end + + +def driver_events + if Gem::Version.new(Fluent::VERSION) >= Gem::Version.new('0.14') + driver.events + else + driver.emits end end def gzip(str) io = StringIO.new