mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
parent
5a9e670c4b
commit
1231d72823
2 changed files with 11 additions and 0 deletions
|
@ -202,6 +202,10 @@ module LogStash module Plugins
|
|||
add_plugin(type, name, klass)
|
||||
end
|
||||
|
||||
def remove(type, plugin_name)
|
||||
@registry.delete(key_for(type, plugin_name))
|
||||
end
|
||||
|
||||
def get(type, plugin_name)
|
||||
@registry[key_for(type, plugin_name)]
|
||||
end
|
||||
|
|
|
@ -61,6 +61,13 @@ describe LogStash::Plugins::Registry do
|
|||
expect(registry.lookup("filter", "simple_plugin")).to eq(simple_plugin)
|
||||
end
|
||||
|
||||
it "should plugin been removed" do
|
||||
registry.add(:filter, "simple_plugin", simple_plugin)
|
||||
expect(registry.lookup("filter", "simple_plugin")).to eq(simple_plugin)
|
||||
registry.remove(:filter, "simple_plugin")
|
||||
expect { registry.lookup("filter", "simple_plugin") }.to raise_error(LoadError)
|
||||
end
|
||||
|
||||
it "doesn't add multiple time the same plugin" do
|
||||
plugin1 = Class.new
|
||||
plugin2 = Class.new
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue