validate plugin list output respecting integration plugins

Fixes #11240
This commit is contained in:
Ry Biesemeyer 2019-10-18 00:26:54 +00:00 committed by João Duarte
parent 2d868cfb65
commit 0a89c4cee2

View file

@ -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