From bd5a86e5a607374c53b35a7404d71a81fd291f0d Mon Sep 17 00:00:00 2001 From: mehul gautam Date: Wed, 17 Jul 2024 05:20:09 +0000 Subject: [PATCH] return 0 if jq fails Signed-off-by: mehul gautam --- scripts/hotrod-integration-test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/hotrod-integration-test.sh b/scripts/hotrod-integration-test.sh index f6085140b69..690da495df9 100755 --- a/scripts/hotrod-integration-test.sh +++ b/scripts/hotrod-integration-test.sh @@ -45,7 +45,7 @@ if [[ $body != *"Rides On Demand"* ]]; then fi 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) +TRACE_ID=$(echo "$response" | grep -Fi "Traceresponse:" | awk '{print $2}' | cut -d '-' -f 2) if [ -n "$TRACE_ID" ]; then echo "TRACE_ID is not empty: $TRACE_ID" @@ -64,7 +64,7 @@ poll_jaeger() { local trace_id=$1 local url="${JAEGER_QUERY_URL}/api/traces/${trace_id}" - curl -s "${url}" | jq '.data[0].spans | length' + curl -s "${url}" | jq '.data[0].spans | length' || 0 } # Polling loop