From 54677d3ab0785a20b9b806a7c5c970875139d2e8 Mon Sep 17 00:00:00 2001 From: nilsver Date: Thu, 8 Aug 2024 14:44:43 +0100 Subject: [PATCH] fix logstash now when disabled too --- spec/services/logstash_spec.rb | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/spec/services/logstash_spec.rb b/spec/services/logstash_spec.rb index 91d3d79..ca14d9a 100644 --- a/spec/services/logstash_spec.rb +++ b/spec/services/logstash_spec.rb @@ -13,24 +13,11 @@ 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 } @@ -38,9 +25,16 @@ 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 } @@ -48,5 +42,12 @@ 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