Skip to content

Commit

Permalink
fix logstash now when disabled too
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsver committed Aug 8, 2024
1 parent 155da31 commit 54677d3
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions spec/services/logstash_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,40 +13,41 @@
HOSTNAME = command('hostname -s').stdout.chomp
PIPELINES_PATH = '/etc/logstash/pipelines.yml'

describe "Checking packages for #{service}..." do
packages.each do |package|
describe package(package) do
before do
skip("#{package} is not installed, skipping...") unless package(package).installed?
end
it 'is expected to be installed' do
expect(package(package).installed?).to be true
end
end
end
end

describe "Checking service status for #{service}..." do
regex = '^- pipeline\.id: .*-pipeline$'
has_pipelines = command("grep --perl-regex '#{regex}' #{PIPELINES_PATH}").stdout
has_pipelines = command("grep --perl-regex '#{regex}' #{PIPELINES_PATH}")

unless has_pipelines
unless has_pipelines.exit_status == 0
describe service(service) do
it { should_not be_enabled }
it { should_not be_running }
end
describe port(port) do
it { should_not be_listening }
end

packages.each do |package|
describe package(package) do
it { should_not be_installed }
end
end

end

if has_pipelines
if has_pipelines.exit_status == 0
describe service(service) do
it { should be_enabled }
it { should be_running }
end
describe port(port) do
it { should be_listening }
end

packages.each do |package|
describe package(package) do
it { should be_installed }
end
end

end
end

0 comments on commit 54677d3

Please sign in to comment.