Fix service startup with acceptance tests (#15900) (#15904)

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 https://github.com/elastic/logstash/issues/15784

(cherry picked from commit b66dc7f460)

Co-authored-by: Dimitrios Liappis <dimitrios.liappis@gmail.com>
This commit is contained in:
github-actions[bot] 2024-02-06 18:06:58 +02:00 committed by GitHub
parent 283d02ffb5
commit bdbd811d3e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 11 additions and 0 deletions

View file

@ -23,6 +23,7 @@ RSpec.shared_examples "installable" do |logstash|
before(:each) do
logstash.uninstall
logstash.install({:version => LOGSTASH_VERSION})
logstash.write_default_pipeline
end
it "is installed on [#{logstash.human_name}]" do

View file

@ -28,6 +28,7 @@ RSpec.shared_examples "installable_with_jdk" do |logstash|
before(:each) do
logstash.uninstall
logstash.install({:bundled_jdk => true, :version => LOGSTASH_VERSION})
logstash.write_default_pipeline
end
after(:each) do

View file

@ -135,6 +135,11 @@ module ServiceTester
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

View file

@ -123,6 +123,10 @@ module ServiceTester
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