From 3db3c5702b83ae3d519137725947a910abd493dc Mon Sep 17 00:00:00 2001 From: Ron Federman Date: Mon, 3 Feb 2025 15:10:50 +0200 Subject: [PATCH 1/3] print all traces from tempo when e2e fails --- tests/common/traceql/all_traces.yaml | 7 +++++++ tests/common/traceql_runner.sh | 16 ++++++++++++++-- tests/e2e/cli-upgrade/chainsaw-test.yaml | 4 ++++ 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 tests/common/traceql/all_traces.yaml diff --git a/tests/common/traceql/all_traces.yaml b/tests/common/traceql/all_traces.yaml new file mode 100644 index 0000000000..682ad27301 --- /dev/null +++ b/tests/common/traceql/all_traces.yaml @@ -0,0 +1,7 @@ +apiVersion: e2e.tests.odigos.io/v1 +kind: TraceTest +description: This query all the traces, and used for debugging +query: | + {} +expected: + minimum: 1 \ No newline at end of file diff --git a/tests/common/traceql_runner.sh b/tests/common/traceql_runner.sh index af7fb1d2c6..0ba8f465f3 100755 --- a/tests/common/traceql_runner.sh +++ b/tests/common/traceql_runner.sh @@ -32,6 +32,7 @@ function process_yaml_file() { local dest_namespace="traces" local dest_service="e2e-tests-tempo" local dest_port="tempo-prom-metrics" + local verbose=$2 local file=$1 file_name=$(basename "$file") @@ -44,7 +45,14 @@ function process_yaml_file() { one_hour=3600 start_epoch=$(($current_epoch - one_hour)) end_epoch=$(($current_epoch + one_hour)) + response=$(kubectl get --raw /api/v1/namespaces/$dest_namespace/services/$dest_service:$dest_port/proxy/api/search\?end=$end_epoch\&start=$start_epoch\&q=$encoded_query\&limit=50) + if [ "$verbose" == "true" ]; then + echo "==============Raw response from tempo====================" + echo "$response" | jq .traces + echo "=========================================================" + fi + num_of_traces=$(echo $response | jq '.traces | length') if [ "$expected_count" != "null" ]; then @@ -71,12 +79,16 @@ function process_yaml_file() { # Check if the first argument is provided if [ -z "$1" ]; then - echo "Usage: $0 " + echo "Usage: $0 [--verbose]" exit 1 fi # Test file path TEST_FILE=$1 +VERBOSE=false +if [ "$2" == "--verbose" ]; then + VERBOSE=true +fi # Check if yq is installed if ! command -v yq &> /dev/null; then @@ -85,4 +97,4 @@ if ! command -v yq &> /dev/null; then fi verify_yaml_schema $TEST_FILE -process_yaml_file $TEST_FILE +process_yaml_file $TEST_FILE $VERBOSE diff --git a/tests/e2e/cli-upgrade/chainsaw-test.yaml b/tests/e2e/cli-upgrade/chainsaw-test.yaml index 4bd44ba2a3..a22ab0eb54 100644 --- a/tests/e2e/cli-upgrade/chainsaw-test.yaml +++ b/tests/e2e/cli-upgrade/chainsaw-test.yaml @@ -170,6 +170,10 @@ spec: sleep 5 fi done + catch: + - script: + content: | + ../../common/traceql_runner.sh ../../common/traceql/all_traces.yaml --verbose - name: Verify Trace - Context Propagation try: - script: From 393e0ad9a58fe41798816d769241e28dfaf53621 Mon Sep 17 00:00:00 2001 From: Ron Federman Date: Mon, 3 Feb 2025 15:40:29 +0200 Subject: [PATCH 2/3] filter health check --- tests/common/traceql/all_traces.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/common/traceql/all_traces.yaml b/tests/common/traceql/all_traces.yaml index 682ad27301..13fb09b50b 100644 --- a/tests/common/traceql/all_traces.yaml +++ b/tests/common/traceql/all_traces.yaml @@ -2,6 +2,7 @@ apiVersion: e2e.tests.odigos.io/v1 kind: TraceTest description: This query all the traces, and used for debugging query: | - {} +# filter health check spans + {name != "GET /actuator/health/**"} expected: minimum: 1 \ No newline at end of file From 877fc9c3e03be7f1aa14b841e769d696d7f232e1 Mon Sep 17 00:00:00 2001 From: Ron Federman Date: Mon, 3 Feb 2025 16:00:10 +0200 Subject: [PATCH 3/3] fix traceql file --- tests/common/traceql/all_traces.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/common/traceql/all_traces.yaml b/tests/common/traceql/all_traces.yaml index 13fb09b50b..09b877ec75 100644 --- a/tests/common/traceql/all_traces.yaml +++ b/tests/common/traceql/all_traces.yaml @@ -2,7 +2,6 @@ apiVersion: e2e.tests.odigos.io/v1 kind: TraceTest description: This query all the traces, and used for debugging query: | -# filter health check spans {name != "GET /actuator/health/**"} expected: minimum: 1 \ No newline at end of file