Skip to content

Commit

Permalink
Fix service startup with acceptance tests (elastic#15900)
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 elastic#15784
  • Loading branch information
dliappis authored Feb 6, 2024
1 parent 2fc3f4c commit b66dc7f
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 @@ -23,6 +23,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 @@ -28,6 +28,7 @@
before(:each) do
logstash.uninstall
logstash.install({:bundled_jdk => true, :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 @@ -123,6 +123,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 b66dc7f

Please sign in to comment.