Skip to content

Commit

Permalink
Fix service startup with acceptance tests (#15900) (#15905)
Browse files Browse the repository at this point in the history
This commit fixes the startup of the Logstash service during packaging
tests by adding a minimal pipeline config. Without it, the service was
flapping from start to start and vice versa causing test flakiness.

Relates #15784

(cherry picked from commit b66dc7f)
  • Loading branch information
dliappis authored Feb 6, 2024
1 parent cf3308f commit a6839e0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions qa/acceptance/spec/shared_examples/installed.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
before(:each) do
logstash.uninstall
logstash.install({:version => LOGSTASH_VERSION})
logstash.write_default_pipeline
end

it "is installed on [#{logstash.human_name}]" do
Expand Down
1 change: 1 addition & 0 deletions qa/acceptance/spec/shared_examples/installed_with_jdk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
before(:each) do
logstash.uninstall
logstash.install({:version => LOGSTASH_VERSION})
logstash.write_default_pipeline
end

after(:each) do
Expand Down
5 changes: 5 additions & 0 deletions qa/rspec/commands.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ def install(options={})
client.install(package)
end

def write_default_pipeline()
# defines a minimal pipeline so that the service is able to start
client.write_pipeline("input { heartbeat {} } output { null {} }")
end

def uninstall
client.uninstall(name)
end
Expand Down
4 changes: 4 additions & 0 deletions qa/rspec/commands/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ def download(from, to)
run_command("curl -fsSL --retry 5 --retry-delay 5 #{from} -o #{to}")
end

def write_pipeline(pipeline_string)
run_command("bash -c \"echo '#{pipeline_string}' >/etc/logstash/conf.d/pipeline.conf\"")
end

def delete_file(path)
run_command("rm -rf #{path}")
end
Expand Down

0 comments on commit a6839e0

Please sign in to comment.