From a0800ddeae69b6425228e765fbf5a1362517cb3f Mon Sep 17 00:00:00 2001 From: Mario Rodriguez Molins Date: Wed, 23 Jul 2025 16:44:18 +0200 Subject: [PATCH 1/9] Refactor test-check-packages --- scripts/test-check-packages.sh | 74 +++++++++++++++++++++++----------- 1 file changed, 50 insertions(+), 24 deletions(-) diff --git a/scripts/test-check-packages.sh b/scripts/test-check-packages.sh index b0fe929682..8ceed40e6c 100755 --- a/scripts/test-check-packages.sh +++ b/scripts/test-check-packages.sh @@ -90,45 +90,71 @@ fi if [ "${PACKAGE_TEST_TYPE:-other}" == "with-kind" ]; then # Boot up the kind cluster + echo "--- Create kind cluster" kind create cluster --config "$PWD/scripts/kind-config.yaml" --image "kindest/node:${K8S_VERSION}" fi +run_system_benchmark() { + local package_name=$1 + local package_path=$2 + echo "--- Run system benchmarks for package ${package_name}" + elastic-package benchmark system -C "$package_path" --benchmark logs-benchmark -v --defer-cleanup 1s +} + +run_serverless_tests() { + local package_path=$1 + echo "--- Run tests for package ${package_path} in Serverless mode" + local test_options="-v --report-format xUnit --report-output file --defer-cleanup 1s" + local coverage_options="--test-coverage --coverage-format=generic" + # skip system tests + elastic-package test asset -C "$package_path" $test_options $coverage_options + elastic-package test static -C "$package_path" $test_options $coverage_options + # FIXME: adding test-coverage for serverless results in errors like this: + # Error: error running package pipeline tests: could not complete test run: error calculating pipeline coverage: error fetching pipeline stats for code coverage calculations: need exactly one ES node in stats response (got 4) + elastic-package test pipeline -C "$package_path" $test_options +} + +run_pipeline_benchmark() { + local package_name=$1 + local package_path=$2 + echo "--- Run pipeline benchmarks and report for package ${package_name}" + + rm -rf "${PWD}/build/benchmark-results" + elastic-package benchmark pipeline -C "$d" -v --report-format xUnit --report-output file --fail-on-missing + + rm -rf "${PWD}/build/benchmark-results-old" + mv "${PWD}/build/benchmark-results" "${PWD}/build/benchmark-results-old" + + elastic-package benchmark pipeline -C "$d" -v --report-format json --report-output file --fail-on-missing + + elastic-package report -C "$d" --fail-on-missing benchmark \ + --new "${PWD}/build/benchmark-results" \ + --old "${PWD}/build/benchmark-results-old" \ + --threshold 1 --report-output-path="${PWD}/build/benchreport" +} + # Run package tests for d in test/packages/${PACKAGE_TEST_TYPE:-other}/${PACKAGE_UNDER_TEST:-*}/; do package_to_test=$(basename "${d}") if [ "${PACKAGE_TEST_TYPE:-other}" == "benchmarks" ]; then + # FIXME: There are other packages in test/packages/benchmarks folder that are not tested + # It is not used PACKAGE_UNDER_TEST, so all benchmark packages are run in the same loop if [ "${package_to_test}" == "pipeline_benchmark" ]; then - rm -rf "${PWD}/build/benchmark-results" - elastic-package benchmark pipeline -C "$d" -v --report-format xUnit --report-output file --fail-on-missing - - rm -rf "${PWD}/build/benchmark-results-old" - mv "${PWD}/build/benchmark-results" "${PWD}/build/benchmark-results-old" - - elastic-package benchmark pipeline -C "$d" -v --report-format json --report-output file --fail-on-missing - - elastic-package report -C "$d" --fail-on-missing benchmark \ - --new "${PWD}/build/benchmark-results" \ - --old "${PWD}/build/benchmark-results-old" \ - --threshold 1 --report-output-path="${PWD}/build/benchreport" - fi - if [ "${package_to_test}" == "system_benchmark" ]; then - elastic-package benchmark system -C "$d" --benchmark logs-benchmark -v --defer-cleanup 1s + run_pipeline_benchmark "${package_to_test}" "$d" + elif [ "${package_to_test}" == "system_benchmark" ]; then + run_system_benchmark "${package_to_test}" "$d" fi elif [ "${PACKAGE_TEST_TYPE:-other}" == "with-logstash" ] && [ "${package_to_test}" == "system_benchmark" ]; then - elastic-package benchmark system -C "$d" --benchmark logs-benchmark -v --defer-cleanup 1s + run_system_benchmark "${package_to_test}" "$d" else if [[ "${SERVERLESS}" == "true" ]]; then - # skip system tests - elastic-package test asset -C "$d" -v --report-format xUnit --report-output file --defer-cleanup 1s --test-coverage --coverage-format=generic - elastic-package test static -C "$d" -v --report-format xUnit --report-output file --defer-cleanup 1s --test-coverage --coverage-format=generic - # FIXME: adding test-coverage for serverless results in errors like this: - # Error: error running package pipeline tests: could not complete test run: error calculating pipeline coverage: error fetching pipeline stats for code coverage calculations: need exactly one ES node in stats response (got 4) - elastic-package test pipeline -C "$d" -v --report-format xUnit --report-output file --defer-cleanup 1s - - continue + run_serverless_tests "${d}" + continue fi + + echo "--- Run tests for package ${d}" # Run all tests # defer-cleanup is set to a short period to verify that the option is available elastic-package test -C "$d" -v --report-format xUnit --report-output file --defer-cleanup 1s --test-coverage --coverage-format=generic From a4e9a08ed474508485df428323f9abb92802c2cb Mon Sep 17 00:00:00 2001 From: Mario Rodriguez Molins Date: Wed, 23 Jul 2025 16:57:24 +0200 Subject: [PATCH 2/9] Test failure --- scripts/test-check-packages.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/test-check-packages.sh b/scripts/test-check-packages.sh index 8ceed40e6c..c09986a292 100755 --- a/scripts/test-check-packages.sh +++ b/scripts/test-check-packages.sh @@ -118,6 +118,7 @@ run_pipeline_benchmark() { local package_name=$1 local package_path=$2 echo "--- Run pipeline benchmarks and report for package ${package_name}" + ls notexistfile rm -rf "${PWD}/build/benchmark-results" elastic-package benchmark pipeline -C "$d" -v --report-format xUnit --report-output file --fail-on-missing From 7b8ee6a26f131c358b70eb52917a927176e1831f Mon Sep 17 00:00:00 2001 From: Mario Rodriguez Molins Date: Wed, 23 Jul 2025 17:38:22 +0200 Subject: [PATCH 3/9] Add testing for use_pipeline_tests --- scripts/test-check-packages.sh | 93 ++++++++++++++++++---------------- 1 file changed, 50 insertions(+), 43 deletions(-) diff --git a/scripts/test-check-packages.sh b/scripts/test-check-packages.sh index c09986a292..8c71ab6b5f 100755 --- a/scripts/test-check-packages.sh +++ b/scripts/test-check-packages.sh @@ -52,6 +52,47 @@ ELASTIC_PACKAGE_LINKS_FILE_PATH="$(pwd)/scripts/links_table.yml" export ELASTIC_PACKAGE_LINKS_FILE_PATH export SERVERLESS=${SERVERLESS:-"false"} +run_system_benchmark() { + local package_name=$1 + local package_path=$2 + echo "--- Run system benchmarks for package ${package_name}" + elastic-package benchmark system -C "$package_path" --benchmark logs-benchmark -v --defer-cleanup 1s +} + +run_serverless_tests() { + local package_path=$1 + echo "--- Run tests for package ${package_path} in Serverless mode" + local test_options="-v --report-format xUnit --report-output file --defer-cleanup 1s" + local coverage_options="--test-coverage --coverage-format=generic" + # skip system tests + elastic-package test asset -C "$package_path" $test_options $coverage_options + elastic-package test static -C "$package_path" $test_options $coverage_options + # FIXME: adding test-coverage for serverless results in errors like this: + # Error: error running package pipeline tests: could not complete test run: error calculating pipeline coverage: error fetching pipeline stats for code coverage calculations: need exactly one ES node in stats response (got 4) + elastic-package test pipeline -C "$package_path" $test_options +} + +run_pipeline_benchmark() { + local package_name=$1 + local package_path=$2 + echo "--- Run pipeline benchmarks and report for package ${package_name}" + local test_options="-v --report-format xUnit --report-output file --fail-on-missing" + + rm -rf "${PWD}/build/benchmark-results" + elastic-package benchmark pipeline -C "$d" $test_options + + rm -rf "${PWD}/build/benchmark-results-old" + mv "${PWD}/build/benchmark-results" "${PWD}/build/benchmark-results-old" + + elastic-package benchmark pipeline -C "$d" $test_options + + elastic-package report -C "$d" --fail-on-missing benchmark \ + --new "${PWD}/build/benchmark-results" \ + --old "${PWD}/build/benchmark-results-old" \ + --threshold 1 --report-output-path="${PWD}/build/benchreport" +} + + # Build/check packages for d in test/packages/${PACKAGE_TEST_TYPE:-other}/${PACKAGE_UNDER_TEST:-*}/; do elastic-package check -C "$d" -v @@ -94,55 +135,16 @@ if [ "${PACKAGE_TEST_TYPE:-other}" == "with-kind" ]; then kind create cluster --config "$PWD/scripts/kind-config.yaml" --image "kindest/node:${K8S_VERSION}" fi -run_system_benchmark() { - local package_name=$1 - local package_path=$2 - echo "--- Run system benchmarks for package ${package_name}" - elastic-package benchmark system -C "$package_path" --benchmark logs-benchmark -v --defer-cleanup 1s -} - -run_serverless_tests() { - local package_path=$1 - echo "--- Run tests for package ${package_path} in Serverless mode" - local test_options="-v --report-format xUnit --report-output file --defer-cleanup 1s" - local coverage_options="--test-coverage --coverage-format=generic" - # skip system tests - elastic-package test asset -C "$package_path" $test_options $coverage_options - elastic-package test static -C "$package_path" $test_options $coverage_options - # FIXME: adding test-coverage for serverless results in errors like this: - # Error: error running package pipeline tests: could not complete test run: error calculating pipeline coverage: error fetching pipeline stats for code coverage calculations: need exactly one ES node in stats response (got 4) - elastic-package test pipeline -C "$package_path" $test_options -} - -run_pipeline_benchmark() { - local package_name=$1 - local package_path=$2 - echo "--- Run pipeline benchmarks and report for package ${package_name}" - ls notexistfile - - rm -rf "${PWD}/build/benchmark-results" - elastic-package benchmark pipeline -C "$d" -v --report-format xUnit --report-output file --fail-on-missing - - rm -rf "${PWD}/build/benchmark-results-old" - mv "${PWD}/build/benchmark-results" "${PWD}/build/benchmark-results-old" - - elastic-package benchmark pipeline -C "$d" -v --report-format json --report-output file --fail-on-missing - - elastic-package report -C "$d" --fail-on-missing benchmark \ - --new "${PWD}/build/benchmark-results" \ - --old "${PWD}/build/benchmark-results-old" \ - --threshold 1 --report-output-path="${PWD}/build/benchreport" -} - # Run package tests for d in test/packages/${PACKAGE_TEST_TYPE:-other}/${PACKAGE_UNDER_TEST:-*}/; do package_to_test=$(basename "${d}") if [ "${PACKAGE_TEST_TYPE:-other}" == "benchmarks" ]; then - # FIXME: There are other packages in test/packages/benchmarks folder that are not tested + # FIXME: There are other packages in test/packages/benchmarks folder that are not tested like + # use_pipeline_steps and rally_benchmark # It is not used PACKAGE_UNDER_TEST, so all benchmark packages are run in the same loop - if [ "${package_to_test}" == "pipeline_benchmark" ]; then + if [[ "${package_to_test}" == "pipeline_benchmark" || "${package_to_test}" == "use_pipeline_steps" ]]; then run_pipeline_benchmark "${package_to_test}" "$d" elif [ "${package_to_test}" == "system_benchmark" ]; then run_system_benchmark "${package_to_test}" "$d" @@ -158,6 +160,11 @@ for d in test/packages/${PACKAGE_TEST_TYPE:-other}/${PACKAGE_UNDER_TEST:-*}/; do echo "--- Run tests for package ${d}" # Run all tests # defer-cleanup is set to a short period to verify that the option is available - elastic-package test -C "$d" -v --report-format xUnit --report-output file --defer-cleanup 1s --test-coverage --coverage-format=generic + elastic-package test -C "$d" -v \ + --report-format xUnit \ + --report-output file \ + --defer-cleanup 1s \ + --test-coverage \ + --coverage-format=generic fi done From 44365f401d7ea65ef3ce67126f53328233deb5f9 Mon Sep 17 00:00:00 2001 From: Mario Rodriguez Molins Date: Wed, 23 Jul 2025 17:57:56 +0200 Subject: [PATCH 4/9] Fix test package name use_pipeline_tests --- scripts/test-check-packages.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/test-check-packages.sh b/scripts/test-check-packages.sh index 8c71ab6b5f..af2aa2fb0d 100755 --- a/scripts/test-check-packages.sh +++ b/scripts/test-check-packages.sh @@ -144,7 +144,7 @@ for d in test/packages/${PACKAGE_TEST_TYPE:-other}/${PACKAGE_UNDER_TEST:-*}/; do # use_pipeline_steps and rally_benchmark # It is not used PACKAGE_UNDER_TEST, so all benchmark packages are run in the same loop - if [[ "${package_to_test}" == "pipeline_benchmark" || "${package_to_test}" == "use_pipeline_steps" ]]; then + if [[ "${package_to_test}" == "pipeline_benchmark" || "${package_to_test}" == "use_pipeline_tests" ]]; then run_pipeline_benchmark "${package_to_test}" "$d" elif [ "${package_to_test}" == "system_benchmark" ]; then run_system_benchmark "${package_to_test}" "$d" From ccd81541c68b206b808a3ca7241cb2342da8ed65 Mon Sep 17 00:00:00 2001 From: Mario Rodriguez Molins Date: Wed, 23 Jul 2025 18:44:59 +0200 Subject: [PATCH 5/9] Update comment --- scripts/test-check-packages.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/test-check-packages.sh b/scripts/test-check-packages.sh index af2aa2fb0d..198eeb2334 100755 --- a/scripts/test-check-packages.sh +++ b/scripts/test-check-packages.sh @@ -140,10 +140,8 @@ for d in test/packages/${PACKAGE_TEST_TYPE:-other}/${PACKAGE_UNDER_TEST:-*}/; do package_to_test=$(basename "${d}") if [ "${PACKAGE_TEST_TYPE:-other}" == "benchmarks" ]; then - # FIXME: There are other packages in test/packages/benchmarks folder that are not tested like - # use_pipeline_steps and rally_benchmark + # FIXME: There are other packages in test/packages/benchmarks folder that are not tested like rally_benchmark - # It is not used PACKAGE_UNDER_TEST, so all benchmark packages are run in the same loop if [[ "${package_to_test}" == "pipeline_benchmark" || "${package_to_test}" == "use_pipeline_tests" ]]; then run_pipeline_benchmark "${package_to_test}" "$d" elif [ "${package_to_test}" == "system_benchmark" ]; then From 0d415ce85412bb1090e1ee17c4a9e07c378cdca4 Mon Sep 17 00:00:00 2001 From: Mario Rodriguez Molins Date: Wed, 23 Jul 2025 18:49:16 +0200 Subject: [PATCH 6/9] Refactor for loop --- scripts/test-check-packages.sh | 36 +++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/scripts/test-check-packages.sh b/scripts/test-check-packages.sh index 198eeb2334..39376c7e9c 100755 --- a/scripts/test-check-packages.sh +++ b/scripts/test-check-packages.sh @@ -147,22 +147,26 @@ for d in test/packages/${PACKAGE_TEST_TYPE:-other}/${PACKAGE_UNDER_TEST:-*}/; do elif [ "${package_to_test}" == "system_benchmark" ]; then run_system_benchmark "${package_to_test}" "$d" fi - elif [ "${PACKAGE_TEST_TYPE:-other}" == "with-logstash" ] && [ "${package_to_test}" == "system_benchmark" ]; then - run_system_benchmark "${package_to_test}" "$d" - else - if [[ "${SERVERLESS}" == "true" ]]; then - run_serverless_tests "${d}" - continue - fi + continue + fi - echo "--- Run tests for package ${d}" - # Run all tests - # defer-cleanup is set to a short period to verify that the option is available - elastic-package test -C "$d" -v \ - --report-format xUnit \ - --report-output file \ - --defer-cleanup 1s \ - --test-coverage \ - --coverage-format=generic + if [ "${PACKAGE_TEST_TYPE:-other}" == "with-logstash" ] && [ "${package_to_test}" == "system_benchmark" ]; then + run_system_benchmark "${package_to_test}" "$d" + continue fi + + if [[ "${SERVERLESS}" == "true" ]]; then + run_serverless_tests "${d}" + continue + fi + + echo "--- Run tests for package ${d}" + # Run all tests + # defer-cleanup is set to a short period to verify that the option is available + elastic-package test -C "$d" -v \ + --report-format xUnit \ + --report-output file \ + --defer-cleanup 1s \ + --test-coverage \ + --coverage-format=generic done From dd33aee74e92d71d9593ab569c9c575289e9b352 Mon Sep 17 00:00:00 2001 From: Mario Rodriguez Molins Date: Thu, 24 Jul 2025 09:37:43 +0200 Subject: [PATCH 7/9] Replace if by case --- scripts/test-check-packages.sh | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/scripts/test-check-packages.sh b/scripts/test-check-packages.sh index 39376c7e9c..377d747f08 100755 --- a/scripts/test-check-packages.sh +++ b/scripts/test-check-packages.sh @@ -53,14 +53,14 @@ export ELASTIC_PACKAGE_LINKS_FILE_PATH export SERVERLESS=${SERVERLESS:-"false"} run_system_benchmark() { - local package_name=$1 - local package_path=$2 + local package_name="$1" + local package_path="$2" echo "--- Run system benchmarks for package ${package_name}" elastic-package benchmark system -C "$package_path" --benchmark logs-benchmark -v --defer-cleanup 1s } run_serverless_tests() { - local package_path=$1 + local package_path="$1" echo "--- Run tests for package ${package_path} in Serverless mode" local test_options="-v --report-format xUnit --report-output file --defer-cleanup 1s" local coverage_options="--test-coverage --coverage-format=generic" @@ -73,8 +73,8 @@ run_serverless_tests() { } run_pipeline_benchmark() { - local package_name=$1 - local package_path=$2 + local package_name="$1" + local package_path="$2" echo "--- Run pipeline benchmarks and report for package ${package_name}" local test_options="-v --report-format xUnit --report-output file --fail-on-missing" @@ -141,12 +141,14 @@ for d in test/packages/${PACKAGE_TEST_TYPE:-other}/${PACKAGE_UNDER_TEST:-*}/; do if [ "${PACKAGE_TEST_TYPE:-other}" == "benchmarks" ]; then # FIXME: There are other packages in test/packages/benchmarks folder that are not tested like rally_benchmark - - if [[ "${package_to_test}" == "pipeline_benchmark" || "${package_to_test}" == "use_pipeline_tests" ]]; then - run_pipeline_benchmark "${package_to_test}" "$d" - elif [ "${package_to_test}" == "system_benchmark" ]; then - run_system_benchmark "${package_to_test}" "$d" - fi + case "${package_to_test}" in + pipeline_benchmark|use_pipeline_tests) + run_pipeline_benchmark "${package_to_test}" "$d" + ;; + system_benchmark) + run_system_benchmark "${package_to_test}" "$d" + ;; + esac continue fi From 340ae5ae201f0ca0ef282e3295553a0cf038235a Mon Sep 17 00:00:00 2001 From: Mario Rodriguez Molins Date: Thu, 24 Jul 2025 16:57:05 +0200 Subject: [PATCH 8/9] Move echo after defining variables Co-authored-by: Jaime Soriano Pastor --- scripts/test-check-packages.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/test-check-packages.sh b/scripts/test-check-packages.sh index 377d747f08..d7380fbe8f 100755 --- a/scripts/test-check-packages.sh +++ b/scripts/test-check-packages.sh @@ -61,9 +61,9 @@ run_system_benchmark() { run_serverless_tests() { local package_path="$1" - echo "--- Run tests for package ${package_path} in Serverless mode" local test_options="-v --report-format xUnit --report-output file --defer-cleanup 1s" local coverage_options="--test-coverage --coverage-format=generic" + echo "--- Run tests for package ${package_path} in Serverless mode" # skip system tests elastic-package test asset -C "$package_path" $test_options $coverage_options elastic-package test static -C "$package_path" $test_options $coverage_options From 386bc4b07b57f20509849e7cba88b5aeb7d53c6c Mon Sep 17 00:00:00 2001 From: Mario Rodriguez Molins Date: Thu, 24 Jul 2025 17:11:47 +0200 Subject: [PATCH 9/9] Add default values for PACKAGE_UNDER_TEST and PACKAGE_TEST_TYPE --- scripts/test-check-false-positives.sh | 11 ++++++++--- scripts/test-check-packages.sh | 25 +++++++++++++++---------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/scripts/test-check-false-positives.sh b/scripts/test-check-false-positives.sh index f8f0bf0705..f79c3f1c50 100755 --- a/scripts/test-check-false-positives.sh +++ b/scripts/test-check-false-positives.sh @@ -6,17 +6,22 @@ source "${SCRIPT_DIR}/stack_parameters.sh" set -euxo pipefail +# Add default values +export SUFFIX_FOLDER_DUMP_LOGS="${PACKAGE_UNDER_TEST:-${PACKAGE_TEST_TYPE:-any}}" +export PACKAGE_TEST_TYPE="${PACKAGE_TEST_TYPE:-"false_positives"}" +export PACKAGE_UNDER_TEST="${PACKAGE_UNDER_TEST:-*}" + function cleanup() { r=$? # Dump stack logs - elastic-package stack dump -v --output "build/elastic-stack-dump/check-${PACKAGE_UNDER_TEST:-${PACKAGE_TEST_TYPE:-*}}" + elastic-package stack dump -v --output "build/elastic-stack-dump/check-${SUFFIX_FOLDER_DUMP_LOGS}}" # Take down the stack elastic-package stack down -v # Clean used resources - for d in test/packages/${PACKAGE_TEST_TYPE:-false_positives}/${PACKAGE_UNDER_TEST:-*}/; do + for d in test/packages/${PACKAGE_TEST_TYPE}/${PACKAGE_UNDER_TEST}/; do elastic-package clean -C "$d" -v done @@ -107,7 +112,7 @@ elastic-package stack up -d -v ${stack_args} elastic-package stack status # Run package tests -for d in test/packages/${PACKAGE_TEST_TYPE:-false_positives}/${PACKAGE_UNDER_TEST:-*}/; do +for d in test/packages/${PACKAGE_TEST_TYPE}/${PACKAGE_UNDER_TEST}/; do check_build_output "$d" check_expected_errors "$d" done diff --git a/scripts/test-check-packages.sh b/scripts/test-check-packages.sh index d7380fbe8f..122ac582bb 100755 --- a/scripts/test-check-packages.sh +++ b/scripts/test-check-packages.sh @@ -6,14 +6,19 @@ source "${SCRIPT_DIR}/stack_parameters.sh" set -euxo pipefail +# Add default values +export SUFFIX_FOLDER_DUMP_LOGS="${PACKAGE_UNDER_TEST:-${PACKAGE_TEST_TYPE:-any}}" +export PACKAGE_TEST_TYPE="${PACKAGE_TEST_TYPE:-"other"}" +export PACKAGE_UNDER_TEST="${PACKAGE_UNDER_TEST:-*}" + cleanup() { r=$? # Dump stack logs elastic-package stack dump -v \ - --output "build/elastic-stack-dump/check-${PACKAGE_UNDER_TEST:-${PACKAGE_TEST_TYPE:-any}}" + --output "build/elastic-stack-dump/check-${SUFFIX_FOLDER_DUMP_LOGS}" - if [ "${PACKAGE_TEST_TYPE:-other}" == "with-kind" ]; then + if [ "${PACKAGE_TEST_TYPE}" == "with-kind" ]; then # Dump kubectl details kubectl describe pods --all-namespaces > build/kubectl-dump.txt kubectl logs -l app=elastic-agent -n kube-system >> build/kubectl-dump.txt @@ -33,13 +38,13 @@ cleanup() { elastic-package stack down -v fi - if [ "${PACKAGE_TEST_TYPE:-other}" == "with-logstash" ]; then + if [ "${PACKAGE_TEST_TYPE}" == "with-logstash" ]; then # Delete the logstash profile elastic-package profiles delete logstash -v fi # Clean used resources - for d in test/packages/${PACKAGE_TEST_TYPE:-other}/${PACKAGE_UNDER_TEST:-*}/; do + for d in test/packages/${PACKAGE_TEST_TYPE}/${PACKAGE_UNDER_TEST}/; do elastic-package clean -C "$d" -v done @@ -94,11 +99,11 @@ run_pipeline_benchmark() { # Build/check packages -for d in test/packages/${PACKAGE_TEST_TYPE:-other}/${PACKAGE_UNDER_TEST:-*}/; do +for d in test/packages/${PACKAGE_TEST_TYPE}/${PACKAGE_UNDER_TEST}/; do elastic-package check -C "$d" -v done -if [ "${PACKAGE_TEST_TYPE:-other}" == "with-logstash" ]; then +if [ "${PACKAGE_TEST_TYPE}" == "with-logstash" ]; then # Create a logstash profile and use it elastic-package profiles create logstash -v elastic-package profiles use logstash @@ -129,17 +134,17 @@ if [[ "${SERVERLESS}" != "true" ]]; then elastic-package stack status fi -if [ "${PACKAGE_TEST_TYPE:-other}" == "with-kind" ]; then +if [ "${PACKAGE_TEST_TYPE}" == "with-kind" ]; then # Boot up the kind cluster echo "--- Create kind cluster" kind create cluster --config "$PWD/scripts/kind-config.yaml" --image "kindest/node:${K8S_VERSION}" fi # Run package tests -for d in test/packages/${PACKAGE_TEST_TYPE:-other}/${PACKAGE_UNDER_TEST:-*}/; do +for d in test/packages/${PACKAGE_TEST_TYPE}/${PACKAGE_UNDER_TEST}/; do package_to_test=$(basename "${d}") - if [ "${PACKAGE_TEST_TYPE:-other}" == "benchmarks" ]; then + if [ "${PACKAGE_TEST_TYPE}" == "benchmarks" ]; then # FIXME: There are other packages in test/packages/benchmarks folder that are not tested like rally_benchmark case "${package_to_test}" in pipeline_benchmark|use_pipeline_tests) @@ -152,7 +157,7 @@ for d in test/packages/${PACKAGE_TEST_TYPE:-other}/${PACKAGE_UNDER_TEST:-*}/; do continue fi - if [ "${PACKAGE_TEST_TYPE:-other}" == "with-logstash" ] && [ "${package_to_test}" == "system_benchmark" ]; then + if [ "${PACKAGE_TEST_TYPE}" == "with-logstash" ] && [ "${package_to_test}" == "system_benchmark" ]; then run_system_benchmark "${package_to_test}" "$d" continue fi