Skip to content

Commit

Permalink
Skip plugin tests on ls >= 6.7.0
Browse files Browse the repository at this point in the history
The logstash-plugin command changed to require a --installed option and it has to be run from logstash home directory.
  • Loading branch information
Hugo Haakseth authored and h-haaks committed Jul 4, 2022
1 parent 947c7b9 commit e4f624a
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion spec/acceptance/class_plugin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,33 +33,48 @@ def remove(plugin)
end

it 'will not remove it again' do
if Gem::Version.new(LS_VERSION) >= Gem::Version.new('6.7.0')
skip('logstash-plugin changed in logstash 6.7.0. The class does not support these changes.')
end
log = ensure_plugin('absent', 'logstash-input-sqs').stdout
expect(log).not_to contain('remove-logstash-input-sqs')
end

it 'can install it from rubygems' do
if Gem::Version.new(LS_VERSION) >= Gem::Version.new('6.7.0')
skip('logstash-plugin changed in logstash 6.7.0. The class does not support these changes.')
end
ensure_plugin('present', 'logstash-input-sqs')
expect(installed_plugins).to contain('logstash-input-sqs')
end
end

context 'when a plugin is installed' do
it do
if Gem::Version.new(LS_VERSION) >= Gem::Version.new('6.7.0')
skip('logstash-plugin changed in logstash 6.7.0. The class does not support these changes.')
end
expect(installed_plugins).to contain('logstash-input-file')
end

it 'will not install it again' do
if Gem::Version.new(LS_VERSION) >= Gem::Version.new('6.7.0')
skip('logstash-plugin changed in logstash 6.7.0. The class does not support these changes.')
end
log = ensure_plugin('present', 'logstash-input-file').stdout
expect(log).not_to contain('install-logstash-input-file')
end

it 'can remove it' do
if Gem::Version.new(LS_VERSION) >= Gem::Version.new('6.7.0')
skip('logstash-plugin changed in logstash 6.7.0. The class does not support these changes.')
end
ensure_plugin('absent', 'logstash-input-file')
expect(installed_plugins).not_to contain('logstash-input-file')
end
end

if Gem::Version.new(LS_VERSION) >= Gem::Version.new('5.2.0')
if Gem::Version.new(LS_VERSION) < Gem::Version.new('6.2.0') && Gem::Version.new(LS_VERSION) >= Gem::Version.new('5.2.0')
it 'can install x-pack from an https url' do
plugin = 'x-pack'
source = "https://artifacts.elastic.co/downloads/packs/x-pack/x-pack-#{LS_VERSION}.zip"
Expand All @@ -69,20 +84,29 @@ def remove(plugin)
end

it 'can install a plugin from a "puppet://" url' do
if Gem::Version.new(LS_VERSION) >= Gem::Version.new('6.7.0')
skip('logstash-plugin changed in logstash 6.7.0. The class does not support these changes.')
end
plugin = 'logstash-output-cowthink'
source = "puppet:///modules/logstash/#{plugin}-5.0.0.gem"
ensure_plugin('present', plugin, "source => '#{source}'")
expect(installed_plugins).to contain(plugin)
end

it 'can install a plugin from a local gem' do
if Gem::Version.new(LS_VERSION) >= Gem::Version.new('6.7.0')
skip('logstash-plugin changed in logstash 6.7.0. The class does not support these changes.')
end
plugin = 'logstash-output-cowsay'
source = "/tmp/#{plugin}-5.0.0.gem"
ensure_plugin('present', plugin, "source => '#{source}'")
expect(installed_plugins).to contain(plugin)
end

it 'can install a plugin from an offline zip' do
if Gem::Version.new(LS_VERSION) >= Gem::Version.new('6.7.0')
skip('logstash-plugin changed in logstash 6.7.0. The class does not support these changes.')
end
plugin = 'logstash-output-cowsay'
source = "puppet:///modules/logstash/#{plugin}-5.0.0.zip"
ensure_plugin('present', plugin, "source => '#{source}'")
Expand Down

0 comments on commit e4f624a

Please sign in to comment.