From 55b75dcc520a62323ab3b29188f0b483ba8ec248 Mon Sep 17 00:00:00 2001 From: girodav <1390902+girodav@users.noreply.github.com> Date: Tue, 28 Oct 2025 14:10:42 +0000 Subject: [PATCH 01/33] Add interactive mode to demo.sh and test folder --- .env | 1 + .gitignore | 3 +++ demo.sh | 49 +++++++++++++++++++++++------------- test/elastic/bootstrap.sh | 3 +++ test/elastic/example_test.sh | 5 ++++ 5 files changed, 44 insertions(+), 17 deletions(-) create mode 100755 test/elastic/bootstrap.sh create mode 100755 test/elastic/example_test.sh diff --git a/.env b/.env index 6856bac573..38e698ceaf 100644 --- a/.env +++ b/.env @@ -177,3 +177,4 @@ JAEGER_GRPC_PORT=4317 PROMETHEUS_PORT=9090 PROMETHEUS_HOST=prometheus PROMETHEUS_ADDR=${PROMETHEUS_HOST}:${PROMETHEUS_PORT} +BASHUNIT_BOOTSTRAP=test/elastic/bootstrap.sh diff --git a/.gitignore b/.gitignore index 4dacf35195..7ab4ee42e8 100644 --- a/.gitignore +++ b/.gitignore @@ -53,3 +53,6 @@ test/tracetesting/tracetesting-vars.yaml *.apk !src/currency/build + +#Bash unit +lib/ diff --git a/demo.sh b/demo.sh index 24a9a0de11..b7d50cdf79 100755 --- a/demo.sh +++ b/demo.sh @@ -33,13 +33,39 @@ elasticsearch_endpoint="" elasticsearch_api_key="" usage() { - echo "Usage: $0 [cloud-hosted|serverless] [docker|k8s] | destroy [docker|k8s]" + echo "Run the script with no arguments. This will start an interactive prompt that will guide you through the setup of the Elastic OpenTelemetry Demo." + echo + echo "To destroy the demo, run: $0 destroy [docker|k8s]" + echo " - pass 'docker' or 'k8s' to destroy only that platform" + echo " - omit the platform to destroy both docker and k8s resources" exit 1 } parse_args() { if [ $# -eq 0 ]; then - usage + + while true; do + echo + printf "❓ Which Elasticsearch deployment type do you want to send the data into? [serverless/cloud-hosted]? " + read -r deployment_type + deployment_type=${deployment_type} + case "$deployment_type" in + cloud-hosted|serverless) break ;; + *) echo "Please enter 'cloud-hosted' or 'serverless'." ;; + esac + done + + while true; do + echo + printf "❓ In which environment the demo should be deployed? [docker/k8s]?" + read -r platform + platform=${platform} + case "$platform" in + docker|k8s) break ;; + *) echo "Please enter 'docker' or 'k8s'." ;; + esac + done + return fi if [ "$1" = "destroy" ]; then @@ -49,11 +75,7 @@ parse_args() { fi return fi - - deployment_type="$1" - if [ $# -ge 2 ]; then - platform="$2" - fi + usage } update_env_var() { @@ -190,12 +212,12 @@ destroy_k8s() { } main() { - parse_args "$@" - echo '----------------------------------------------------' echo '🚀 OpenTelemetry Demo with Elastic Observability' echo '----------------------------------------------------' + parse_args "$@" + if [ "$destroy" = "true" ]; then if [ -z "$platform" ]; then echo "⌛️ Destroying Docker and Kubernetes resources..." @@ -222,14 +244,7 @@ main() { usage fi - if [ "$deployment_type" != "cloud-hosted" ] && [ "$deployment_type" != "serverless" ]; then - usage - fi - - if [ "$platform" != "docker" ] && [ "$platform" != "k8s" ]; then - usage - fi - + echo echo "⌛️ Starting OTel Demo + EDOT on '$platform' → Elastic ($deployment_type)..." echo if [ "$platform" = "docker" ]; then diff --git a/test/elastic/bootstrap.sh b/test/elastic/bootstrap.sh new file mode 100755 index 0000000000..b4e19022a3 --- /dev/null +++ b/test/elastic/bootstrap.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -euo pipefail +# Place your common test setup here diff --git a/test/elastic/example_test.sh b/test/elastic/example_test.sh new file mode 100755 index 0000000000..a30c96a0a2 --- /dev/null +++ b/test/elastic/example_test.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +function test_bashunit_is_installed() { + assert_same "bashunit is installed" "bashunit is installed" +} From 176cc420c259e1ac3510105e2e2700571ae2f2dd Mon Sep 17 00:00:00 2001 From: girodav <1390902+girodav@users.noreply.github.com> Date: Thu, 30 Oct 2025 16:22:27 +0000 Subject: [PATCH 02/33] Add basic tests and github workflow --- .env.bashunit | 2 ++ .github/workflows/elastic-tests.yml | 28 +++++++++++++++++ test/elastic/basic_docker_test.sh | 25 +++++++++++++++ test/elastic/basic_k8s_test.sh | 21 +++++++++++++ test/elastic/bootstrap.sh | 5 +++ test/elastic/example_test.sh | 5 --- test/elastic/utils.sh | 49 +++++++++++++++++++++++++++++ 7 files changed, 130 insertions(+), 5 deletions(-) create mode 100644 .env.bashunit create mode 100644 .github/workflows/elastic-tests.yml create mode 100755 test/elastic/basic_docker_test.sh create mode 100755 test/elastic/basic_k8s_test.sh delete mode 100755 test/elastic/example_test.sh create mode 100644 test/elastic/utils.sh diff --git a/.env.bashunit b/.env.bashunit new file mode 100644 index 0000000000..d94f5d226e --- /dev/null +++ b/.env.bashunit @@ -0,0 +1,2 @@ +BASHUNIT_DEFAULT_PATH=test/elastic +BASHUNIT_BOOTSTRAP="${BASHUNIT_DEFAULT_PATH}/bootstrap.sh" \ No newline at end of file diff --git a/.github/workflows/elastic-tests.yml b/.github/workflows/elastic-tests.yml new file mode 100644 index 0000000000..88822ff72b --- /dev/null +++ b/.github/workflows/elastic-tests.yml @@ -0,0 +1,28 @@ +name: Elastic Demo Tests + +on: + pull_request: + types: [opened, synchronize, reopened] + push: + paths-ignore: + - '.githubREADME.md' + +jobs: + test: + name: Test + runs-on: ubuntu-latest + + strategy: + fail-fast: false + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install bashunit + run: | + curl -s https://bashunit.typeddevs.com/install.sh | bash + + - name: Run the tests + run: | + ./lib/bashunit --env .env.bashunit \ No newline at end of file diff --git a/test/elastic/basic_docker_test.sh b/test/elastic/basic_docker_test.sh new file mode 100755 index 0000000000..c96455a959 --- /dev/null +++ b/test/elastic/basic_docker_test.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +set -e -o pipefail + +source "${CURRENT_DIR}/test/elastic/utils.sh" + + +function set_up_before_script() { + start_local_elastic_stack +} + +function tear_down_after_script() { + uninstall_local_elastic_stack +} + +function test_launch_demo_docker() { + result=$(launch_demo "cloud-hosted" "docker") + assert_false "$result" +} + +function test_destroy_demo_docker() { + result=$(destroy_demo "docker") + assert_false "$result" +} + diff --git a/test/elastic/basic_k8s_test.sh b/test/elastic/basic_k8s_test.sh new file mode 100755 index 0000000000..e74ce491ae --- /dev/null +++ b/test/elastic/basic_k8s_test.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +set -e -o pipefail + +source "${CURRENT_DIR}/test/elastic/utils.sh" + + +function set_up_before_script() { + start_local_elastic_stack +} + +function tear_down_after_script() { + uninstall_local_elastic_stack +} + +function test_demo_k8s() { + # result=$(launch_demo "cloud-hosted" "k8s") + # assert_false "$result" + assert_true true +} + diff --git a/test/elastic/bootstrap.sh b/test/elastic/bootstrap.sh index b4e19022a3..fc4d89c6ee 100755 --- a/test/elastic/bootstrap.sh +++ b/test/elastic/bootstrap.sh @@ -1,3 +1,8 @@ #!/usr/bin/env bash set -euo pipefail # Place your common test setup here + +CURRENT_DIR=$(pwd) +START_LOCAL_DIR="${CURRENT_DIR}/elastic-start-local" +START_LOCAL_ENV_PATH="${START_LOCAL_DIR}/.env" +START_LOCAL_UNINSTALL_FILE="${START_LOCAL_DIR}/uninstall.sh" \ No newline at end of file diff --git a/test/elastic/example_test.sh b/test/elastic/example_test.sh deleted file mode 100755 index a30c96a0a2..0000000000 --- a/test/elastic/example_test.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -function test_bashunit_is_installed() { - assert_same "bashunit is installed" "bashunit is installed" -} diff --git a/test/elastic/utils.sh b/test/elastic/utils.sh new file mode 100644 index 0000000000..c92a6c2979 --- /dev/null +++ b/test/elastic/utils.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash + +set -e -o pipefail + +# Returns the HTTP status code from a call +# usage: get_http_response_code url username password +function get_http_response_code() { + url=$1 + if [ -z "$url" ]; then + echo "Error: you need to specify the URL for get the HTTP response" + exit 1 + fi + username=$2 + password=$3 + + if [ -z "$username" ] || [ -z "$password" ]; then + result=$(curl -LI "$url" -o /dev/null -w '%{http_code}\n' -s) + else + result=$(curl -LI -u "$username":"$password" "$url" -o /dev/null -w '%{http_code}\n' -s) + fi + + echo "$result" +} + +function start_local_elastic_stack() { + curl -fsSL https://elastic.co/start-local | sh + source "${START_LOCAL_ENV_PATH}" + sleep 2 + result=$(get_http_response_code "http://localhost:9200" "elastic" "${ES_LOCAL_PASSWORD}") + assert_equals "200" "$result" +} + +function uninstall_local_elastic_stack() { + printf "yes\nno\n" | "${START_LOCAL_UNINSTALL_FILE}" + rm -rf "${START_LOCAL_DIR}" +} + +function launch_demo() { + deployment_type="$1" + platform="$2" + elasticsearch_endpoint="${ES_LOCAL_URL:-$3}" + elasticsearch_api_key="${ES_LOCAL_API_KEY}" + printf "%s\n%s\n%s\n%s\n" "$deployment_type" "$platform" "$elasticsearch_endpoint" "$elasticsearch_api_key" | ./demo.sh +} + +function destroy_demo() { + platform="$1" + printf "%s\n" "$platform" | ./demo.sh destroy +} \ No newline at end of file From 5521a29673f10647410e2d061163e38a1fea6d9f Mon Sep 17 00:00:00 2001 From: girodav <1390902+girodav@users.noreply.github.com> Date: Thu, 30 Oct 2025 17:12:12 +0000 Subject: [PATCH 03/33] Add K8s tests --- .github/workflows/elastic-tests.yml | 3 +++ test/elastic/basic_docker_test.sh | 4 ++-- test/elastic/basic_k8s_test.sh | 12 ++++++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/elastic-tests.yml b/.github/workflows/elastic-tests.yml index 88822ff72b..d7547c8286 100644 --- a/.github/workflows/elastic-tests.yml +++ b/.github/workflows/elastic-tests.yml @@ -18,6 +18,9 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + + - name: Create k8s Kind Cluster + uses: helm/kind-action@v1 - name: Install bashunit run: | diff --git a/test/elastic/basic_docker_test.sh b/test/elastic/basic_docker_test.sh index c96455a959..37c9392558 100755 --- a/test/elastic/basic_docker_test.sh +++ b/test/elastic/basic_docker_test.sh @@ -15,11 +15,11 @@ function tear_down_after_script() { function test_launch_demo_docker() { result=$(launch_demo "cloud-hosted" "docker") - assert_false "$result" + assert_exit_code "0" "$result" } function test_destroy_demo_docker() { result=$(destroy_demo "docker") - assert_false "$result" + assert_exit_code "0" "$result" } diff --git a/test/elastic/basic_k8s_test.sh b/test/elastic/basic_k8s_test.sh index e74ce491ae..d3431b5c1c 100755 --- a/test/elastic/basic_k8s_test.sh +++ b/test/elastic/basic_k8s_test.sh @@ -13,9 +13,13 @@ function tear_down_after_script() { uninstall_local_elastic_stack } -function test_demo_k8s() { - # result=$(launch_demo "cloud-hosted" "k8s") - # assert_false "$result" - assert_true true +function test_launch_demo_k8s() { + result=$(launch_demo "cloud-hosted" "k8s") + assert_exit_code "0" "$result" +} + +function test_destroy_demo_k8s() { + result=$(destroy_demo "k8s") + assert_exit_code "0" "$result" } From 1184cf806603703d65b184e01a0e6570acd40f48 Mon Sep 17 00:00:00 2001 From: girodav <1390902+girodav@users.noreply.github.com> Date: Thu, 30 Oct 2025 18:07:10 +0000 Subject: [PATCH 04/33] Add branch directive to github workflow --- .github/workflows/elastic-tests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/elastic-tests.yml b/.github/workflows/elastic-tests.yml index d7547c8286..6f56a6f6f5 100644 --- a/.github/workflows/elastic-tests.yml +++ b/.github/workflows/elastic-tests.yml @@ -2,8 +2,12 @@ name: Elastic Demo Tests on: pull_request: + branches: + - main types: [opened, synchronize, reopened] push: + branches: + - main paths-ignore: - '.githubREADME.md' From 7dbeef8f3fca9ec4ac2c4d0b40944f36ad384d1f Mon Sep 17 00:00:00 2001 From: girodav <1390902+girodav@users.noreply.github.com> Date: Thu, 30 Oct 2025 18:15:59 +0000 Subject: [PATCH 05/33] Use the actual return code --- test/elastic/basic_docker_test.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/elastic/basic_docker_test.sh b/test/elastic/basic_docker_test.sh index 37c9392558..62fc0a324c 100755 --- a/test/elastic/basic_docker_test.sh +++ b/test/elastic/basic_docker_test.sh @@ -14,12 +14,12 @@ function tear_down_after_script() { } function test_launch_demo_docker() { - result=$(launch_demo "cloud-hosted" "docker") - assert_exit_code "0" "$result" + launch_demo "cloud-hosted" "docker" + assert_exit_code "0" "$?" } function test_destroy_demo_docker() { - result=$(destroy_demo "docker") - assert_exit_code "0" "$result" + destroy_demo "docker" + assert_exit_code "0" "$?" } From 8a868095eb7cd0a10221505738a2f4af60b77253 Mon Sep 17 00:00:00 2001 From: girodav <1390902+girodav@users.noreply.github.com> Date: Fri, 31 Oct 2025 15:55:00 +0000 Subject: [PATCH 06/33] Varius fixes --- ....yml => run-integration-tests-elastic.yml} | 18 +++++--- demo.sh | 24 ++++++----- test/elastic/basic_docker_test.sh | 38 ++++++++++++++-- test/elastic/basic_k8s_test.sh | 6 +-- test/elastic/bootstrap.sh | 7 +-- test/elastic/utils.sh | 43 +++++++++++++++---- 6 files changed, 101 insertions(+), 35 deletions(-) rename .github/workflows/{elastic-tests.yml => run-integration-tests-elastic.yml} (67%) diff --git a/.github/workflows/elastic-tests.yml b/.github/workflows/run-integration-tests-elastic.yml similarity index 67% rename from .github/workflows/elastic-tests.yml rename to .github/workflows/run-integration-tests-elastic.yml index 6f56a6f6f5..2d21993406 100644 --- a/.github/workflows/elastic-tests.yml +++ b/.github/workflows/run-integration-tests-elastic.yml @@ -1,18 +1,18 @@ -name: Elastic Demo Tests +name: Elastic Integration Tests on: pull_request: branches: - main types: [opened, synchronize, reopened] - push: - branches: - - main paths-ignore: - - '.githubREADME.md' + - '.github/README.md' + +permissions: + contents: read jobs: - test: + run-tests: name: Test runs-on: ubuntu-latest @@ -23,8 +23,14 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Set up Docker Compose + uses: docker/setup-compose-action@v1 + - name: Create k8s Kind Cluster uses: helm/kind-action@v1 + + - name: Set up helm + uses: azure/setup-helm@v4.3.0 - name: Install bashunit run: | diff --git a/demo.sh b/demo.sh index b7d50cdf79..90b908337b 100755 --- a/demo.sh +++ b/demo.sh @@ -24,7 +24,6 @@ DOCKER_COLLECTOR_CONFIG_CLOUD='./src/otel-collector/otelcol-elastic-config.yaml' DOCKER_COLLECTOR_CONFIG_SERVERLESS='./src/otel-collector/otelcol-elastic-otlp-config.yaml' COLLECTOR_CONTRIB_IMAGE=docker.elastic.co/elastic-agent/elastic-agent:$ELASTIC_STACK_VERSION - # Variables deployment_type="" platform="" @@ -48,7 +47,6 @@ parse_args() { echo printf "❓ Which Elasticsearch deployment type do you want to send the data into? [serverless/cloud-hosted]? " read -r deployment_type - deployment_type=${deployment_type} case "$deployment_type" in cloud-hosted|serverless) break ;; *) echo "Please enter 'cloud-hosted' or 'serverless'." ;; @@ -58,8 +56,7 @@ parse_args() { while true; do echo printf "❓ In which environment the demo should be deployed? [docker/k8s]?" - read -r platform - platform=${platform} + read -r platform case "$platform" in docker|k8s) break ;; *) echo "Please enter 'docker' or 'k8s'." ;; @@ -79,13 +76,18 @@ parse_args() { } update_env_var() { - VAR="$1" - VAL="$2" + VAR=$1 + VAL=$2 + tmp=$(mktemp) || exit 1 + if grep -q "^$VAR=" "$ENV_OVERRIDE_FILE"; then - sed -i '' "s|^$VAR=.*|$VAR=\"$VAL\"|" "$ENV_OVERRIDE_FILE" + sed "s|^$VAR=.*|$VAR=\"$VAL\"|" "$ENV_OVERRIDE_FILE" >"$tmp" else - echo "$VAR=\"$VAL\"" >> "$ENV_OVERRIDE_FILE" + cat "$ENV_OVERRIDE_FILE" >"$tmp" + echo "$VAR=\"$VAL\"" >>"$tmp" fi + + mv "$tmp" "$ENV_OVERRIDE_FILE" } # Read a secret from the terminal without echo and assign it to a variable by name @@ -224,21 +226,21 @@ main() { destroy_docker destroy_k8s echo "✅ Done! Destroyed Docker and Kubernetes resources." - return 0 + exit 0 fi if [ "$platform" = "docker" ]; then echo "⌛️ Destroying Docker resources..." destroy_docker echo "✅ Done! Destroyed Docker resources." - return 0 + exit 0 fi if [ "$platform" = "k8s" ]; then echo "⌛️ Destroying Kubernetes resources..." destroy_k8s echo "✅ Done! Destroyed Kubernetes resources." - return 0 + exit 0 fi usage diff --git a/test/elastic/basic_docker_test.sh b/test/elastic/basic_docker_test.sh index 62fc0a324c..7970ec53d8 100755 --- a/test/elastic/basic_docker_test.sh +++ b/test/elastic/basic_docker_test.sh @@ -4,7 +4,6 @@ set -e -o pipefail source "${CURRENT_DIR}/test/elastic/utils.sh" - function set_up_before_script() { start_local_elastic_stack } @@ -15,11 +14,44 @@ function tear_down_after_script() { function test_launch_demo_docker() { launch_demo "cloud-hosted" "docker" - assert_exit_code "0" "$?" +} + +function test_check_docker_service_running() { + local services=( + "accounting" + "ad" + "cart" + "checkout" + "currency" + "email" + "fraud-detection" + "frontend" + "frontend-proxy" + "image-provider" + "load-generator" + "payment" + "product-catalog" + "quote" + "recommendation" + "shipping" + "flagd" + "flagd-ui" + "kafka" + "postgresql" + "valkey-cart" + "jaeger" + "grafana" + "otel-collector" + "prometheus" + "opensearch" + ) + + for service in "${services[@]}"; do + assert_exit_code "0" "$(check_docker_service_running "$service")" + done } function test_destroy_demo_docker() { destroy_demo "docker" - assert_exit_code "0" "$?" } diff --git a/test/elastic/basic_k8s_test.sh b/test/elastic/basic_k8s_test.sh index d3431b5c1c..0c3872b384 100755 --- a/test/elastic/basic_k8s_test.sh +++ b/test/elastic/basic_k8s_test.sh @@ -14,12 +14,10 @@ function tear_down_after_script() { } function test_launch_demo_k8s() { - result=$(launch_demo "cloud-hosted" "k8s") - assert_exit_code "0" "$result" + launch_demo "cloud-hosted" "k8s" } function test_destroy_demo_k8s() { - result=$(destroy_demo "k8s") - assert_exit_code "0" "$result" + destroy_demo "k8s" } diff --git a/test/elastic/bootstrap.sh b/test/elastic/bootstrap.sh index fc4d89c6ee..be53f81a16 100755 --- a/test/elastic/bootstrap.sh +++ b/test/elastic/bootstrap.sh @@ -3,6 +3,7 @@ set -euo pipefail # Place your common test setup here CURRENT_DIR=$(pwd) -START_LOCAL_DIR="${CURRENT_DIR}/elastic-start-local" -START_LOCAL_ENV_PATH="${START_LOCAL_DIR}/.env" -START_LOCAL_UNINSTALL_FILE="${START_LOCAL_DIR}/uninstall.sh" \ No newline at end of file +export CURRENT_DIR +export START_LOCAL_DIR="${CURRENT_DIR}/elastic-start-local" +export START_LOCAL_ENV_PATH="${START_LOCAL_DIR}/.env" +export START_LOCAL_UNINSTALL_FILE="${START_LOCAL_DIR}/uninstall.sh" \ No newline at end of file diff --git a/test/elastic/utils.sh b/test/elastic/utils.sh index c92a6c2979..885688dd9c 100644 --- a/test/elastic/utils.sh +++ b/test/elastic/utils.sh @@ -23,7 +23,9 @@ function get_http_response_code() { } function start_local_elastic_stack() { + printf "CURRENT_DIR=%s\n" "$CURRENT_DIR" curl -fsSL https://elastic.co/start-local | sh + # shellcheck source=test/elastic/bootstrap.sh source "${START_LOCAL_ENV_PATH}" sleep 2 result=$(get_http_response_code "http://localhost:9200" "elastic" "${ES_LOCAL_PASSWORD}") @@ -36,14 +38,39 @@ function uninstall_local_elastic_stack() { } function launch_demo() { - deployment_type="$1" - platform="$2" - elasticsearch_endpoint="${ES_LOCAL_URL:-$3}" - elasticsearch_api_key="${ES_LOCAL_API_KEY}" - printf "%s\n%s\n%s\n%s\n" "$deployment_type" "$platform" "$elasticsearch_endpoint" "$elasticsearch_api_key" | ./demo.sh + local deployment_type="$1" + local platform="$2" + local elasticsearch_endpoint="${ES_LOCAL_URL:-$3}" + local elasticsearch_api_key="${ES_LOCAL_API_KEY}" + echo "Launching demo with:" + echo " deployment_type: $deployment_type" + echo " platform: $platform" + echo " elasticsearch_endpoint: $elasticsearch_endpoint" + echo " elasticsearch_api_key: $elasticsearch_api_key" + printf "${deployment_type}\n${platform}\n${elasticsearch_endpoint}\n${elasticsearch_api_key}\n" | ${CURRENT_DIR}/demo.sh } function destroy_demo() { - platform="$1" - printf "%s\n" "$platform" | ./demo.sh destroy -} \ No newline at end of file + local platform="$1" + echo "Destroying demo on platform: $platform" + ${CURRENT_DIR}/demo.sh destroy "$platform" +} + +# Check if a docker service is running +check_docker_service_running() { + local container_name=$1 + local status + + # Get the container status + status=$(docker ps --filter "name=^${container_name}$" --format '{{.Status}}' 2>/dev/null) + + # Check if container exists and is running (status starts with "Up") + if [[ -n "$status" ]] && [[ "$status" =~ ^Up ]]; then + echo "Container $container_name is running" + return 0 + else + echo "Container $container_name not running. Current status: ${status:-not found}" + return 1 + fi +} + From 2208b253df1919b917678a815f3bbc49c01b3719 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=B3nal=20O=27Sullivan?= Date: Tue, 9 Dec 2025 15:24:36 +0000 Subject: [PATCH 07/33] fix: Add newline to end of files --- .env.bashunit | 3 ++- .github/workflows/run-integration-tests.yml | 1 + test/elastic/bootstrap.sh | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.env.bashunit b/.env.bashunit index d94f5d226e..914765ad24 100644 --- a/.env.bashunit +++ b/.env.bashunit @@ -1,2 +1,3 @@ BASHUNIT_DEFAULT_PATH=test/elastic -BASHUNIT_BOOTSTRAP="${BASHUNIT_DEFAULT_PATH}/bootstrap.sh" \ No newline at end of file +BASHUNIT_BOOTSTRAP="${BASHUNIT_DEFAULT_PATH}/bootstrap.sh" + diff --git a/.github/workflows/run-integration-tests.yml b/.github/workflows/run-integration-tests.yml index a64c774b38..0162aa2a52 100644 --- a/.github/workflows/run-integration-tests.yml +++ b/.github/workflows/run-integration-tests.yml @@ -21,3 +21,4 @@ jobs: - name: run tracetesting run: | make build && docker system prune -f && make run-tracetesting + diff --git a/test/elastic/bootstrap.sh b/test/elastic/bootstrap.sh index be53f81a16..df3270cda2 100755 --- a/test/elastic/bootstrap.sh +++ b/test/elastic/bootstrap.sh @@ -6,4 +6,5 @@ CURRENT_DIR=$(pwd) export CURRENT_DIR export START_LOCAL_DIR="${CURRENT_DIR}/elastic-start-local" export START_LOCAL_ENV_PATH="${START_LOCAL_DIR}/.env" -export START_LOCAL_UNINSTALL_FILE="${START_LOCAL_DIR}/uninstall.sh" \ No newline at end of file +export START_LOCAL_UNINSTALL_FILE="${START_LOCAL_DIR}/uninstall.sh" + From 6d2c55249e60da9940782448b61e4c1776cedef3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=B3nal=20O=27Sullivan?= Date: Tue, 9 Dec 2025 15:29:48 +0000 Subject: [PATCH 08/33] fix: Remove newline --- test/elastic/basic_k8s_test.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/test/elastic/basic_k8s_test.sh b/test/elastic/basic_k8s_test.sh index 0c3872b384..5d93aeed11 100755 --- a/test/elastic/basic_k8s_test.sh +++ b/test/elastic/basic_k8s_test.sh @@ -4,7 +4,6 @@ set -e -o pipefail source "${CURRENT_DIR}/test/elastic/utils.sh" - function set_up_before_script() { start_local_elastic_stack } From fda8d5f5fe93150d7ceebde35a519d98633d3ecc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=B3nal=20O=27Sullivan?= Date: Tue, 9 Dec 2025 16:32:25 +0000 Subject: [PATCH 09/33] Add spacing and newline to user prompts when running demo.sh in interactive mode --- demo.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/demo.sh b/demo.sh index 654591a71a..b1588354e0 100755 --- a/demo.sh +++ b/demo.sh @@ -74,7 +74,7 @@ parse_args() { while true; do echo - printf "❓ In which environment the demo should be deployed? [docker/k8s]?" + printf "❓ In which environment the demo should be deployed? [docker/k8s]? " read -r platform case "$platform" in docker|k8s) break ;; @@ -270,8 +270,9 @@ main() { usage fi - echo "⌛️ Starting OTel Demo + EDOT on '$platform' → Elastic ($deployment_type)..." echo + echo "⌛️ Starting OTel Demo + EDOT on '$platform' → Elastic ($deployment_type)..." + if [ "$platform" = "docker" ]; then start_docker else From bda02b3f05f765d01c2c1f214c7f3ee097cbb227 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=B3nal=20O=27Sullivan?= Date: Tue, 9 Dec 2025 16:53:11 +0000 Subject: [PATCH 10/33] fix: Free up disc space for running elastic integration tests --- .github/workflows/run-integration-tests-elastic.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-integration-tests-elastic.yml b/.github/workflows/run-integration-tests-elastic.yml index 2d21993406..c8c89a05a9 100644 --- a/.github/workflows/run-integration-tests-elastic.yml +++ b/.github/workflows/run-integration-tests-elastic.yml @@ -35,7 +35,16 @@ jobs: - name: Install bashunit run: | curl -s https://bashunit.typeddevs.com/install.sh | bash + + - name: Free up disk space + run: | + sudo rm -rf /usr/share/dotnet + sudo rm -rf /usr/local/lib/android + sudo rm -rf /opt/ghc + sudo rm -rf /opt/hostedtoolcache/CodeQL + docker system prune -af --volumes + sudo apt-get clean - name: Run the tests run: | - ./lib/bashunit --env .env.bashunit \ No newline at end of file + ./lib/bashunit --env .env.bashunit From a034df02caf426c2915ca5371eeb8616d3aa5347 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=B3nal=20O=27Sullivan?= Date: Wed, 10 Dec 2025 10:20:03 +0000 Subject: [PATCH 11/33] Update bash unit test for the docker services to use a list of docker services from docker compose instead of having to maintain a separate list --- test/elastic/basic_docker_test.sh | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/test/elastic/basic_docker_test.sh b/test/elastic/basic_docker_test.sh index 7970ec53d8..5ee88b827d 100755 --- a/test/elastic/basic_docker_test.sh +++ b/test/elastic/basic_docker_test.sh @@ -17,34 +17,7 @@ function test_launch_demo_docker() { } function test_check_docker_service_running() { - local services=( - "accounting" - "ad" - "cart" - "checkout" - "currency" - "email" - "fraud-detection" - "frontend" - "frontend-proxy" - "image-provider" - "load-generator" - "payment" - "product-catalog" - "quote" - "recommendation" - "shipping" - "flagd" - "flagd-ui" - "kafka" - "postgresql" - "valkey-cart" - "jaeger" - "grafana" - "otel-collector" - "prometheus" - "opensearch" - ) + local services=($docker compose config --services) for service in "${services[@]}"; do assert_exit_code "0" "$(check_docker_service_running "$service")" From d32cb85517b85de89bf430bab66c4d5a8991ac89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=B3nal=20O=27Sullivan?= Date: Wed, 10 Dec 2025 10:21:07 +0000 Subject: [PATCH 12/33] Update the Elastic README to reflect the new prompt input for running demo.sh --- .github/README.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/README.md b/.github/README.md index 34ea2af7aa..a2a6b1db91 100644 --- a/.github/README.md +++ b/.github/README.md @@ -22,13 +22,17 @@ Additionally, the OpenTelemetry Contrib collector has also been changed to the [ #### Elasticsearch exporter (default) 1. Start a free trial on [Elastic Cloud](https://cloud.elastic.co/) and copy the `Elasticsearch endpoint` and the `API Key` from the `Help -> Connection details` drop down instructions in your Kibana. These variables will be used by the [elasticsearch exporter](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/elasticsearchexporter#elasticsearch-exporter) to authenticate and transmit data to your Elasticsearch instance. -2. Run `./demo.sh cloud-hosted docker`. +2. Run `./demo.sh` and enter: + - Deployment type: `cloud-hosted` + - Platform: `docker` #### Managed Ingest Endpoint 1. Sign up for a free trial on [Elastic Cloud](https://cloud.elastic.co/) and start an Elastic Cloud Serverless Observability type project. Select Add data, Application and then OpenTelemetry. 2. Copy the OTEL_EXPORTER_OTLP_ENDPOINT URL. 3. Click "Create an API Key" to create one. -4. Run `./demo.sh serverless docker` +4. Run `./demo.sh` and enter: + - Deployment type: `serverless` + - Platform: `docker` #### Connect to a local Elasticsearch cluster The following steps shows how to start the Otel demo in a Docker container and send the generated otel data to an Elasticsearch instance running locally on the host. @@ -87,8 +91,12 @@ make start ### Automated Installation -- **Elasticsearch exporter:** Run `./demo.sh cloud-hosted k8s` -- **Managed Ingest Endpoint:** Run `./demo.sh serverless k8s` +- **Elasticsearch exporter:** Run `./demo.sh` and enter: + - Deployment type: `cloud-hosted` + - Platform: `k8s` +- **Managed Ingest Endpoint:** Run `./demo.sh` and enter: + - Deployment type: `serverless` + - Platform: `k8s` ### Manual Installation From 6ca10ded6fbaf622e41cbce7d91490092a8b6336 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=B3nal=20O=27Sullivan?= Date: Wed, 10 Dec 2025 10:55:02 +0000 Subject: [PATCH 13/33] Fix docker compose list of services --- test/elastic/basic_docker_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/elastic/basic_docker_test.sh b/test/elastic/basic_docker_test.sh index 5ee88b827d..87656ac15a 100755 --- a/test/elastic/basic_docker_test.sh +++ b/test/elastic/basic_docker_test.sh @@ -17,7 +17,7 @@ function test_launch_demo_docker() { } function test_check_docker_service_running() { - local services=($docker compose config --services) + local services=($(docker compose config --services)) for service in "${services[@]}"; do assert_exit_code "0" "$(check_docker_service_running "$service")" From 0a6494226ee3dd99b6be54a8f7bb6a77cd40662c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=B3nal=20O=27Sullivan?= Date: Wed, 10 Dec 2025 11:31:56 +0000 Subject: [PATCH 14/33] Update elastic tests to include error logging for CI output --- test/elastic/utils.sh | 135 +++++++++++++++++++++++++++++++----------- 1 file changed, 101 insertions(+), 34 deletions(-) diff --git a/test/elastic/utils.sh b/test/elastic/utils.sh index 885688dd9c..353a4a20d0 100644 --- a/test/elastic/utils.sh +++ b/test/elastic/utils.sh @@ -5,36 +5,65 @@ set -e -o pipefail # Returns the HTTP status code from a call # usage: get_http_response_code url username password function get_http_response_code() { - url=$1 - if [ -z "$url" ]; then - echo "Error: you need to specify the URL for get the HTTP response" - exit 1 - fi - username=$2 - password=$3 - - if [ -z "$username" ] || [ -z "$password" ]; then - result=$(curl -LI "$url" -o /dev/null -w '%{http_code}\n' -s) - else - result=$(curl -LI -u "$username":"$password" "$url" -o /dev/null -w '%{http_code}\n' -s) - fi + url=$1 + if [ -z "$url" ]; then + echo "Error: you need to specify the URL for get the HTTP response" + exit 1 + fi + username=$2 + password=$3 + + if [ -z "$username" ] || [ -z "$password" ]; then + result=$(curl -LI "$url" -o /dev/null -w '%{http_code}\n' -s) + else + result=$(curl -LI -u "$username":"$password" "$url" -o /dev/null -w '%{http_code}\n' -s) + fi - echo "$result" + echo "$result" } function start_local_elastic_stack() { - printf "CURRENT_DIR=%s\n" "$CURRENT_DIR" - curl -fsSL https://elastic.co/start-local | sh - # shellcheck source=test/elastic/bootstrap.sh - source "${START_LOCAL_ENV_PATH}" - sleep 2 - result=$(get_http_response_code "http://localhost:9200" "elastic" "${ES_LOCAL_PASSWORD}") - assert_equals "200" "$result" + echo "=== STARTING LOCAL ELASTIC STACK ===" + printf "CURRENT_DIR=%s\n" "$CURRENT_DIR" + + echo "Downloading and running elastic start-local script..." + if ! curl -fsSL https://elastic.co/start-local | sh; then + echo "ERROR: Failed to start local Elastic stack" + echo "Curl exit code: $?" + return 1 + fi + + echo "Sourcing environment variables..." + # shellcheck source=test/elastic/bootstrap.sh + if ! source "${START_LOCAL_ENV_PATH}"; then + echo "ERROR: Failed to source ${START_LOCAL_ENV_PATH}" + return 1 + fi + + echo "Waiting for Elasticsearch to be ready..." + sleep 2 + + echo "Testing Elasticsearch connectivity..." + result=$(get_http_response_code "http://localhost:9200" "elastic" "${ES_LOCAL_PASSWORD}") + echo "Elasticsearch response code: $result" + + if [[ "$result" != "200" ]]; then + echo "ERROR: Elasticsearch not responding correctly" + echo "Expected: 200, Got: $result" + echo "Environment variables:" + env | grep ES_ || echo "No ES_ variables found" + return 1 + fi + + assert_equals "200" "$result" + echo "Local Elastic stack started successfully" } function uninstall_local_elastic_stack() { - printf "yes\nno\n" | "${START_LOCAL_UNINSTALL_FILE}" - rm -rf "${START_LOCAL_DIR}" + echo "=== UNINSTALLING LOCAL ELASTIC STACK ===" + printf "yes\nno\n" | "${START_LOCAL_UNINSTALL_FILE}" + rm -rf "${START_LOCAL_DIR}" + echo "Local Elastic stack uninstalled" } function launch_demo() { @@ -42,35 +71,73 @@ function launch_demo() { local platform="$2" local elasticsearch_endpoint="${ES_LOCAL_URL:-$3}" local elasticsearch_api_key="${ES_LOCAL_API_KEY}" - echo "Launching demo with:" + + echo "=== LAUNCHING DEMO ===" echo " deployment_type: $deployment_type" echo " platform: $platform" echo " elasticsearch_endpoint: $elasticsearch_endpoint" - echo " elasticsearch_api_key: $elasticsearch_api_key" - printf "${deployment_type}\n${platform}\n${elasticsearch_endpoint}\n${elasticsearch_api_key}\n" | ${CURRENT_DIR}/demo.sh + echo " elasticsearch_api_key: ${elasticsearch_api_key:0:10}..." + echo "========================" + + # Check if demo.sh exists + if [[ ! -f "${CURRENT_DIR}/demo.sh" ]]; then + echo "ERROR: demo.sh not found at ${CURRENT_DIR}/demo.sh" + return 1 + fi + + # Run demo.sh with error capture + if ! printf "${deployment_type}\n${platform}\n${elasticsearch_endpoint}\n${elasticsearch_api_key}\n" | "${CURRENT_DIR}/demo.sh"; then + echo "ERROR: demo.sh execution failed" + echo "Exit code: $?" + echo "Checking Docker containers status:" + docker ps -a --format "table {{.Names}}\t{{.Status}}\t{{.Image}}" + return 1 + fi + + echo "Demo launch completed successfully" } function destroy_demo() { local platform="$1" + echo "=== DESTROYING DEMO ===" echo "Destroying demo on platform: $platform" - ${CURRENT_DIR}/demo.sh destroy "$platform" + + if ! "${CURRENT_DIR}/demo.sh" destroy "$platform"; then + echo "ERROR: Failed to destroy demo on $platform" + echo "Exit code: $?" + return 1 + fi + + echo "Demo destruction completed successfully" } # Check if a docker service is running check_docker_service_running() { local container_name=$1 local status - - # Get the container status + + echo "Checking container: $container_name" + + # Get the container status with more details status=$(docker ps --filter "name=^${container_name}$" --format '{{.Status}}' 2>/dev/null) - - # Check if container exists and is running (status starts with "Up") + if [[ -n "$status" ]] && [[ "$status" =~ ^Up ]]; then - echo "Container $container_name is running" + echo " Container $container_name is running: $status" return 0 else - echo "Container $container_name not running. Current status: ${status:-not found}" + echo " Container $container_name not running" + echo " Expected status: Up*" + echo " Actual status: ${status:-not found}" + + # Show container details if it exists + local container_info=$(docker ps -a --filter "name=^${container_name}$" --format '{{.Status}}\t{{.Image}}\t{{.Ports}}' 2>/dev/null) + if [[ -n "$container_info" ]]; then + echo " Container details: $container_info" + echo " Recent logs:" + docker logs "$container_name" --tail 5 2>&1 || echo " No logs available" + else + echo " Container does not exist" + fi return 1 fi } - From f55f108a5dca0c976d7e955b854ab18cd63b7a97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=B3nal=20O=27Sullivan?= Date: Wed, 10 Dec 2025 11:50:25 +0000 Subject: [PATCH 15/33] Removed not needed comments --- test/elastic/utils.sh | 9 --------- 1 file changed, 9 deletions(-) diff --git a/test/elastic/utils.sh b/test/elastic/utils.sh index 353a4a20d0..bb5dccc9cf 100644 --- a/test/elastic/utils.sh +++ b/test/elastic/utils.sh @@ -79,13 +79,6 @@ function launch_demo() { echo " elasticsearch_api_key: ${elasticsearch_api_key:0:10}..." echo "========================" - # Check if demo.sh exists - if [[ ! -f "${CURRENT_DIR}/demo.sh" ]]; then - echo "ERROR: demo.sh not found at ${CURRENT_DIR}/demo.sh" - return 1 - fi - - # Run demo.sh with error capture if ! printf "${deployment_type}\n${platform}\n${elasticsearch_endpoint}\n${elasticsearch_api_key}\n" | "${CURRENT_DIR}/demo.sh"; then echo "ERROR: demo.sh execution failed" echo "Exit code: $?" @@ -118,7 +111,6 @@ check_docker_service_running() { echo "Checking container: $container_name" - # Get the container status with more details status=$(docker ps --filter "name=^${container_name}$" --format '{{.Status}}' 2>/dev/null) if [[ -n "$status" ]] && [[ "$status" =~ ^Up ]]; then @@ -129,7 +121,6 @@ check_docker_service_running() { echo " Expected status: Up*" echo " Actual status: ${status:-not found}" - # Show container details if it exists local container_info=$(docker ps -a --filter "name=^${container_name}$" --format '{{.Status}}\t{{.Image}}\t{{.Ports}}' 2>/dev/null) if [[ -n "$container_info" ]]; then echo " Container details: $container_info" From 28e4ab068b4b5c19c9a765d77754f8c1e5dd4895 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=B3nal=20O=27Sullivan?= Date: Wed, 10 Dec 2025 11:50:59 +0000 Subject: [PATCH 16/33] Add debug statements to k8s test --- test/elastic/basic_k8s_test.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/elastic/basic_k8s_test.sh b/test/elastic/basic_k8s_test.sh index 5d93aeed11..49c933688c 100755 --- a/test/elastic/basic_k8s_test.sh +++ b/test/elastic/basic_k8s_test.sh @@ -12,11 +12,13 @@ function tear_down_after_script() { uninstall_local_elastic_stack } -function test_launch_demo_k8s() { +function test_launch_demo_k8s() { + echo "=== DEBUG: Starting K8s test ===" + echo "About to call launch_demo with cloud-hosted k8s" launch_demo "cloud-hosted" "k8s" + echo "=== DEBUG: K8s test completed ===" } -function test_destroy_demo_k8s() { +function test_destroy_demo_k8s() { destroy_demo "k8s" } - From 6e68e232c7d4aa71db001a8151c4187eecfa865e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=B3nal=20O=27Sullivan?= Date: Wed, 10 Dec 2025 12:18:37 +0000 Subject: [PATCH 17/33] Revert "Update elastic tests to include error logging for CI output" This reverts commit 0a6494226ee3dd99b6be54a8f7bb6a77cd40662c. --- test/elastic/utils.sh | 79 ++++++------------------------------------- 1 file changed, 10 insertions(+), 69 deletions(-) diff --git a/test/elastic/utils.sh b/test/elastic/utils.sh index bb5dccc9cf..2e72d0fd44 100644 --- a/test/elastic/utils.sh +++ b/test/elastic/utils.sh @@ -23,47 +23,18 @@ function get_http_response_code() { } function start_local_elastic_stack() { - echo "=== STARTING LOCAL ELASTIC STACK ===" printf "CURRENT_DIR=%s\n" "$CURRENT_DIR" - - echo "Downloading and running elastic start-local script..." - if ! curl -fsSL https://elastic.co/start-local | sh; then - echo "ERROR: Failed to start local Elastic stack" - echo "Curl exit code: $?" - return 1 - fi - - echo "Sourcing environment variables..." + curl -fsSL https://elastic.co/start-local | sh # shellcheck source=test/elastic/bootstrap.sh - if ! source "${START_LOCAL_ENV_PATH}"; then - echo "ERROR: Failed to source ${START_LOCAL_ENV_PATH}" - return 1 - fi - - echo "Waiting for Elasticsearch to be ready..." + source "${START_LOCAL_ENV_PATH}" sleep 2 - - echo "Testing Elasticsearch connectivity..." result=$(get_http_response_code "http://localhost:9200" "elastic" "${ES_LOCAL_PASSWORD}") - echo "Elasticsearch response code: $result" - - if [[ "$result" != "200" ]]; then - echo "ERROR: Elasticsearch not responding correctly" - echo "Expected: 200, Got: $result" - echo "Environment variables:" - env | grep ES_ || echo "No ES_ variables found" - return 1 - fi - assert_equals "200" "$result" - echo "Local Elastic stack started successfully" } function uninstall_local_elastic_stack() { - echo "=== UNINSTALLING LOCAL ELASTIC STACK ===" printf "yes\nno\n" | "${START_LOCAL_UNINSTALL_FILE}" rm -rf "${START_LOCAL_DIR}" - echo "Local Elastic stack uninstalled" } function launch_demo() { @@ -71,37 +42,18 @@ function launch_demo() { local platform="$2" local elasticsearch_endpoint="${ES_LOCAL_URL:-$3}" local elasticsearch_api_key="${ES_LOCAL_API_KEY}" - - echo "=== LAUNCHING DEMO ===" + echo "Launching demo with:" echo " deployment_type: $deployment_type" echo " platform: $platform" echo " elasticsearch_endpoint: $elasticsearch_endpoint" - echo " elasticsearch_api_key: ${elasticsearch_api_key:0:10}..." - echo "========================" - - if ! printf "${deployment_type}\n${platform}\n${elasticsearch_endpoint}\n${elasticsearch_api_key}\n" | "${CURRENT_DIR}/demo.sh"; then - echo "ERROR: demo.sh execution failed" - echo "Exit code: $?" - echo "Checking Docker containers status:" - docker ps -a --format "table {{.Names}}\t{{.Status}}\t{{.Image}}" - return 1 - fi - - echo "Demo launch completed successfully" + echo " elasticsearch_api_key: $elasticsearch_api_key" + printf "${deployment_type}\n${platform}\n${elasticsearch_endpoint}\n${elasticsearch_api_key}\n" | ${CURRENT_DIR}/demo.sh } function destroy_demo() { local platform="$1" - echo "=== DESTROYING DEMO ===" echo "Destroying demo on platform: $platform" - - if ! "${CURRENT_DIR}/demo.sh" destroy "$platform"; then - echo "ERROR: Failed to destroy demo on $platform" - echo "Exit code: $?" - return 1 - fi - - echo "Demo destruction completed successfully" + ${CURRENT_DIR}/demo.sh destroy "$platform" } # Check if a docker service is running @@ -109,26 +61,15 @@ check_docker_service_running() { local container_name=$1 local status - echo "Checking container: $container_name" - + # Get the container status status=$(docker ps --filter "name=^${container_name}$" --format '{{.Status}}' 2>/dev/null) + # Check if container exists and is running (status starts with "Up") if [[ -n "$status" ]] && [[ "$status" =~ ^Up ]]; then - echo " Container $container_name is running: $status" + echo "Container $container_name is running" return 0 else - echo " Container $container_name not running" - echo " Expected status: Up*" - echo " Actual status: ${status:-not found}" - - local container_info=$(docker ps -a --filter "name=^${container_name}$" --format '{{.Status}}\t{{.Image}}\t{{.Ports}}' 2>/dev/null) - if [[ -n "$container_info" ]]; then - echo " Container details: $container_info" - echo " Recent logs:" - docker logs "$container_name" --tail 5 2>&1 || echo " No logs available" - else - echo " Container does not exist" - fi + echo "Container $container_name not running. Current status: ${status:-not found}" return 1 fi } From 63d930c1e73635d2b286cd937d7d01695280d0e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=B3nal=20O=27Sullivan?= Date: Wed, 10 Dec 2025 13:40:46 +0000 Subject: [PATCH 18/33] Update bashunit k8s tests to use custom assertions, this will allow test failure information to be shown --- test/elastic/basic_k8s_test.sh | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/test/elastic/basic_k8s_test.sh b/test/elastic/basic_k8s_test.sh index 49c933688c..fc0f8c38f2 100755 --- a/test/elastic/basic_k8s_test.sh +++ b/test/elastic/basic_k8s_test.sh @@ -12,13 +12,33 @@ function tear_down_after_script() { uninstall_local_elastic_stack } +function assert_demo_launched() { + local deployment_type="$1" + local platform="$2" + + if ! launch_demo "$deployment_type" "$platform"; then + bashunit::assertion_failed "demo to launch successfully on $platform with $deployment_type" "launch failed" "got" + return + fi + + bashunit::assertion_passed +} + +function assert_demo_destroyed() { + local platform="$1" + + if ! destroy_demo "$platform"; then + bashunit::assertion_failed "demo to be destroyed on $platform" "destruction failed" "got" + return + fi + + bashunit::assertion_passed +} + function test_launch_demo_k8s() { - echo "=== DEBUG: Starting K8s test ===" - echo "About to call launch_demo with cloud-hosted k8s" - launch_demo "cloud-hosted" "k8s" - echo "=== DEBUG: K8s test completed ===" + assert_demo_launched "cloud-hosted" "k8s" } function test_destroy_demo_k8s() { - destroy_demo "k8s" + assert_demo_destroyed "k8s" } From a60011fa0263919da578f7e126a513d750a32919 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=B3nal=20O=27Sullivan?= Date: Wed, 10 Dec 2025 13:41:59 +0000 Subject: [PATCH 19/33] Update bashunit docker tests to use custom assertions, this will allow test failure information to be shown --- test/elastic/basic_docker_test.sh | 54 +++++++++++++++++++++++++++---- 1 file changed, 47 insertions(+), 7 deletions(-) diff --git a/test/elastic/basic_docker_test.sh b/test/elastic/basic_docker_test.sh index 87656ac15a..90a87adae4 100755 --- a/test/elastic/basic_docker_test.sh +++ b/test/elastic/basic_docker_test.sh @@ -12,19 +12,59 @@ function tear_down_after_script() { uninstall_local_elastic_stack } -function test_launch_demo_docker() { - launch_demo "cloud-hosted" "docker" +function assert_docker_service_running() { + local service="$1" + + if ! check_docker_service_running "$service"; then + local status=$(docker ps --filter "name=^${service}$" --format '{{.Status}}' 2>/dev/null) + local container_info=$(docker ps -a --filter "name=^${service}$" --format '{{.Status}}\t{{.Image}}' 2>/dev/null) + + if [[ -n "$container_info" ]]; then + bashunit::assertion_failed "service '$service' to be running" "status: ${status:-not found}, details: $container_info" "got" + else + bashunit::assertion_failed "service '$service' to be running" "container does not exist" "got" + fi + return + fi + + bashunit::assertion_passed +} + +function assert_demo_launched() { + local deployment_type="$1" + local platform="$2" + + if ! launch_demo "$deployment_type" "$platform"; then + bashunit::assertion_failed "demo to launch successfully on $platform with $deployment_type" "launch failed" "got" + return + fi + + bashunit::assertion_passed } -function test_check_docker_service_running() { +function assert_demo_destroyed() { + local platform="$1" + + if ! destroy_demo "$platform"; then + bashunit::assertion_failed "demo to be destroyed on $platform" "destruction failed" "got" + return + fi + + bashunit::assertion_passed +} + +function test_launch_demo_docker() { + assert_demo_launched "cloud-hosted" "docker" +} + +function test_check_docker_service_running() { local services=($(docker compose config --services)) for service in "${services[@]}"; do - assert_exit_code "0" "$(check_docker_service_running "$service")" + assert_docker_service_running "$service" done } -function test_destroy_demo_docker() { - destroy_demo "docker" +function test_destroy_demo_docker() { + assert_demo_destroyed "docker" } - From 7d43da29f8c1ec434fc61a3813e6df232c53b6c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=B3nal=20O=27Sullivan?= Date: Wed, 10 Dec 2025 15:07:20 +0000 Subject: [PATCH 20/33] Update demo to only prompt the user for elastic creds if they do not exits, if they do we reuse them --- demo.sh | 113 +++++++++++++++++++++++++++++++++----------------------- 1 file changed, 67 insertions(+), 46 deletions(-) diff --git a/demo.sh b/demo.sh index b1588354e0..75e7d7b3c2 100755 --- a/demo.sh +++ b/demo.sh @@ -51,12 +51,12 @@ elasticsearch_endpoint="" elasticsearch_api_key="" usage() { - echo "Run the script with no arguments. This will start an interactive prompt that will guide you through the setup of the Elastic OpenTelemetry Demo." - echo - echo "To destroy the demo, run: $0 destroy [docker|k8s]" - echo " - pass 'docker' or 'k8s' to destroy only that platform" - echo " - omit the platform to destroy both docker and k8s resources" - exit 1 + echo "Run the script with no arguments. This will start an interactive prompt that will guide you through the setup of the Elastic OpenTelemetry Demo." + echo + echo "To destroy the demo, run: $0 destroy [docker|k8s]" + echo " - pass 'docker' or 'k8s' to destroy only that platform" + echo " - omit the platform to destroy both docker and k8s resources" + exit 1 } parse_args() { @@ -67,18 +67,18 @@ parse_args() { printf "❓ Which Elasticsearch deployment type do you want to send the data into? [serverless/cloud-hosted]? " read -r deployment_type case "$deployment_type" in - cloud-hosted|serverless) break ;; - *) echo "Please enter 'cloud-hosted' or 'serverless'." ;; + cloud-hosted | serverless) break ;; + *) echo "Please enter 'cloud-hosted' or 'serverless'." ;; esac done while true; do echo printf "❓ In which environment the demo should be deployed? [docker/k8s]? " - read -r platform + read -r platform case "$platform" in - docker|k8s) break ;; - *) echo "Please enter 'docker' or 'k8s'." ;; + docker | k8s) break ;; + *) echo "Please enter 'docker' or 'k8s'." ;; esac done return @@ -102,7 +102,7 @@ update_env_var() { if grep -q "^$VAR=" "$ENV_OVERRIDE_FILE"; then sed_in_place "s|^$VAR=.*|$VAR=\"$VAL\"|" "$ENV_OVERRIDE_FILE" else - echo "$VAR=\"$VAL\"" >> "$ENV_OVERRIDE_FILE" + echo "$VAR=\"$VAL\"" >>"$ENV_OVERRIDE_FILE" fi } @@ -122,13 +122,15 @@ read_secret() { ensure_env_values() { echo - if [ -z "$elasticsearch_endpoint" ]; then - if [ "$deployment_type" = "serverless" ]; then - printf "🔑 Enter your Elastic OTLP endpoint: " - else - printf "🔑 Enter your Elastic endpoint: " + if ! check_existing_credentials; then + if [ -z "$elasticsearch_endpoint" ]; then + if [ "$deployment_type" = "serverless" ]; then + printf "🔑 Enter your Elastic OTLP endpoint: " + else + printf "🔑 Enter your Elastic endpoint: " + fi + read -r elasticsearch_endpoint fi - read -r elasticsearch_endpoint fi if [ -z "$elasticsearch_api_key" ]; then @@ -140,15 +142,35 @@ ensure_env_values() { # Resolve OTEL Collector config path for Docker based on deployment_type set_docker_collector_config() { case "$deployment_type" in - cloud-hosted) - OTEL_COLLECTOR_CONFIG=$DOCKER_COLLECTOR_CONFIG_CLOUD - ;; - serverless) - OTEL_COLLECTOR_CONFIG=$DOCKER_COLLECTOR_CONFIG_SERVERLESS - ;; + cloud-hosted) + OTEL_COLLECTOR_CONFIG=$DOCKER_COLLECTOR_CONFIG_CLOUD + ;; + serverless) + OTEL_COLLECTOR_CONFIG=$DOCKER_COLLECTOR_CONFIG_SERVERLESS + ;; esac } +check_existing_credentials() { + if [ ! -f "$ENV_OVERRIDE_FILE" ]; then + return 1 + fi + + elasticsearch_endpoint=$(grep "^ELASTICSEARCH_ENDPOINT=" "$ENV_OVERRIDE_FILE" | cut -d'=' -f2- | tr -d '"') + elasticsearch_api_key=$(grep "^ELASTICSEARCH_API_KEY=" "$ENV_OVERRIDE_FILE" | cut -d'=' -f2- | tr -d '"') + + if [ -n "$elasticsearch_endpoint" ] && [ -n "$elasticsearch_api_key" ] && + [ "$elasticsearch_endpoint" != "YOUR_ENDPOINT" ] && + [ "$elasticsearch_api_key" != "YOUR_API_KEY" ]; then + echo "✅ Using existing credentials from $ENV_OVERRIDE_FILE" + return 0 + fi + + elasticsearch_endpoint="" + elasticsearch_api_key="" + return 1 +} + start_docker() { set_docker_collector_config ensure_env_values @@ -169,31 +191,31 @@ ensure_k8s_prereqs() { apply_k8s_secret() { ensure_env_values case "$deployment_type" in - cloud-hosted) - kubectl create secret generic "$SECRET_NAME" \ - --namespace "$NAMESPACE" \ - --from-literal=elastic_endpoint="$elasticsearch_endpoint" \ - --from-literal=elastic_api_key="$elasticsearch_api_key" \ - --dry-run=client -o yaml | kubectl apply -f - - ;; - serverless) - kubectl create secret generic "$SECRET_NAME" \ - --namespace "$NAMESPACE" \ - --from-literal=elastic_otlp_endpoint="$elasticsearch_endpoint" \ - --from-literal=elastic_api_key="$elasticsearch_api_key" \ - --dry-run=client -o yaml | kubectl apply -f - - ;; + cloud-hosted) + kubectl create secret generic "$SECRET_NAME" \ + --namespace "$NAMESPACE" \ + --from-literal=elastic_endpoint="$elasticsearch_endpoint" \ + --from-literal=elastic_api_key="$elasticsearch_api_key" \ + --dry-run=client -o yaml | kubectl apply -f - + ;; + serverless) + kubectl create secret generic "$SECRET_NAME" \ + --namespace "$NAMESPACE" \ + --from-literal=elastic_otlp_endpoint="$elasticsearch_endpoint" \ + --from-literal=elastic_api_key="$elasticsearch_api_key" \ + --dry-run=client -o yaml | kubectl apply -f - + ;; esac } install_kube_stack() { case "$deployment_type" in - cloud-hosted) - VALUES_URL="$KUBE_STACK_VALUES_URL_CLOUD" - ;; - serverless) - VALUES_URL="$KUBE_STACK_VALUES_URL_SERVERLESS" - ;; + cloud-hosted) + VALUES_URL="$KUBE_STACK_VALUES_URL_CLOUD" + ;; + serverless) + VALUES_URL="$KUBE_STACK_VALUES_URL_SERVERLESS" + ;; esac helm upgrade --install "$KUBE_STACK_RELEASE" "$KUBE_STACK_CHART" \ @@ -219,7 +241,6 @@ destroy_docker() { echo } - destroy_k8s() { echo helm uninstall "$DEMO_RELEASE" --ignore-not-found @@ -262,7 +283,7 @@ main() { usage fi - if [ "$deployment_type" != "cloud-hosted" ] && [ "$deployment_type" != "serverless" ]; then + if [ "$deployment_type" != "cloud-hosted" ] && [ "$deployment_type" != "serverless" ]; then usage fi From ab5c1eef908cfddb86423db56102081509a729a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=B3nal=20O=27Sullivan?= Date: Wed, 10 Dec 2025 16:44:13 +0000 Subject: [PATCH 21/33] Log out debug info to see what is going on with the k8s test --- test/elastic/basic_k8s_test.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/elastic/basic_k8s_test.sh b/test/elastic/basic_k8s_test.sh index fc0f8c38f2..b9e5eb0b4e 100755 --- a/test/elastic/basic_k8s_test.sh +++ b/test/elastic/basic_k8s_test.sh @@ -36,9 +36,14 @@ function assert_demo_destroyed() { } function test_launch_demo_k8s() { + echo "DEBUG: Starting K8s test with cloud-hosted deployment" + echo "DEBUG: Checking kubectl and helm availability" + kubectl version --client + helm version + echo "DEBUG: About to call assert_demo_launched" assert_demo_launched "cloud-hosted" "k8s" + echo "DEBUG: K8s test completed" } - function test_destroy_demo_k8s() { assert_demo_destroyed "k8s" } From 0c7b92f0bb010bad5b46fd34135e6fff9f9a427d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=B3nal=20O=27Sullivan?= Date: Thu, 11 Dec 2025 09:17:56 +0000 Subject: [PATCH 22/33] Update elastic README to remove Managed Ingest Endpoint and replace it with mOTLP --- .github/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/README.md b/.github/README.md index a2a6b1db91..0e1164b527 100644 --- a/.github/README.md +++ b/.github/README.md @@ -26,7 +26,7 @@ Additionally, the OpenTelemetry Contrib collector has also been changed to the [ - Deployment type: `cloud-hosted` - Platform: `docker` -#### Managed Ingest Endpoint +#### mOTLP 1. Sign up for a free trial on [Elastic Cloud](https://cloud.elastic.co/) and start an Elastic Cloud Serverless Observability type project. Select Add data, Application and then OpenTelemetry. 2. Copy the OTEL_EXPORTER_OTLP_ENDPOINT URL. 3. Click "Create an API Key" to create one. @@ -68,7 +68,7 @@ make start make start ``` -#### Managed Ingest Endpoint +#### mOTLP 1. Sign up for a free trial on [Elastic Cloud](https://cloud.elastic.co/) and start an Elastic Cloud Serverless Observability type project. Select Add data, Application and then OpenTelemetry. 2. Copy the OTEL_EXPORTER_OTLP_ENDPOINT URL. @@ -94,7 +94,7 @@ make start - **Elasticsearch exporter:** Run `./demo.sh` and enter: - Deployment type: `cloud-hosted` - Platform: `k8s` -- **Managed Ingest Endpoint:** Run `./demo.sh` and enter: +- **mOTLP:** Run `./demo.sh` and enter: - Deployment type: `serverless` - Platform: `k8s` From b2f308c7ef44ce6c4a829fdac822672ebc7c2bd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=B3nal=20O=27Sullivan?= Date: Thu, 11 Dec 2025 09:27:31 +0000 Subject: [PATCH 23/33] Skip elastic k8s integration tests as helm is causing missing values to be null --- test/elastic/basic_k8s_test.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/test/elastic/basic_k8s_test.sh b/test/elastic/basic_k8s_test.sh index b9e5eb0b4e..68cdc2d4d2 100755 --- a/test/elastic/basic_k8s_test.sh +++ b/test/elastic/basic_k8s_test.sh @@ -36,14 +36,18 @@ function assert_demo_destroyed() { } function test_launch_demo_k8s() { - echo "DEBUG: Starting K8s test with cloud-hosted deployment" - echo "DEBUG: Checking kubectl and helm availability" - kubectl version --client - helm version - echo "DEBUG: About to call assert_demo_launched" + # TODO: Re-enable once the helm charts have been updated + # for k8s in elastic agent, at present k8s fails due to a helm mapping null to missing fields + # This PR fixes the issue -> https://github.com/elastic/elastic-agent/pull/11481 + bashunit::skip "K8s test disabled: helm chart null mapping issue" && return + assert_demo_launched "cloud-hosted" "k8s" - echo "DEBUG: K8s test completed" } + function test_destroy_demo_k8s() { + # TODO: Re-enable once the helm charts have been updated + # for k8s in elastic agent, see above comment for more info. + bashunit::skip "K8s test disabled: helm chart null mapping issue" && return + assert_demo_destroyed "k8s" } From c670473cbfbbc25a9024748348c6e15dabc5f3f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=B3nal=20O=27Sullivan?= Date: Thu, 11 Dec 2025 16:55:00 +0000 Subject: [PATCH 24/33] Move the bashunit env var to .env.override --- .env | 1 - .env.override | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.env b/.env index 38e698ceaf..6856bac573 100644 --- a/.env +++ b/.env @@ -177,4 +177,3 @@ JAEGER_GRPC_PORT=4317 PROMETHEUS_PORT=9090 PROMETHEUS_HOST=prometheus PROMETHEUS_ADDR=${PROMETHEUS_HOST}:${PROMETHEUS_PORT} -BASHUNIT_BOOTSTRAP=test/elastic/bootstrap.sh diff --git a/.env.override b/.env.override index ae6a318a77..79b8dab1e9 100644 --- a/.env.override +++ b/.env.override @@ -21,3 +21,7 @@ OTEL_COLLECTOR_CONFIG="./src/otel-collector/otelcol-elastic-config.yaml" ELASTICSEARCH_ENDPOINT="YOUR_ENDPOINT" ELASTICSEARCH_API_KEY="YOUR_API_KEY" +# ********************* +# Bashunit Tests +# ********************* +BASHUNIT_BOOTSTRAP=test/elastic/bootstrap.sh From 75943b64de3c74d5270418216f5c4c53e542b7ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=B3nal=20O=27Sullivan?= Date: Thu, 11 Dec 2025 16:55:37 +0000 Subject: [PATCH 25/33] Remove the newline added --- .github/workflows/run-integration-tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/run-integration-tests.yml b/.github/workflows/run-integration-tests.yml index 0162aa2a52..a64c774b38 100644 --- a/.github/workflows/run-integration-tests.yml +++ b/.github/workflows/run-integration-tests.yml @@ -21,4 +21,3 @@ jobs: - name: run tracetesting run: | make build && docker system prune -f && make run-tracetesting - From d0da9e43e13ca6bad0344bf50f3ce66848cf839a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=B3nal=20O=27Sullivan?= Date: Thu, 11 Dec 2025 16:55:52 +0000 Subject: [PATCH 26/33] Update the bashunit integration tests to use maximize-build-space workflows to allow space on the VM to run the docker and k8s tests, also we install bashunit at bin, not lib. --- .../run-integration-tests-elastic.yml | 24 ++++++++----------- .gitignore | 3 --- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/.github/workflows/run-integration-tests-elastic.yml b/.github/workflows/run-integration-tests-elastic.yml index c8c89a05a9..10c3de9e41 100644 --- a/.github/workflows/run-integration-tests-elastic.yml +++ b/.github/workflows/run-integration-tests-elastic.yml @@ -16,12 +16,17 @@ jobs: name: Test runs-on: ubuntu-latest - strategy: - fail-fast: false - steps: - name: Checkout uses: actions/checkout@v4 + + - name: Maximize build space + uses: easimon/maximize-build-space@master + with: + remove-dotnet: 'true' + remove-android: 'true' + remove-haskell: 'true' + remove-codeql: 'true' - name: Set up Docker Compose uses: docker/setup-compose-action@v1 @@ -34,17 +39,8 @@ jobs: - name: Install bashunit run: | - curl -s https://bashunit.typeddevs.com/install.sh | bash + curl -s https://bashunit.typeddevs.com/install.sh | bash -s bin - - name: Free up disk space - run: | - sudo rm -rf /usr/share/dotnet - sudo rm -rf /usr/local/lib/android - sudo rm -rf /opt/ghc - sudo rm -rf /opt/hostedtoolcache/CodeQL - docker system prune -af --volumes - sudo apt-get clean - - name: Run the tests run: | - ./lib/bashunit --env .env.bashunit + ./bin/bashunit --env .env.bashunit diff --git a/.gitignore b/.gitignore index 7ab4ee42e8..4dacf35195 100644 --- a/.gitignore +++ b/.gitignore @@ -53,6 +53,3 @@ test/tracetesting/tracetesting-vars.yaml *.apk !src/currency/build - -#Bash unit -lib/ From 66b577f87192dc6a59d13a972146e29d13f833c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=B3nal=20O=27Sullivan?= Date: Fri, 12 Dec 2025 09:24:05 +0000 Subject: [PATCH 27/33] Remove dotnet and androind from ubuntu test runner for elastic integration tests --- .github/workflows/run-integration-tests-elastic.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/run-integration-tests-elastic.yml b/.github/workflows/run-integration-tests-elastic.yml index 10c3de9e41..08c5e7d48b 100644 --- a/.github/workflows/run-integration-tests-elastic.yml +++ b/.github/workflows/run-integration-tests-elastic.yml @@ -25,8 +25,6 @@ jobs: with: remove-dotnet: 'true' remove-android: 'true' - remove-haskell: 'true' - remove-codeql: 'true' - name: Set up Docker Compose uses: docker/setup-compose-action@v1 From 494ca31b282b84cfa76182069b561c66a4d5aa96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=B3nal=20O=27Sullivan?= Date: Fri, 12 Dec 2025 09:27:28 +0000 Subject: [PATCH 28/33] Use 4 core ubuntu for running elastic integration tests in CI, the reason we need this is the standard option runs out of resources for the k8s test run --- .github/workflows/run-integration-tests-elastic.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/run-integration-tests-elastic.yml b/.github/workflows/run-integration-tests-elastic.yml index 08c5e7d48b..9da884fc03 100644 --- a/.github/workflows/run-integration-tests-elastic.yml +++ b/.github/workflows/run-integration-tests-elastic.yml @@ -14,18 +14,12 @@ permissions: jobs: run-tests: name: Test - runs-on: ubuntu-latest + runs-on: ubuntu-latest-4-cores steps: - name: Checkout uses: actions/checkout@v4 - - name: Maximize build space - uses: easimon/maximize-build-space@master - with: - remove-dotnet: 'true' - remove-android: 'true' - - name: Set up Docker Compose uses: docker/setup-compose-action@v1 From e362a1ae8ce3da40a5f76c94e013edac29537984 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=B3nal=20O=27Sullivan?= Date: Fri, 12 Dec 2025 09:33:40 +0000 Subject: [PATCH 29/33] Run the elastic integration tests in the CI on ubuntu latest --- .github/workflows/run-integration-tests-elastic.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-integration-tests-elastic.yml b/.github/workflows/run-integration-tests-elastic.yml index 9da884fc03..badf9def7e 100644 --- a/.github/workflows/run-integration-tests-elastic.yml +++ b/.github/workflows/run-integration-tests-elastic.yml @@ -14,7 +14,7 @@ permissions: jobs: run-tests: name: Test - runs-on: ubuntu-latest-4-cores + runs-on: ubuntu-latest steps: - name: Checkout From 8e9a55c1105029fbc91d389e89e337a2998e7239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=B3nal=20O=27Sullivan?= Date: Fri, 12 Dec 2025 09:45:32 +0000 Subject: [PATCH 30/33] Only install elastic search for elastic integration tests in CI, this is to reduce the resource overhead --- test/elastic/utils.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/elastic/utils.sh b/test/elastic/utils.sh index 2e72d0fd44..c56567fcde 100644 --- a/test/elastic/utils.sh +++ b/test/elastic/utils.sh @@ -24,7 +24,7 @@ function get_http_response_code() { function start_local_elastic_stack() { printf "CURRENT_DIR=%s\n" "$CURRENT_DIR" - curl -fsSL https://elastic.co/start-local | sh + curl -fsSL https://elastic.co/start-local | sh -s -- --esonly # shellcheck source=test/elastic/bootstrap.sh source "${START_LOCAL_ENV_PATH}" sleep 2 From 83ce2ae70e9eae425adb47fa5b792d50fbdc6b31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=B3nal=20O=27Sullivan?= Date: Fri, 12 Dec 2025 09:57:39 +0000 Subject: [PATCH 31/33] Maximise build space for elastic CI tests --- .github/workflows/run-integration-tests-elastic.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/run-integration-tests-elastic.yml b/.github/workflows/run-integration-tests-elastic.yml index badf9def7e..6c0897250c 100644 --- a/.github/workflows/run-integration-tests-elastic.yml +++ b/.github/workflows/run-integration-tests-elastic.yml @@ -17,6 +17,11 @@ jobs: runs-on: ubuntu-latest steps: + - name: Maximize build space + uses: easimon/maximize-build-space@master + with: + remove-dotnet: 'true' + - name: Checkout uses: actions/checkout@v4 From 97387eba23ce88d3815a1012ec6942adcc247a6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=B3nal=20O=27Sullivan?= Date: Fri, 12 Dec 2025 10:26:52 +0000 Subject: [PATCH 32/33] Use ubuntu-slim for elastic integration tests to address resource issues --- .github/workflows/run-integration-tests-elastic.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/run-integration-tests-elastic.yml b/.github/workflows/run-integration-tests-elastic.yml index 6c0897250c..0a3e8c023f 100644 --- a/.github/workflows/run-integration-tests-elastic.yml +++ b/.github/workflows/run-integration-tests-elastic.yml @@ -14,14 +14,9 @@ permissions: jobs: run-tests: name: Test - runs-on: ubuntu-latest + runs-on: ubuntu-slim steps: - - name: Maximize build space - uses: easimon/maximize-build-space@master - with: - remove-dotnet: 'true' - - name: Checkout uses: actions/checkout@v4 From 76a567c538a6aa17b7323a56f4271ff1f10a477b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=B3nal=20O=27Sullivan?= Date: Fri, 12 Dec 2025 10:36:20 +0000 Subject: [PATCH 33/33] Perform disc cleanup before running elastic integration tests in CI --- .github/workflows/run-integration-tests-elastic.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-integration-tests-elastic.yml b/.github/workflows/run-integration-tests-elastic.yml index 0a3e8c023f..49d9aee06d 100644 --- a/.github/workflows/run-integration-tests-elastic.yml +++ b/.github/workflows/run-integration-tests-elastic.yml @@ -14,9 +14,15 @@ permissions: jobs: run-tests: name: Test - runs-on: ubuntu-slim + runs-on: ubuntu-latest steps: + - name: Free up disk space + run: | + sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL + sudo docker image prune --all --force + sudo docker builder prune -a + - name: Checkout uses: actions/checkout@v4