logstash/spec
Cas Donoghue 4a11e9a0e7
Get tests running in FIPS environment (#17096)
* Modify FIPS test runner environment for integration tests

This commit makes two small changes to the dockerfile used to define the fips
test environment. Specifically it adds curl (which is required by integration
tests), make (which is required by test setup), adds a c compiler (gcc and glibc
for integration tests which compile a small c program) and turns off debug ssl
logging as it is extremely noisy in logs and breaking some assumptions in
tests about logfile content.

Closes https://github.com/elastic/ingest-dev/issues/5074

* Do not run test env as root

The elastic stack is not meant to be run as root. This commit updates the test
environment to provision a non root user and have the container context execute
under that providioned user.

Closes https://github.com/elastic/ingest-dev/issues/5088

* Skip unit tests that reach out to rubygems for fips mode

The `update` test setup reaches out to rubygems with net/http which is
incompatible with our use of openssl in fips mode. This commit skips those tests
when running under fips.

See https://github.com/elastic/ingest-dev/issues/5071

* Work around random data request limits in BCFIPS

This commit changes test setup to make chunked calls to random data generation
in order to work around a limit in fips mode.

See https://github.com/elastic/ingest-dev/issues/5072 for details.

* Skip tests validating openssl defaults

Openssl will not be used when running under FIPS mode. The test setup and tests
themselves were failing when running in FIPS mode. This commit skips the tests
that are covering behavior that will be disabled.

See https://github.com/elastic/ingest-dev/issues/5069

* Skip tests that require pluginmanager to install plugins

This commit skips tests that rely on using the pluginmanager to install plugins
during tests which require reaching out to rubygems.

See https://github.com/elastic/ingest-dev/issues/5108

* Skip prepare offline pack integration tests in fips mode

The offline pack tests require on pluginmanager to use net-http library for
resolving deps. This will not operate under fips mode. Skip when running in fips
mode.

See https://github.com/elastic/ingest-dev/issues/5109

* Ensure a gem executible is on path for test setup

This commit modifies the generate-gems script to ensure that a `gem` executable
is on the path. If there is not one on the test runner, then use the one bundled
with vendored jruby.

* Skip webserver specs when running in FIPS mode

This commit skips the existing webserver tests. We have some options and need to
understand some requirements for the webserver functionality for fips mode. The
 https://github.com/elastic/ingest-dev/issues/5110 issue has a ton of details.

* Skip cli `remove` integration tests for FIPS

This commit skips tests that are running `remove` action for the pluginmanager.
These require reaching out to rubygems which is not available in FIPS mode.
These tests were added post initial integration tests scoping work but are
clearly requiring skips for FIPS mode.

* Add openssl package to FIPS testing env container

The setup script for filebeats requires an openssl executable. This commit
updates the testing container with this tool.

See https://github.com/elastic/ingest-dev/issues/5107

* Re-introduce retries for FIPS tests now that we are in a passing state
2025-03-04 10:34:36 -08:00
..
bootstrap Add apache and elastic license headers to source code files (#11673) 2020-03-11 11:53:38 +00:00
compliance Json normalization performance (#16313) 2024-07-09 14:12:21 -07:00
fixtures Enable SpaceAfterColon, SpaceAfterComma, SpaceAfterSemicolon (#15180) 2023-07-14 16:46:35 -04:00
support Rubocop: Enable SpaceAround cops (#15196) 2023-07-18 21:11:57 -04:00
unit Get tests running in FIPS environment (#17096) 2025-03-04 10:34:36 -08:00
README.md Using already existing LOGSTASH_DEBUG env variable to debug + update README 2012-09-14 12:28:29 +02:00
spec_helper.rb Skip offline pack manager tests when running in fips mode (#17160) 2025-02-28 14:22:45 -08:00

How to run these tests

Run one:

rspec spec/the/test.rb

Run them all:

rspec spec/**/*.rb

Debug one test:

LOGSTASH_DEBUG=y rspec spec/the/test.rb