From 9996f30105cd1473e7b41448fc793277bdd5477e Mon Sep 17 00:00:00 2001 From: mehul gautam Date: Sun, 14 Jul 2024 22:24:44 +0000 Subject: [PATCH] fixed Signed-off-by: mehul gautam --- examples/hotrod/docker-compose.yml | 5 ++++- scripts/hotrod-integration-test.sh | 34 +++++++++++++++++------------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/examples/hotrod/docker-compose.yml b/examples/hotrod/docker-compose.yml index c034402dca5..18c93fc6445 100644 --- a/examples/hotrod/docker-compose.yml +++ b/examples/hotrod/docker-compose.yml @@ -15,7 +15,10 @@ services: - jaeger-example hotrod: - image: ${REGISTRY:-}jaegertracing/example-hotrod:${JAEGER_VERSION:-latest} + image: ${REGISTRY:-}jaegertracing/example-hotrod:${GITHUB_SHA:-${JAEGER_VERSION:-latest}} + # To run the latest trunk build, find the tag at Docker Hub and use the line below + # https://hub.docker.com/r/jaegertracing/example-hotrod-snapshot/tags + #image: jaegertracing/example-hotrod-snapshot:0ab8f2fcb12ff0d10830c1ee3bb52b745522db6c ports: - "8080:8080" - "8083:8083" diff --git a/scripts/hotrod-integration-test.sh b/scripts/hotrod-integration-test.sh index 22b34de93c0..ecd292ee579 100755 --- a/scripts/hotrod-integration-test.sh +++ b/scripts/hotrod-integration-test.sh @@ -2,43 +2,47 @@ set -euxf -o pipefail +docker_compose_file="./examples/hotrod/docker-compose.yml" +export REGISTRY="localhost:5000/" +platforms="linux/amd64,linux/s390x,linux/ppc64le,linux/arm64" + +teardown() { + echo "Tearing down..." + docker compose -f "$docker_compose_file" down +} +trap teardown EXIT + make build-examples GOOS=linux GOARCH=amd64 make build-examples GOOS=linux GOARCH=s390x make build-examples GOOS=linux GOARCH=ppc64le make build-examples GOOS=linux GOARCH=arm64 - -platforms="linux/amd64,linux/s390x,linux/ppc64le,linux/arm64" make prepare-docker-buildx -# build image locally (-l) for integration test +# Build image locally (-l) for integration test bash scripts/build-upload-a-docker-image.sh -l -c example-hotrod -d examples/hotrod -p "${platforms}" -export HOTROD_IMAGE="localhost:5000/jaegertracing/example-hotrod" -docker compose -f ./examples/hotrod/docker-compose.yml up -d +docker compose -f "$docker_compose_file" up -d i=0 -while [[ "$(curl -s -o /dev/null -w '%{http_code}' localhost:8080)" != "200" && ${i} -lt 30 ]]; do +while [[ "$(curl -s -o /dev/null -w '%{http_code}' localhost:8080)" != "200" && $i -lt 30 ]]; do sleep 1 i=$((i+1)) done + body=$(curl localhost:8080) if [[ $body != *"Rides On Demand"* ]]; then echo "String \"Rides On Demand\" is not present on the index page" exit 1 fi -curl -X POST "http://localhost:8080/dispatch?customer=123" -# Extract the logs from the docker compose service -logs=$(docker compose -f ./examples/hotrod/docker-compose.yml logs hotrod) - -# Extract the trace_id from the logs -TRACE_ID=$(echo "$logs" | grep -oP '(?<="trace_id": ")[^"]+' | tail -n 1) +response=$(curl -i -X POST "http://localhost:8080/dispatch?customer=123") +TRACE_ID=$(echo "$response" | grep -Fi "Traceresponse" | awk '{print $2}' | cut -d '-' -f 2) JAEGER_QUERY_URL="http://localhost:16686" -EXPECTED_SPANS=10 # Change this to the expected number of spans -MAX_RETRIES=30 -SLEEP_INTERVAL=10 +EXPECTED_SPANS=10 +MAX_RETRIES=30 +SLEEP_INTERVAL=10 # Function to poll Jaeger for the trace poll_jaeger() {