logstash/ci/integration_tests.sh
mergify[bot] 70b99246d7
Shareable function for partitioning integration tests (#17223) (#17304)
For the fedramp high work https://github.com/elastic/logstash/pull/17038/files a
use case for multiple scripts consuming the partitioning functionality emerged.
As we look to more advanced partitioning we want to ensure that the
functionality will be consumable from multiple scripts.

See https://github.com/elastic/logstash/pull/17219#issuecomment-2698650296

(cherry picked from commit d916972877)

Co-authored-by: Cas Donoghue <cas.donoghue@gmail.com>
2025-03-12 11:18:31 -07:00

42 lines
1.5 KiB
Bash
Executable file

#!/bin/bash -ie
#Note - ensure that the -e flag is set to properly set the $? status if any command fails
# Since we are using the system jruby, we need to make sure our jvm process
# uses at least 1g of memory, If we don't do this we can get OOM issues when
# installing gems. See https://github.com/elastic/logstash/issues/5179
export JRUBY_OPTS="-J-Xmx1g"
export GRADLE_OPTS="-Xmx4g -Dorg.gradle.jvmargs=-Xmx4g -Dorg.gradle.daemon=false -Dorg.gradle.logging.level=info -Dfile.encoding=UTF-8"
export SPEC_OPTS="--order rand --format documentation"
export CI=true
export OSS=true
# Source shared function for splitting integration tests
source "$(dirname "${BASH_SOURCE[0]}")/get-test-half.sh"
if [ -n "$BUILD_JAVA_HOME" ]; then
GRADLE_OPTS="$GRADLE_OPTS -Dorg.gradle.java.home=$BUILD_JAVA_HOME"
fi
if [[ $1 = "setup" ]]; then
echo "Setup only, no tests will be run"
exit 0
elif [[ $1 == "split" ]]; then
if [[ $2 =~ ^[01]$ ]]; then
specs=$(get_test_half "$2")
echo "Running half $2 of integration specs: $specs"
./gradlew runIntegrationTests -PrubyIntegrationSpecs="$specs" --console=plain
else
echo "Error, must specify 0 or 1 after the split. For example ci/integration_tests.sh split 0"
exit 1
fi
elif [[ ! -z $@ ]]; then
echo "Running integration tests 'rspec $@'"
./gradlew runIntegrationTests -PrubyIntegrationSpecs="$@" --console=plain
else
echo "Running all integration tests"
./gradlew runIntegrationTests --console=plain
fi