Skip to content

Commit

Permalink
Fix logstash test
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsver committed Aug 7, 2024
1 parent 959a873 commit be46032
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions spec/services/logstash_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,21 @@
end

describe "Checking service status for #{service}..." do
pipelines = command("knife node show #{HOSTNAME} --attribute default.pipelines -F json").stdout.strip
parsed_pipelines = JSON.parse(pipelines)
service_status = command("systemctl is-enabled #{service}").stdout.strip
regex = '^- pipeline\.id: .*-pipeline$'
has_pipelines = command("grep --perl-regex '#{regex}' #{PIPELINES_PATH}").stdout

if parsed_pipelines.empty? || parsed_pipelines.nil?
if !has_pipelines
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
elsif !parsed_pipelines.empty? || !parsed_pipelines.nil?
end

if has_pipelines
describe service(service) do
it { should be_enabled }
it { should be_running }
Expand Down

0 comments on commit be46032

Please sign in to comment.