Skip to content

Commit

Permalink
Add namespace module not to conflict to other tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tagomoris committed Apr 6, 2016
1 parent 6c6fab2 commit e30b592
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
10 changes: 6 additions & 4 deletions test/plugin/test_base.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
require_relative '../helper'
require 'fluent/plugin/base'

class DummyPlugin < Fluent::Plugin::Base
module FluentPluginBaseTest
class DummyPlugin < Fluent::Plugin::Base
end
end

class BaseTest < Test::Unit::TestCase
setup do
@p = DummyPlugin.new
@p = FluentPluginBaseTest::DummyPlugin.new
end

test 'has methods for phases of plugin life cycle, and methods to know "super"s were correctly called or not' do
Expand Down Expand Up @@ -56,14 +58,14 @@ class BaseTest < Test::Unit::TestCase

test 'is configurable by config_param and config_section' do
assert_nothing_raised do
class DummyPlugin2 < Fluent::Plugin::TestBase
class FluentPluginBaseTest::DummyPlugin2 < Fluent::Plugin::TestBase
config_param :myparam1, :string
config_section :mysection, multi: false do
config_param :myparam2, :integer
end
end
end
p2 = DummyPlugin2.new
p2 = FluentPluginBaseTest::DummyPlugin2.new
assert_nothing_raised do
p2.configure(config_element('ROOT', '', {'myparam1' => 'myvalue1'}, [config_element('mysection', '', {'myparam2' => 99})]))
end
Expand Down
8 changes: 5 additions & 3 deletions test/plugin/test_input.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
require 'fluent/plugin/input'
require 'flexmock/test_unit'

class DummyPlugin < Fluent::Plugin::Input
module FluentPluginInputTest
class DummyPlugin < Fluent::Plugin::Input
end
end

class InputTest < Test::Unit::TestCase
setup do
Fluent::Test.setup
@p = DummyPlugin.new
@p = FluentPluginInputTest::DummyPlugin.new
end

test 'has plugin_id automatically generated' do
Expand Down Expand Up @@ -43,7 +45,7 @@ class InputTest < Test::Unit::TestCase

test 'can load plugin helpers' do
assert_nothing_raised do
class DummyPlugin2 < Fluent::Plugin::Input
class FluentPluginInputTest::DummyPlugin2 < Fluent::Plugin::Input
helpers :storage
end
end
Expand Down
14 changes: 8 additions & 6 deletions test/plugin/test_owned_by.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
require 'fluent/plugin/input'
require 'fluent/plugin/owned_by_mixin'

class DummyParent < Fluent::Plugin::Input
Fluent::Plugin.register_input('dummy_parent', self)
end
class DummyChild < Fluent::Plugin::Base
include Fluent::Plugin::OwnedByMixin
Fluent::Plugin.register_parser('dummy_child', self)
module OwnedByMixinTestEnv
class DummyParent < Fluent::Plugin::Input
Fluent::Plugin.register_input('dummy_parent', self)
end
class DummyChild < Fluent::Plugin::Base
include Fluent::Plugin::OwnedByMixin
Fluent::Plugin.register_parser('dummy_child', self)
end
end

class OwnedByMixinTest < Test::Unit::TestCase
Expand Down

0 comments on commit e30b592

Please sign in to comment.