mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
validate plugin list output respecting integration plugins
Fixes #11240
This commit is contained in:
parent
2d868cfb65
commit
0a89c4cee2
1 changed files with 20 additions and 2 deletions
|
@ -13,6 +13,9 @@ shared_examples "logstash list" do |logstash|
|
|||
logstash.uninstall
|
||||
end
|
||||
|
||||
let(:plugin_name) { /logstash-(?<type>\w+)-(?<name>\w+)/ }
|
||||
let(:plugin_name_with_version) { /#{plugin_name}\s\(\d+\.\d+.\d+(.\w+)?\)/ }
|
||||
|
||||
context "without a specific plugin" do
|
||||
it "display a list of plugins" do
|
||||
result = logstash.run_command_in_path("bin/logstash-plugin list")
|
||||
|
@ -26,8 +29,23 @@ shared_examples "logstash list" do |logstash|
|
|||
|
||||
it "list the plugins with their versions" do
|
||||
result = logstash.run_command_in_path("bin/logstash-plugin list --verbose")
|
||||
result.stdout.split("\n").each do |plugin|
|
||||
expect(plugin).to match(/^logstash-\w+-\w+\s\(\d+\.\d+.\d+(.\w+)?\)/)
|
||||
|
||||
stdout = StringIO.new(result.stdout)
|
||||
while line = stdout.gets
|
||||
expect(line).to match(/^#{plugin_name_with_version}$/)
|
||||
|
||||
# Integration Plugins list their sub-plugins, e.g.,
|
||||
# ~~~
|
||||
# logstash-integration-kafka (10.0.0)
|
||||
# ├── logstash-input-kafka
|
||||
# └── logstash-output-kafka
|
||||
# ~~~
|
||||
if Regexp.last_match[:type] == 'integration'
|
||||
while line = stdout.gets
|
||||
expect(line).to match(/^(?: [├└]── )#{plugin_name}$/)
|
||||
break if line.start_with?(' └')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue