logstash/qa/docker/shared_examples/container_config.rb
Rob Bavey 2788e87a8c
Docker integration tests stability improvements (#13014)
* Docker integration tests stability improvements

This commit contains numerous fixes to improve the stability of the docker integration tests

* Patch Excon::UnixSocket

Socket.new running on arm64 on Ubuntu 18.04, causes an immediate SIGSEGV error and crash on
that OS, and, as far as I can tell, only that OS. `TCPSocket.new`,`UDPSocket.new` and
`UNIXSocket.new` do not. This commit patches the UnixSocket of the Excon library to
do the absolute simplest thing possible to avoid this error.

* Ensure that container is deleted even if #kill fails

* Add extra waits to handle the incremental way the payload returned by the monitoring
API increases as logstash starts up and pipelines load.

* Use pyenv to ensure the same version of python is used across different jenkins workers

* Add container logs to help diagnose failed test.

* Update the pipeline definition on multi-pipeline integration test

This was causing a pipeline to halt after startup causing intermittent test failures.

* Remove `;` to ensure failures are propagated appropriately

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
2021-11-23 23:17:42 -05:00

41 lines
No EOL
1.7 KiB
Ruby

shared_examples_for 'it runs with different configurations' do |flavor|
before do
@image = find_image(flavor)
@container = start_container(@image, options)
end
after do
cleanup_container(@container)
end
context 'when a single pipeline is configured via volume bind' do
let(:options) { {"HostConfig" => { "Binds" => ["#{FIXTURES_DIR}/simple_pipeline/:/usr/share/logstash/pipeline/"] } } }
it 'should show the stats for that pipeline' do
wait_for_pipeline(@container)
expect(get_plugin_info(@container, 'inputs', 'simple_pipeline')).not_to be nil
end
end
context 'when multiple pipelines are configured via volume bind' do
let(:options) { {"HostConfig" => { "Binds" => ["#{FIXTURES_DIR}/multiple_pipelines/pipelines/:/usr/share/logstash/pipeline/",
"#{FIXTURES_DIR}/multiple_pipelines/config/pipelines.yml:/usr/share/logstash/config/pipelines.yml"] } } }
it "should show stats for both pipelines" do
wait_for_pipeline(@container, 'pipeline_one')
wait_for_pipeline(@container, 'pipeline_two')
expect(get_plugin_info(@container, 'inputs', 'multi_pipeline1', 'pipeline_one')).not_to be nil
expect(get_plugin_info(@container, 'inputs', 'multi_pipeline2', 'pipeline_two')).not_to be nil
end
end
context 'when a custom `logstash.yml` is configured via volume bind' do
let(:options) { {"HostConfig" => { "Binds" => ["#{FIXTURES_DIR}/custom_logstash_yml/logstash.yml:/usr/share/logstash/config/logstash.yml"] } } }
it 'should change the value of pipeline.batch.size' do
wait_for_pipeline(@container)
expect(get_pipeline_setting(@container, 'batch_size')).to eq 200
end
end
end