From 5facc7c8e751cf4d02b8de912562643638820e09 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Fri, 20 Feb 2026 11:37:52 +0500 Subject: [PATCH 01/83] add changes in sub module --- envgene.sh | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++ test-runner.sh | 50 +++++++++++++++++++++++++++++++++++++--- 2 files changed, 109 insertions(+), 3 deletions(-) create mode 100644 envgene.sh diff --git a/envgene.sh b/envgene.sh new file mode 100644 index 0000000..669bd2c --- /dev/null +++ b/envgene.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +load_envgene() { + + if [ -z "${ATP_ENVGENE_CONFIGURATION:-}" ]; then + echo " ATP_ENVGENE_CONFIGURATION is empty, skipping EnvGene mapping" + return + fi + + echo " Loading EnvGene configuration..." + + export PUBLIC_GATEWAY_URL=$(echo "$ATP_ENVGENE_CONFIGURATION" \ + | jq -r '.systems[] | .["public-gateway"]? // empty + | .connections[0].HTTP.url // empty') + + export PUBLIC_GATEWAY_LOGIN=$(echo "$ATP_ENVGENE_CONFIGURATION" \ + | jq -r '.systems[] | .["public-gateway"]? // empty + | .connections[0].HTTP.login // empty') + + export PUBLIC_GATEWAY_PASSWORD=$(echo "$ATP_ENVGENE_CONFIGURATION" \ + | jq -r '.systems[] | .["public-gateway"]? // empty + | .connections[0].HTTP.password // empty') + + + export PRIVATE_GATEWAY_URL=$(echo "$ATP_ENVGENE_CONFIGURATION" \ + | jq -r '.systems[] | .["private-gateway"]? // empty + | .connections[0].HTTP.url // empty') + + export INTERNAL_GATEWAY_URL=$(echo "$ATP_ENVGENE_CONFIGURATION" \ + | jq -r '.systems[] | .["internal-gateway"]? // empty + | .connections[0].HTTP.url // empty') + + export OPENSEARCH_URL=$(echo "$ATP_ENVGENE_CONFIGURATION" \ + | jq -r '.systems[] | .["opensearch"]? // empty + | .connections[0].HTTP.url // empty') + + export HUAWEI_URL=$(echo "$ATP_ENVGENE_CONFIGURATION" \ + | jq -r '.systems[] | .["huawei"]? // empty + | .connections[0].HTTP.url // empty') + + export HUAWEI_LOGIN=$(echo "$ATP_ENVGENE_CONFIGURATION" \ + | jq -r '.systems[] | .["huawei"]? // empty + | .connections[0].HTTP.login // empty') + + export HUAWEI_PASSWORD=$(echo "$ATP_ENVGENE_CONFIGURATION" \ + | jq -r '.systems[] | .["huawei"]? // empty + | .connections[0].HTTP.password // empty') + export MONITORING_ALARM_ENGINE_URL=$(echo "$ATP_ENVGENE_CONFIGURATION" \ + | jq -r '.systems[] | .["monitoring-alarm-engine"]? // empty + | .connections[0].HTTP.url // empty') + + export KAFKA_PLATFORM_URL=$(echo "$ATP_ENVGENE_CONFIGURATION" \ + | jq -r '.systems[] | .["kafka-platform"]? // empty + | .connections[0].HTTP.url // empty') + + + echo "EnvGene mapped:" + echo " PUBLIC_GATEWAY_URL=$PUBLIC_GATEWAY_URL" + echo " PRIVATE_GATEWAY_URL=$PRIVATE_GATEWAY_URL" + echo " INTERNAL_GATEWAY_URL=$INTERNAL_GATEWAY_URL" + echo " OPENSEARCH_URL=$OPENSEARCH_URL" +} diff --git a/test-runner.sh b/test-runner.sh index 7f49767..e2fc27e 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -26,11 +26,55 @@ run_tests() { # Execute test suite echo "πŸš€ Running test suite..." - chmod +x start_tests.sh - ./start_tests.sh || TEST_EXIT_CODE=$? + + if [ -f "./start_tests.sh" ]; then + chmod +x ./start_tests.sh + ./start_tests.sh || TEST_EXIT_CODE=$? + elif [ -d "./collections" ]; then + echo "ℹ️ start_tests.sh not found, but collections/ detected β€” running default Bruno runner" + run_bruno_from_test_params || TEST_EXIT_CODE=$? + else + echo "❌ Neither start_tests.sh nor collections/ directory found in tests repo" + exit 1 + fi TEST_EXIT_CODE=${TEST_EXIT_CODE:-0} echo "ℹ️ Test script exited with code: $TEST_EXIT_CODE (but continuing...)" echo "βœ… Test execution completed" -} \ No newline at end of file +} + +run_bruno_from_test_params() { + echo "πŸ”§ TEST_PARAMS: ${TEST_PARAMS:-}" + echo "${TEST_PARAMS:-{}}" > /tmp/test_params.json + + BRUNO_ENV=$(jq -r '.env // empty' /tmp/test_params.json) + if [ -z "$BRUNO_ENV" ]; then + echo "❌ TEST_PARAMS.env is required for Bruno auto-run" + return 1 + fi + echo "πŸ”§ Using Bruno environment: $BRUNO_ENV" + + # Бписок ΠΊΠΎΠ»Π»Π΅ΠΊΡ†ΠΈΠΉ + mapfile -t COLLECTIONS < <(jq -r '.collections[]? // empty' /tmp/test_params.json) + if [ ${#COLLECTIONS[@]} -eq 0 ]; then + echo "❌ No collections provided in TEST_PARAMS" + return 1 + fi + + # Π€Π»Π°Π³ΠΈ + BRUNO_FLAGS=$(jq -r '.flags[]? // empty' /tmp/test_params.json | xargs) + + # Π”ΠΎΠΏΠΎΠ»Π½ΠΈΡ‚Π΅Π»ΡŒΠ½Ρ‹Π΅ env_vars β†’ Π² ΠΎΠΊΡ€ΡƒΠΆΠ΅Π½ΠΈΠ΅ + while IFS="=" read -r KEY VALUE; do + [ -z "$KEY" ] && continue + export "$KEY"="$VALUE" + done < <(jq -r '.env_vars // {} | to_entries[] | "\(.key)=\(.value)"' /tmp/test_params.json) + echo "βœ… Env variables loaded from TEST_PARAMS" + + for COL in "${COLLECTIONS[@]}"; do + echo "β–Ά bru run $COL --env $BRUNO_ENV $BRUNO_FLAGS" + bru run "$COL" --env "$BRUNO_ENV" $BRUNO_FLAGS || return 1 + done + echo "βœ… Bruno tests completed successfully" +} \ No newline at end of file From fe74601ccb60d83a9e15a1885dfc3fa453bf3222 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Tue, 24 Feb 2026 11:44:35 +0500 Subject: [PATCH 02/83] add debug for check all params --- test-runner.sh | 72 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 65 insertions(+), 7 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index e2fc27e..e05056c 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -43,11 +43,31 @@ run_tests() { echo "βœ… Test execution completed" } - run_bruno_from_test_params() { - echo "πŸ”§ TEST_PARAMS: ${TEST_PARAMS:-}" + + echo "πŸ“ Current working directory: $(pwd)" + echo "πŸ“ TMP_DIR: $TMP_DIR" + echo "πŸ“ Listing root directory:" + ls -la + echo "πŸ“ Listing collections directory:" + ls -la ./collections 2>/dev/null || echo "⚠️ collections directory not found" + echo "πŸ”§ Bruno version:" + bru --version || echo "⚠️ Bruno not found" + echo "πŸ”§ Node version:" + node --version + echo "πŸ”§ NPM version:" + npm --version + echo "" + + echo "πŸ”§ TEST_PARAMS raw:" + echo "${TEST_PARAMS:-}" + echo "${TEST_PARAMS:-{}}" > /tmp/test_params.json + echo "πŸ”Ž Parsed TEST_PARAMS:" + cat /tmp/test_params.json + echo "" + BRUNO_ENV=$(jq -r '.env // empty' /tmp/test_params.json) if [ -z "$BRUNO_ENV" ]; then echo "❌ TEST_PARAMS.env is required for Bruno auto-run" @@ -55,26 +75,64 @@ run_bruno_from_test_params() { fi echo "πŸ”§ Using Bruno environment: $BRUNO_ENV" - # Бписок ΠΊΠΎΠ»Π»Π΅ΠΊΡ†ΠΈΠΉ mapfile -t COLLECTIONS < <(jq -r '.collections[]? // empty' /tmp/test_params.json) if [ ${#COLLECTIONS[@]} -eq 0 ]; then echo "❌ No collections provided in TEST_PARAMS" return 1 fi - # Π€Π»Π°Π³ΠΈ BRUNO_FLAGS=$(jq -r '.flags[]? // empty' /tmp/test_params.json | xargs) - # Π”ΠΎΠΏΠΎΠ»Π½ΠΈΡ‚Π΅Π»ΡŒΠ½Ρ‹Π΅ env_vars β†’ Π² ΠΎΠΊΡ€ΡƒΠΆΠ΅Π½ΠΈΠ΅ while IFS="=" read -r KEY VALUE; do [ -z "$KEY" ] && continue export "$KEY"="$VALUE" done < <(jq -r '.env_vars // {} | to_entries[] | "\(.key)=\(.value)"' /tmp/test_params.json) + echo "βœ… Env variables loaded from TEST_PARAMS" + echo "" for COL in "${COLLECTIONS[@]}"; do - echo "β–Ά bru run $COL --env $BRUNO_ENV $BRUNO_FLAGS" - bru run "$COL" --env "$BRUNO_ENV" $BRUNO_FLAGS || return 1 + + echo "--------------------------------------------------" + echo "πŸ”Ž Checking collection: $COL" + + if [ -d "$COL" ]; then + echo "βœ… Collection directory exists" + echo "πŸ“ Full path: $(realpath "$COL")" + else + echo "❌ Collection directory NOT FOUND" + echo "πŸ“‚ Available directories:" + ls -R . + return 1 + fi + + echo "πŸ“‚ Collection structure (max depth 3):" + find "$COL" -maxdepth 3 -type f + + ENV_FILE="$COL/environments/$BRUNO_ENV.bru" + echo "" + echo "πŸ”Ž Checking environment file: $ENV_FILE" + + if [ -f "$ENV_FILE" ]; then + echo "βœ… Environment file exists" + echo "----- ENV FILE START -----" + cat "$ENV_FILE" + echo "----- ENV FILE END -----" + else + echo "❌ Environment file NOT FOUND" + echo "πŸ“‚ Available env files:" + find "$COL/environments" -type f 2>/dev/null || echo "No environments folder" + return 1 + fi + + echo "" + echo "πŸš€ Executing:" + echo "bru run \"$COL\" --env \"$BRUNO_ENV\" $BRUNO_FLAGS --verbose" + echo "" + + bru run "$COL" --env "$BRUNO_ENV" $BRUNO_FLAGS --verbose || return 1 + done + echo "βœ… Bruno tests completed successfully" } \ No newline at end of file From 7ef3da5aa8cf6108116ffad2efd387c636a7573c Mon Sep 17 00:00:00 2001 From: saju1025 Date: Tue, 24 Feb 2026 12:58:41 +0500 Subject: [PATCH 03/83] modified run bruno --- test-runner.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index e05056c..bfa2c87 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -62,7 +62,7 @@ run_bruno_from_test_params() { echo "πŸ”§ TEST_PARAMS raw:" echo "${TEST_PARAMS:-}" - echo "${TEST_PARAMS:-{}}" > /tmp/test_params.json + printf "%s" "${TEST_PARAMS:-{}}" > /tmp/test_params.json echo "πŸ”Ž Parsed TEST_PARAMS:" cat /tmp/test_params.json @@ -127,10 +127,14 @@ run_bruno_from_test_params() { echo "" echo "πŸš€ Executing:" - echo "bru run \"$COL\" --env \"$BRUNO_ENV\" $BRUNO_FLAGS --verbose" + echo "cd \"$COL\" && bru run . --env \"$BRUNO_ENV\" $BRUNO_FLAGS --verbose" echo "" - bru run "$COL" --env "$BRUNO_ENV" $BRUNO_FLAGS --verbose || return 1 + ( + cd "$COL" || exit 1 + bru run . --env "$BRUNO_ENV" $BRUNO_FLAGS --verbose + ) || return 1 + done From aa034bbd2eaa7bf0cf66e9f1fa5668a8d7ef17e0 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Tue, 24 Feb 2026 16:51:15 +0500 Subject: [PATCH 04/83] changes params vars --- test-runner.sh | 92 +++++++++++++++++++------------------------------- 1 file changed, 35 insertions(+), 57 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index bfa2c87..6a6184c 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -43,98 +43,76 @@ run_tests() { echo "βœ… Test execution completed" } + run_bruno_from_test_params() { echo "πŸ“ Current working directory: $(pwd)" echo "πŸ“ TMP_DIR: $TMP_DIR" - echo "πŸ“ Listing root directory:" - ls -la - echo "πŸ“ Listing collections directory:" - ls -la ./collections 2>/dev/null || echo "⚠️ collections directory not found" - echo "πŸ”§ Bruno version:" - bru --version || echo "⚠️ Bruno not found" - echo "πŸ”§ Node version:" - node --version - echo "πŸ”§ NPM version:" - npm --version + echo "πŸ”§ Bruno version: $(bru --version 2>/dev/null || echo 'not found')" + echo "πŸ”§ Node version: $(node --version)" + echo "πŸ”§ NPM version: $(npm --version)" echo "" - echo "πŸ”§ TEST_PARAMS raw:" - echo "${TEST_PARAMS:-}" - - printf "%s" "${TEST_PARAMS:-{}}" > /tmp/test_params.json + if ! echo "$TEST_PARAMS" | jq . >/dev/null 2>&1; then + echo "❌ TEST_PARAMS is not valid JSON" + return 1 + fi - echo "πŸ”Ž Parsed TEST_PARAMS:" - cat /tmp/test_params.json - echo "" + echo "$TEST_PARAMS" | jq . > /tmp/test_params.json BRUNO_ENV=$(jq -r '.env // empty' /tmp/test_params.json) if [ -z "$BRUNO_ENV" ]; then - echo "❌ TEST_PARAMS.env is required for Bruno auto-run" + echo "❌ TEST_PARAMS.env is required" return 1 fi + echo "πŸ”§ Using Bruno environment: $BRUNO_ENV" mapfile -t COLLECTIONS < <(jq -r '.collections[]? // empty' /tmp/test_params.json) if [ ${#COLLECTIONS[@]} -eq 0 ]; then - echo "❌ No collections provided in TEST_PARAMS" + echo "❌ No collections provided" return 1 fi BRUNO_FLAGS=$(jq -r '.flags[]? // empty' /tmp/test_params.json | xargs) - while IFS="=" read -r KEY VALUE; do - [ -z "$KEY" ] && continue - export "$KEY"="$VALUE" - done < <(jq -r '.env_vars // {} | to_entries[] | "\(.key)=\(.value)"' /tmp/test_params.json) - echo "βœ… Env variables loaded from TEST_PARAMS" - echo "" + echo "πŸ”„ Syncing EnvGene variables to Bruno..." - for COL in "${COLLECTIONS[@]}"; do - - echo "--------------------------------------------------" - echo "πŸ”Ž Checking collection: $COL" + BRIDGE_VARS=( + PUBLIC_GATEWAY_URL + PRIVATE_GATEWAY_URL + INTERNAL_GATEWAY_URL + OPENSEARCH_URL + HUAWEI_URL + MONITORING_ALARM_ENGINE_URL + KAFKA_PLATFORM_URL + ) - if [ -d "$COL" ]; then - echo "βœ… Collection directory exists" - echo "πŸ“ Full path: $(realpath "$COL")" - else - echo "❌ Collection directory NOT FOUND" - echo "πŸ“‚ Available directories:" - ls -R . - return 1 + for var in "${BRIDGE_VARS[@]}"; do + value=$(printenv "$var") + if [ -n "$value" ]; then + bru set env "$var" "$value" --env "$BRUNO_ENV" >/dev/null 2>&1 + echo " βœ” $var synced" fi + done - echo "πŸ“‚ Collection structure (max depth 3):" - find "$COL" -maxdepth 3 -type f + echo "" - ENV_FILE="$COL/environments/$BRUNO_ENV.bru" - echo "" - echo "πŸ”Ž Checking environment file: $ENV_FILE" + for COL in "${COLLECTIONS[@]}"; do - if [ -f "$ENV_FILE" ]; then - echo "βœ… Environment file exists" - echo "----- ENV FILE START -----" - cat "$ENV_FILE" - echo "----- ENV FILE END -----" - else - echo "❌ Environment file NOT FOUND" - echo "πŸ“‚ Available env files:" - find "$COL/environments" -type f 2>/dev/null || echo "No environments folder" + echo "--------------------------------------------------" + echo "πŸš€ Running collection: $COL" + + if [ ! -d "$COL" ]; then + echo "❌ Collection not found: $COL" return 1 fi - echo "" - echo "πŸš€ Executing:" - echo "cd \"$COL\" && bru run . --env \"$BRUNO_ENV\" $BRUNO_FLAGS --verbose" - echo "" - ( cd "$COL" || exit 1 bru run . --env "$BRUNO_ENV" $BRUNO_FLAGS --verbose ) || return 1 - done From 873a3ffc507b50cc8190b7f0b055e09e88ee9b91 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Tue, 24 Feb 2026 18:04:41 +0500 Subject: [PATCH 05/83] update upr case in lower case --- test-runner.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test-runner.sh b/test-runner.sh index 6a6184c..4587e1a 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -93,7 +93,11 @@ run_bruno_from_test_params() { value=$(printenv "$var") if [ -n "$value" ]; then bru set env "$var" "$value" --env "$BRUNO_ENV" >/dev/null 2>&1 - echo " βœ” $var synced" + + lower=$(echo "$var" | tr '[:upper:]' '[:lower:]') + bru set env "$lower" "$value" --env "$BRUNO_ENV" >/dev/null 2>&1 + + echo " βœ” $var synced (with lowercase alias)" fi done From 6eea4c3f8b14fc39d1057e2e4c7d92b3b0cb27ff Mon Sep 17 00:00:00 2001 From: saju1025 Date: Tue, 24 Feb 2026 18:36:19 +0500 Subject: [PATCH 06/83] update export for env --- test-runner.sh | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index 4587e1a..75ab992 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -44,6 +44,7 @@ run_tests() { echo "βœ… Test execution completed" } + run_bruno_from_test_params() { echo "πŸ“ Current working directory: $(pwd)" @@ -76,31 +77,16 @@ run_bruno_from_test_params() { BRUNO_FLAGS=$(jq -r '.flags[]? // empty' /tmp/test_params.json | xargs) + export public_gateway_url="$PUBLIC_GATEWAY_URL" + export private_gateway_url="$PRIVATE_GATEWAY_URL" + export internal_gateway_url="$INTERNAL_GATEWAY_URL" + export opensearch_url="$OPENSEARCH_URL" + export huawei_url="$HUAWEI_URL" + export monitoring_alarm_engine_url="$MONITORING_ALARM_ENGINE_URL" + export kafka_platform_url="$KAFKA_PLATFORM_URL" - echo "πŸ”„ Syncing EnvGene variables to Bruno..." - - BRIDGE_VARS=( - PUBLIC_GATEWAY_URL - PRIVATE_GATEWAY_URL - INTERNAL_GATEWAY_URL - OPENSEARCH_URL - HUAWEI_URL - MONITORING_ALARM_ENGINE_URL - KAFKA_PLATFORM_URL - ) - - for var in "${BRIDGE_VARS[@]}"; do - value=$(printenv "$var") - if [ -n "$value" ]; then - bru set env "$var" "$value" --env "$BRUNO_ENV" >/dev/null 2>&1 - - lower=$(echo "$var" | tr '[:upper:]' '[:lower:]') - bru set env "$lower" "$value" --env "$BRUNO_ENV" >/dev/null 2>&1 - - echo " βœ” $var synced (with lowercase alias)" - fi - done - + echo "πŸ”Ž Effective gateway mapping:" + echo "public_gateway_url=$public_gateway_url" echo "" for COL in "${COLLECTIONS[@]}"; do From 7a6760de93de203328f60780b77c3c7795b23bc1 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Tue, 24 Feb 2026 18:43:52 +0500 Subject: [PATCH 07/83] update scripts --- test-runner.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-runner.sh b/test-runner.sh index 75ab992..16fb338 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -106,5 +106,5 @@ run_bruno_from_test_params() { done - echo "βœ… Bruno tests completed successfully" + echo " Bruno tests completed successfully" } \ No newline at end of file From 8a7b219461b74c34c470658f3d2cd9b4c662a9df Mon Sep 17 00:00:00 2001 From: saju1025 Date: Tue, 24 Feb 2026 19:50:48 +0500 Subject: [PATCH 08/83] feat: add allure --- test-runner.sh | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index 16fb338..b5c70d3 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -101,8 +101,28 @@ run_bruno_from_test_params() { ( cd "$COL" || exit 1 - bru run . --env "$BRUNO_ENV" $BRUNO_FLAGS --verbose - ) || return 1 + + COLLECTION_NAME=$(basename "$COL") + BRUNO_REPORT_PATH="$TMP_DIR/attachments/${COLLECTION_NAME}-result.json" + + mkdir -p "$TMP_DIR/attachments" + mkdir -p "$TMP_DIR/allure-results" + + echo "πŸ“„ Saving Bruno JSON report to: $BRUNO_REPORT_PATH" + + bru run . \ + --env "$BRUNO_ENV" \ + $BRUNO_FLAGS \ + --reporter-json "$BRUNO_REPORT_PATH" \ + --verbose + + echo "πŸ”„ Converting Bruno report to Allure format..." + + node /tools/bruno-to-allure.js \ + "$BRUNO_REPORT_PATH" \ + "$TMP_DIR/allure-results" + + ) done From e96fabf1895fd86524f7db56f6466f59a9cad521 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Tue, 24 Feb 2026 20:11:02 +0500 Subject: [PATCH 09/83] fix: add allure in bruno --- test-runner.sh | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index b5c70d3..7131691 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -3,9 +3,7 @@ # Test execution module run_tests() { echo "β–Ά Starting test execution..." - - # Import upload monitoring module for security functions - # A temporary solution: after moving all runner files to the app directory, you need to delete /scripts/upload-monitor.sh in all runners and leave only /app/scripts/upload-monitor.sh + # shellcheck disable=1091 if [ -f "/app/scripts/upload-monitor.sh" ]; then source "/app/scripts/upload-monitor.sh" @@ -15,20 +13,17 @@ run_tests() { echo "❌ upload-monitor.sh not found!" exit 1 fi - - # Create Allure results directory + echo "πŸ“ Creating Allure results directory..." - mkdir -p "$TMP_DIR"/allure-results + mkdir -p "$TMP_DIR/allure-results" - # Clear sensitive variables before tests echo "πŸ” Clearing sensitive environment variables before tests..." clear_sensitive_vars - # Execute test suite echo "πŸš€ Running test suite..." if [ -f "./start_tests.sh" ]; then - chmod +x ./start_tests.sh + chmod +x "./start_tests.sh" ./start_tests.sh || TEST_EXIT_CODE=$? elif [ -d "./collections" ]; then echo "ℹ️ start_tests.sh not found, but collections/ detected β€” running default Bruno runner" @@ -40,11 +35,9 @@ run_tests() { TEST_EXIT_CODE=${TEST_EXIT_CODE:-0} echo "ℹ️ Test script exited with code: $TEST_EXIT_CODE (but continuing...)" - echo "βœ… Test execution completed" } - run_bruno_from_test_params() { echo "πŸ“ Current working directory: $(pwd)" @@ -54,12 +47,12 @@ run_bruno_from_test_params() { echo "πŸ”§ NPM version: $(npm --version)" echo "" - if ! echo "$TEST_PARAMS" | jq . >/dev/null 2>&1; then + if ! jq . <<< "$TEST_PARAMS" >/dev/null 2>&1; then echo "❌ TEST_PARAMS is not valid JSON" return 1 fi - echo "$TEST_PARAMS" | jq . > /tmp/test_params.json + jq . <<< "$TEST_PARAMS" > /tmp/test_params.json BRUNO_ENV=$(jq -r '.env // empty' /tmp/test_params.json) if [ -z "$BRUNO_ENV" ]; then @@ -70,7 +63,8 @@ run_bruno_from_test_params() { echo "πŸ”§ Using Bruno environment: $BRUNO_ENV" mapfile -t COLLECTIONS < <(jq -r '.collections[]? // empty' /tmp/test_params.json) - if [ ${#COLLECTIONS[@]} -eq 0 ]; then + + if [ "${#COLLECTIONS[@]}" -eq 0 ]; then echo "❌ No collections provided" return 1 fi @@ -121,7 +115,6 @@ run_bruno_from_test_params() { node /tools/bruno-to-allure.js \ "$BRUNO_REPORT_PATH" \ "$TMP_DIR/allure-results" - ) done From 1b17dc8c2233961148fcfc4628feaddf08ee7fa8 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Wed, 25 Feb 2026 16:12:51 +0500 Subject: [PATCH 10/83] update for run all clc --- test-runner.sh | 50 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 15 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index 7131691..a786ae8 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -85,39 +85,59 @@ run_bruno_from_test_params() { for COL in "${COLLECTIONS[@]}"; do - echo "--------------------------------------------------" - echo "πŸš€ Running collection: $COL" + echo "--------------------------------------------------" - if [ ! -d "$COL" ]; then - echo "❌ Collection not found: $COL" - return 1 - fi + if [ "$COL" = "collections" ]; then + echo "πŸš€ Running ALL collections inside collections/" - ( - cd "$COL" || exit 1 + for dir in collections/*/ ; do + [ -d "$dir" ] || continue - COLLECTION_NAME=$(basename "$COL") + COLLECTION_NAME=$(basename "$dir") BRUNO_REPORT_PATH="$TMP_DIR/attachments/${COLLECTION_NAME}-result.json" mkdir -p "$TMP_DIR/attachments" mkdir -p "$TMP_DIR/allure-results" - echo "πŸ“„ Saving Bruno JSON report to: $BRUNO_REPORT_PATH" + echo "πŸš€ Running collection: $dir" - bru run . \ + bru run "$dir" \ --env "$BRUNO_ENV" \ $BRUNO_FLAGS \ --reporter-json "$BRUNO_REPORT_PATH" \ --verbose - echo "πŸ”„ Converting Bruno report to Allure format..." - node /tools/bruno-to-allure.js \ "$BRUNO_REPORT_PATH" \ "$TMP_DIR/allure-results" - ) + done + + else + echo "πŸš€ Running collection: $COL" + + if [ ! -d "$COL" ]; then + echo "❌ Collection not found: $COL" + return 1 + fi + + COLLECTION_NAME=$(basename "$COL") + BRUNO_REPORT_PATH="$TMP_DIR/attachments/${COLLECTION_NAME}-result.json" + + mkdir -p "$TMP_DIR/attachments" + mkdir -p "$TMP_DIR/allure-results" + + bru run "$COL" \ + --env "$BRUNO_ENV" \ + $BRUNO_FLAGS \ + --reporter-json "$BRUNO_REPORT_PATH" \ + --verbose + + node /tools/bruno-to-allure.js \ + "$BRUNO_REPORT_PATH" \ + "$TMP_DIR/allure-results" + fi - done +done echo " Bruno tests completed successfully" } \ No newline at end of file From 7ff4820d076de2c0b7dd261c448312d11b270d0d Mon Sep 17 00:00:00 2001 From: saju1025 Date: Thu, 26 Feb 2026 11:07:25 +0500 Subject: [PATCH 11/83] add debug --- test-runner.sh | 119 ++++++++++++++++++++++--------------------------- 1 file changed, 54 insertions(+), 65 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index a786ae8..20e59b7 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -37,107 +37,96 @@ run_tests() { echo "ℹ️ Test script exited with code: $TEST_EXIT_CODE (but continuing...)" echo "βœ… Test execution completed" } - run_bruno_from_test_params() { - echo "πŸ“ Current working directory: $(pwd)" - echo "πŸ“ TMP_DIR: $TMP_DIR" - echo "πŸ”§ Bruno version: $(bru --version 2>/dev/null || echo 'not found')" - echo "πŸ”§ Node version: $(node --version)" - echo "πŸ”§ NPM version: $(npm --version)" - echo "" + echo "================= BRUNO DEBUG START =================" + + echo "πŸ“ PWD: $(pwd)" + echo "πŸ“ Bruno path: $(which bru)" + echo "πŸ“ Bruno version: $(bru --version)" + echo "πŸ“ Node version: $(node --version)" + echo "πŸ“ NPM version: $(npm --version)" + + echo "πŸ“¦ TEST_PARAMS RAW:" + echo "$TEST_PARAMS" if ! jq . <<< "$TEST_PARAMS" >/dev/null 2>&1; then - echo "❌ TEST_PARAMS is not valid JSON" - return 1 + echo "❌ TEST_PARAMS invalid JSON" + return 1 fi jq . <<< "$TEST_PARAMS" > /tmp/test_params.json - BRUNO_ENV=$(jq -r '.env // empty' /tmp/test_params.json) - if [ -z "$BRUNO_ENV" ]; then - echo "❌ TEST_PARAMS.env is required" - return 1 - fi + echo "πŸ“¦ Parsed TEST_PARAMS:" + cat /tmp/test_params.json - echo "πŸ”§ Using Bruno environment: $BRUNO_ENV" + BRUNO_ENV=$(jq -r '.env // empty' /tmp/test_params.json) + echo "πŸ”§ BRUNO_ENV=$BRUNO_ENV" mapfile -t COLLECTIONS < <(jq -r '.collections[]? // empty' /tmp/test_params.json) - if [ "${#COLLECTIONS[@]}" -eq 0 ]; then - echo "❌ No collections provided" - return 1 - fi + echo "πŸ“¦ COLLECTIONS:" + printf '%s\n' "${COLLECTIONS[@]}" BRUNO_FLAGS=$(jq -r '.flags[]? // empty' /tmp/test_params.json | xargs) - - export public_gateway_url="$PUBLIC_GATEWAY_URL" - export private_gateway_url="$PRIVATE_GATEWAY_URL" - export internal_gateway_url="$INTERNAL_GATEWAY_URL" - export opensearch_url="$OPENSEARCH_URL" - export huawei_url="$HUAWEI_URL" - export monitoring_alarm_engine_url="$MONITORING_ALARM_ENGINE_URL" - export kafka_platform_url="$KAFKA_PLATFORM_URL" - - echo "πŸ”Ž Effective gateway mapping:" - echo "public_gateway_url=$public_gateway_url" - echo "" + echo "πŸ”§ BRUNO_FLAGS=[$BRUNO_FLAGS]" for COL in "${COLLECTIONS[@]}"; do - echo "--------------------------------------------------" + echo "==================================================" + echo "πŸš€ Running collection: $COL" - if [ "$COL" = "collections" ]; then - echo "πŸš€ Running ALL collections inside collections/" + if [ ! -d "$COL" ]; then + echo "❌ Collection not found" + return 1 + fi - for dir in collections/*/ ; do - [ -d "$dir" ] || continue + echo "πŸ“‚ Listing collection folder:" + ls -la "$COL" - COLLECTION_NAME=$(basename "$dir") + COLLECTION_NAME=$(basename "$COL") BRUNO_REPORT_PATH="$TMP_DIR/attachments/${COLLECTION_NAME}-result.json" mkdir -p "$TMP_DIR/attachments" mkdir -p "$TMP_DIR/allure-results" - echo "πŸš€ Running collection: $dir" + echo "πŸ“„ Report path: $BRUNO_REPORT_PATH" + + echo "πŸ§ͺ EXECUTING:" + echo "bru run \"$COL\" --env \"$BRUNO_ENV\" $BRUNO_FLAGS --reporter-json \"$BRUNO_REPORT_PATH\" --verbose" - bru run "$dir" \ + bru run "$COL" \ --env "$BRUNO_ENV" \ $BRUNO_FLAGS \ --reporter-json "$BRUNO_REPORT_PATH" \ --verbose - node /tools/bruno-to-allure.js \ - "$BRUNO_REPORT_PATH" \ - "$TMP_DIR/allure-results" - done + BRU_EXIT=$? + echo "πŸ”Ž Bruno exit code: $BRU_EXIT" - else - echo "πŸš€ Running collection: $COL" + echo "πŸ“‚ Attachments after run:" + ls -la "$TMP_DIR/attachments" - if [ ! -d "$COL" ]; then - echo "❌ Collection not found: $COL" - return 1 - fi + if [ ! -f "$BRUNO_REPORT_PATH" ]; then + echo "❌ REPORT FILE NOT CREATED" + else + echo "βœ… REPORT FILE EXISTS" + fi - COLLECTION_NAME=$(basename "$COL") - BRUNO_REPORT_PATH="$TMP_DIR/attachments/${COLLECTION_NAME}-result.json" + if [ $BRU_EXIT -ne 0 ]; then + echo "❌ Bruno failed. STOP." + return $BRU_EXIT + fi - mkdir -p "$TMP_DIR/attachments" - mkdir -p "$TMP_DIR/allure-results" - - bru run "$COL" \ - --env "$BRUNO_ENV" \ - $BRUNO_FLAGS \ - --reporter-json "$BRUNO_REPORT_PATH" \ - --verbose + echo "πŸ”„ Converting to Allure..." + node /tools/bruno-to-allure.js \ + "$BRUNO_REPORT_PATH" \ + "$TMP_DIR/allure-results" - node /tools/bruno-to-allure.js \ - "$BRUNO_REPORT_PATH" \ - "$TMP_DIR/allure-results" - fi + echo "πŸ“‚ Allure folder:" + ls -la "$TMP_DIR/allure-results" -done + done - echo " Bruno tests completed successfully" + echo "================= BRUNO DEBUG END =================" } \ No newline at end of file From 722c79605e3af8cdd72a3851fb67332c53d98ea3 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Thu, 26 Feb 2026 12:03:22 +0500 Subject: [PATCH 12/83] fix: runner add allure env --- test-runner.sh | 186 ++++++++++++++++++++++++++----------------------- 1 file changed, 99 insertions(+), 87 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index 20e59b7..6991bd9 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -1,132 +1,144 @@ #!/bin/bash -# Test execution module run_tests() { - echo "β–Ά Starting test execution..." - - # shellcheck disable=1091 - if [ -f "/app/scripts/upload-monitor.sh" ]; then - source "/app/scripts/upload-monitor.sh" - elif [ -f "/scripts/upload-monitor.sh" ]; then - source "/scripts/upload-monitor.sh" - else - echo "❌ upload-monitor.sh not found!" - exit 1 - fi - - echo "πŸ“ Creating Allure results directory..." - mkdir -p "$TMP_DIR/allure-results" + echo "β–Ά Starting test execution..." + + set -o pipefail + + # shellcheck disable=1091 + if [ -f "/app/scripts/upload-monitor.sh" ]; then + source "/app/scripts/upload-monitor.sh" + elif [ -f "/scripts/upload-monitor.sh" ]; then + source "/scripts/upload-monitor.sh" + else + echo "❌ upload-monitor.sh not found!" + exit 1 + fi - echo "πŸ” Clearing sensitive environment variables before tests..." - clear_sensitive_vars + echo "πŸ“ Creating Allure results directory..." + mkdir -p "$TMP_DIR/allure-results" + + echo "πŸ” Clearing sensitive environment variables before tests..." + clear_sensitive_vars + + echo "πŸš€ Running test suite..." + + if [ -f "./start_tests.sh" ]; then + chmod +x "./start_tests.sh" + ./start_tests.sh + TEST_EXIT_CODE=$? + elif [ -d "./collections" ]; then + echo "ℹ️ collections/ detected β€” running Bruno runner" + run_bruno_from_test_params + TEST_EXIT_CODE=$? + else + echo "❌ Neither start_tests.sh nor collections/ directory found" + exit 1 + fi - echo "πŸš€ Running test suite..." + TEST_EXIT_CODE=${TEST_EXIT_CODE:-0} + echo "ℹ️ Test script exited with code: $TEST_EXIT_CODE" + echo "βœ… Test execution completed" - if [ -f "./start_tests.sh" ]; then - chmod +x "./start_tests.sh" - ./start_tests.sh || TEST_EXIT_CODE=$? - elif [ -d "./collections" ]; then - echo "ℹ️ start_tests.sh not found, but collections/ detected β€” running default Bruno runner" - run_bruno_from_test_params || TEST_EXIT_CODE=$? - else - echo "❌ Neither start_tests.sh nor collections/ directory found in tests repo" - exit 1 - fi - - TEST_EXIT_CODE=${TEST_EXIT_CODE:-0} - echo "ℹ️ Test script exited with code: $TEST_EXIT_CODE (but continuing...)" - echo "βœ… Test execution completed" + return $TEST_EXIT_CODE } -run_bruno_from_test_params() { - - echo "================= BRUNO DEBUG START =================" - echo "πŸ“ PWD: $(pwd)" - echo "πŸ“ Bruno path: $(which bru)" - echo "πŸ“ Bruno version: $(bru --version)" - echo "πŸ“ Node version: $(node --version)" - echo "πŸ“ NPM version: $(npm --version)" +run_bruno_from_test_params() { - echo "πŸ“¦ TEST_PARAMS RAW:" - echo "$TEST_PARAMS" + echo "πŸ“ Current working directory: $(pwd)" + echo "πŸ“ TMP_DIR: $TMP_DIR" + echo "πŸ”§ Bruno version: $(bru --version 2>/dev/null || echo 'not found')" + echo "πŸ”§ Node version: $(node --version)" + echo "πŸ”§ NPM version: $(npm --version)" + echo "" if ! jq . <<< "$TEST_PARAMS" >/dev/null 2>&1; then - echo "❌ TEST_PARAMS invalid JSON" - return 1 + echo "❌ TEST_PARAMS is not valid JSON" + return 1 fi jq . <<< "$TEST_PARAMS" > /tmp/test_params.json - echo "πŸ“¦ Parsed TEST_PARAMS:" - cat /tmp/test_params.json - BRUNO_ENV=$(jq -r '.env // empty' /tmp/test_params.json) - echo "πŸ”§ BRUNO_ENV=$BRUNO_ENV" + if [ -z "$BRUNO_ENV" ]; then + echo "❌ TEST_PARAMS.env is required" + return 1 + fi + + echo "πŸ”§ Using Bruno environment: $BRUNO_ENV" mapfile -t COLLECTIONS < <(jq -r '.collections[]? // empty' /tmp/test_params.json) - echo "πŸ“¦ COLLECTIONS:" - printf '%s\n' "${COLLECTIONS[@]}" + if [ "${#COLLECTIONS[@]}" -eq 0 ]; then + echo "❌ No collections provided" + return 1 + fi BRUNO_FLAGS=$(jq -r '.flags[]? // empty' /tmp/test_params.json | xargs) - echo "πŸ”§ BRUNO_FLAGS=[$BRUNO_FLAGS]" + export BRUNO_ENV="$BRUNO_ENV" + export public_gateway_url="$PUBLIC_GATEWAY_URL" + export private_gateway_url="$PRIVATE_GATEWAY_URL" + export internal_gateway_url="$INTERNAL_GATEWAY_URL" + export opensearch_url="$OPENSEARCH_URL" + export huawei_url="$HUAWEI_URL" + export monitoring_alarm_engine_url="$MONITORING_ALARM_ENGINE_URL" + export kafka_platform_url="$KAFKA_PLATFORM_URL" + + echo "πŸ”Ž Effective gateway mapping:" + echo "public_gateway_url=$public_gateway_url" + echo "BRUNO_ENV=$BRUNO_ENV" + echo "" for COL in "${COLLECTIONS[@]}"; do - echo "==================================================" - echo "πŸš€ Running collection: $COL" - - if [ ! -d "$COL" ]; then - echo "❌ Collection not found" - return 1 - fi + echo "--------------------------------------------------" + echo "πŸš€ Running collection: $COL" - echo "πŸ“‚ Listing collection folder:" - ls -la "$COL" + if [ ! -d "$COL" ]; then + echo "❌ Collection not found: $COL" + return 1 + fi - COLLECTION_NAME=$(basename "$COL") - BRUNO_REPORT_PATH="$TMP_DIR/attachments/${COLLECTION_NAME}-result.json" + COLLECTION_NAME=$(basename "$COL") + BRUNO_REPORT_PATH="$TMP_DIR/attachments/${COLLECTION_NAME}-result.json" - mkdir -p "$TMP_DIR/attachments" - mkdir -p "$TMP_DIR/allure-results" + mkdir -p "$TMP_DIR/attachments" + mkdir -p "$TMP_DIR/allure-results" - echo "πŸ“„ Report path: $BRUNO_REPORT_PATH" + ( + cd collections || exit 1 - echo "πŸ§ͺ EXECUTING:" - echo "bru run \"$COL\" --env \"$BRUNO_ENV\" $BRUNO_FLAGS --reporter-json \"$BRUNO_REPORT_PATH\" --verbose" + echo "πŸ“„ Saving Bruno JSON report to: $BRUNO_REPORT_PATH" bru run "$COL" \ --env "$BRUNO_ENV" \ $BRUNO_FLAGS \ --reporter-json "$BRUNO_REPORT_PATH" \ --verbose + ) - BRU_EXIT=$? - echo "πŸ”Ž Bruno exit code: $BRU_EXIT" + BRU_EXIT_CODE=$? - echo "πŸ“‚ Attachments after run:" - ls -la "$TMP_DIR/attachments" + echo "πŸ”Ž Bruno exit code: $BRU_EXIT_CODE" - if [ ! -f "$BRUNO_REPORT_PATH" ]; then - echo "❌ REPORT FILE NOT CREATED" - else - echo "βœ… REPORT FILE EXISTS" - fi + if [ $BRU_EXIT_CODE -ne 0 ]; then + echo "❌ Bruno execution failed" + return $BRU_EXIT_CODE + fi - if [ $BRU_EXIT -ne 0 ]; then - echo "❌ Bruno failed. STOP." - return $BRU_EXIT - fi + if [ ! -f "$BRUNO_REPORT_PATH" ]; then + echo "❌ Bruno report not generated" + return 1 + fi - echo "πŸ”„ Converting to Allure..." - node /tools/bruno-to-allure.js \ - "$BRUNO_REPORT_PATH" \ - "$TMP_DIR/allure-results" + echo "πŸ”„ Converting Bruno report to Allure format..." - echo "πŸ“‚ Allure folder:" - ls -la "$TMP_DIR/allure-results" + node /tools/bruno-to-allure.js \ + "$BRUNO_REPORT_PATH" \ + "$TMP_DIR/allure-results" done - echo "================= BRUNO DEBUG END =================" + echo "βœ… Bruno tests completed successfully" + return 0 } \ No newline at end of file From 9969e8cb80787a34401c0212c86935f1f4e05681 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Thu, 26 Feb 2026 16:28:30 +0500 Subject: [PATCH 13/83] fix: bruno clc --- test-runner.sh | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index 6991bd9..86442c3 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -88,9 +88,16 @@ run_bruno_from_test_params() { echo "public_gateway_url=$public_gateway_url" echo "BRUNO_ENV=$BRUNO_ENV" echo "" - + export BRUNO_ENV="$BRUNO_ENV" + export public_gateway_url="$PUBLIC_GATEWAY_URL" + export private_gateway_url="$PRIVATE_GATEWAY_URL" + export internal_gateway_url="$INTERNAL_GATEWAY_URL" + export opensearch_url="$OPENSEARCH_URL" + export huawei_url="$HUAWEI_URL" + export monitoring_alarm_engine_url="$MONITORING_ALARM_ENGINE_URL" + export kafka_platform_url="$KAFKA_PLATFORM_URL" + for COL in "${COLLECTIONS[@]}"; do - echo "--------------------------------------------------" echo "πŸš€ Running collection: $COL" @@ -99,18 +106,23 @@ run_bruno_from_test_params() { return 1 fi + # 1) normalize path for running FROM collections root + COL_REL="${COL#collections/}" + COLLECTION_NAME=$(basename "$COL") BRUNO_REPORT_PATH="$TMP_DIR/attachments/${COLLECTION_NAME}-result.json" - mkdir -p "$TMP_DIR/attachments" - mkdir -p "$TMP_DIR/allure-results" + mkdir -p "$TMP_DIR/attachments" "$TMP_DIR/allure-results" + + ( cd collections || exit 1 echo "πŸ“„ Saving Bruno JSON report to: $BRUNO_REPORT_PATH" + echo "πŸ§ͺ EXECUTING: bru run \"$COL_REL\" --env \"$BRUNO_ENV\" $BRUNO_FLAGS ..." - bru run "$COL" \ + bru run "$COL_REL" \ --env "$BRUNO_ENV" \ $BRUNO_FLAGS \ --reporter-json "$BRUNO_REPORT_PATH" \ @@ -118,7 +130,6 @@ run_bruno_from_test_params() { ) BRU_EXIT_CODE=$? - echo "πŸ”Ž Bruno exit code: $BRU_EXIT_CODE" if [ $BRU_EXIT_CODE -ne 0 ]; then @@ -132,11 +143,7 @@ run_bruno_from_test_params() { fi echo "πŸ”„ Converting Bruno report to Allure format..." - - node /tools/bruno-to-allure.js \ - "$BRUNO_REPORT_PATH" \ - "$TMP_DIR/allure-results" - + node /tools/bruno-to-allure.js "$BRUNO_REPORT_PATH" "$TMP_DIR/allure-results" done echo "βœ… Bruno tests completed successfully" From 84505a410cd9762fed51314135b044244314674a Mon Sep 17 00:00:00 2001 From: saju1025 Date: Thu, 26 Feb 2026 16:43:13 +0500 Subject: [PATCH 14/83] feat: push release version --- test-runner.sh | 92 +++++++++++++++++++++++++++++--------------------- 1 file changed, 54 insertions(+), 38 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index 86442c3..4ec3178 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -42,6 +42,45 @@ run_tests() { return $TEST_EXIT_CODE } +#!/bin/bash + +# Test execution module +run_tests() { + echo "β–Ά Starting test execution..." + + # shellcheck disable=1091 + if [ -f "/app/scripts/upload-monitor.sh" ]; then + source "/app/scripts/upload-monitor.sh" + elif [ -f "/scripts/upload-monitor.sh" ]; then + source "/scripts/upload-monitor.sh" + else + echo "❌ upload-monitor.sh not found!" + exit 1 + fi + + echo "πŸ“ Creating Allure results directory..." + mkdir -p "$TMP_DIR/allure-results" + + echo "πŸ” Clearing sensitive environment variables before tests..." + clear_sensitive_vars + + echo "πŸš€ Running test suite..." + + if [ -f "./start_tests.sh" ]; then + chmod +x "./start_tests.sh" + ./start_tests.sh || TEST_EXIT_CODE=$? + elif [ -d "./collections" ]; then + echo "ℹ️ start_tests.sh not found, but collections/ detected β€” running default Bruno runner" + run_bruno_from_test_params || TEST_EXIT_CODE=$? + else + echo "❌ Neither start_tests.sh nor collections/ directory found in tests repo" + exit 1 + fi + + TEST_EXIT_CODE=${TEST_EXIT_CODE:-0} + echo "ℹ️ Test script exited with code: $TEST_EXIT_CODE (but continuing...)" + echo "βœ… Test execution completed" +} run_bruno_from_test_params() { @@ -86,18 +125,10 @@ run_bruno_from_test_params() { echo "πŸ”Ž Effective gateway mapping:" echo "public_gateway_url=$public_gateway_url" - echo "BRUNO_ENV=$BRUNO_ENV" echo "" - export BRUNO_ENV="$BRUNO_ENV" - export public_gateway_url="$PUBLIC_GATEWAY_URL" - export private_gateway_url="$PRIVATE_GATEWAY_URL" - export internal_gateway_url="$INTERNAL_GATEWAY_URL" - export opensearch_url="$OPENSEARCH_URL" - export huawei_url="$HUAWEI_URL" - export monitoring_alarm_engine_url="$MONITORING_ALARM_ENGINE_URL" - export kafka_platform_url="$KAFKA_PLATFORM_URL" - + for COL in "${COLLECTIONS[@]}"; do + echo "--------------------------------------------------" echo "πŸš€ Running collection: $COL" @@ -106,46 +137,31 @@ run_bruno_from_test_params() { return 1 fi - # 1) normalize path for running FROM collections root - COL_REL="${COL#collections/}" - - COLLECTION_NAME=$(basename "$COL") - BRUNO_REPORT_PATH="$TMP_DIR/attachments/${COLLECTION_NAME}-result.json" - - mkdir -p "$TMP_DIR/attachments" "$TMP_DIR/allure-results" - + ( + cd "$COL" || exit 1 + COLLECTION_NAME=$(basename "$COL") + BRUNO_REPORT_PATH="$TMP_DIR/attachments/${COLLECTION_NAME}-result.json" - ( - cd collections || exit 1 + mkdir -p "$TMP_DIR/attachments" + mkdir -p "$TMP_DIR/allure-results" echo "πŸ“„ Saving Bruno JSON report to: $BRUNO_REPORT_PATH" - echo "πŸ§ͺ EXECUTING: bru run \"$COL_REL\" --env \"$BRUNO_ENV\" $BRUNO_FLAGS ..." - bru run "$COL_REL" \ + bru run . \ --env "$BRUNO_ENV" \ $BRUNO_FLAGS \ --reporter-json "$BRUNO_REPORT_PATH" \ --verbose - ) - - BRU_EXIT_CODE=$? - echo "πŸ”Ž Bruno exit code: $BRU_EXIT_CODE" - if [ $BRU_EXIT_CODE -ne 0 ]; then - echo "❌ Bruno execution failed" - return $BRU_EXIT_CODE - fi + echo "πŸ”„ Converting Bruno report to Allure format..." - if [ ! -f "$BRUNO_REPORT_PATH" ]; then - echo "❌ Bruno report not generated" - return 1 - fi + node /tools/bruno-to-allure.js \ + "$BRUNO_REPORT_PATH" \ + "$TMP_DIR/allure-results" + ) - echo "πŸ”„ Converting Bruno report to Allure format..." - node /tools/bruno-to-allure.js "$BRUNO_REPORT_PATH" "$TMP_DIR/allure-results" done - echo "βœ… Bruno tests completed successfully" - return 0 + echo " Bruno tests completed successfully" } \ No newline at end of file From 5f1d5f19da53bbe750159896db46de88bbe5f080 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Fri, 27 Feb 2026 11:14:37 +0500 Subject: [PATCH 15/83] feat: add debug --- test-runner.sh | 130 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 89 insertions(+), 41 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index 4ec3178..d9618a8 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -81,87 +81,135 @@ run_tests() { echo "ℹ️ Test script exited with code: $TEST_EXIT_CODE (but continuing...)" echo "βœ… Test execution completed" } - run_bruno_from_test_params() { - echo "πŸ“ Current working directory: $(pwd)" + echo "==================================================" + echo "πŸš€ Starting Bruno execution from TEST_PARAMS" + echo "==================================================" + + echo "πŸ“ Working directory: $(pwd)" echo "πŸ“ TMP_DIR: $TMP_DIR" - echo "πŸ”§ Bruno version: $(bru --version 2>/dev/null || echo 'not found')" + echo "πŸ”§ Bruno version: $(bru --version 2>/dev/null || echo 'NOT FOUND')" echo "πŸ”§ Node version: $(node --version)" echo "πŸ”§ NPM version: $(npm --version)" - echo "" + echo "==================================================" + # Validate TEST_PARAMS if ! jq . <<< "$TEST_PARAMS" >/dev/null 2>&1; then echo "❌ TEST_PARAMS is not valid JSON" return 1 fi - jq . <<< "$TEST_PARAMS" > /tmp/test_params.json + echo "$TEST_PARAMS" | jq . + echo "==================================================" + + # Extract ENV + BRUNO_ENV=$(jq -r '.env // empty' <<< "$TEST_PARAMS") - BRUNO_ENV=$(jq -r '.env // empty' /tmp/test_params.json) if [ -z "$BRUNO_ENV" ]; then echo "❌ TEST_PARAMS.env is required" return 1 fi - echo "πŸ”§ Using Bruno environment: $BRUNO_ENV" + echo "🌍 Bruno environment: $BRUNO_ENV" - mapfile -t COLLECTIONS < <(jq -r '.collections[]? // empty' /tmp/test_params.json) + # Extract collections + mapfile -t COLLECTIONS < <(jq -r '.collections[]?' <<< "$TEST_PARAMS") if [ "${#COLLECTIONS[@]}" -eq 0 ]; then - echo "❌ No collections provided" + echo "❌ No collections found in TEST_PARAMS" return 1 fi - BRUNO_FLAGS=$(jq -r '.flags[]? // empty' /tmp/test_params.json | xargs) - export BRUNO_ENV="$BRUNO_ENV" - export public_gateway_url="$PUBLIC_GATEWAY_URL" - export private_gateway_url="$PRIVATE_GATEWAY_URL" - export internal_gateway_url="$INTERNAL_GATEWAY_URL" - export opensearch_url="$OPENSEARCH_URL" - export huawei_url="$HUAWEI_URL" - export monitoring_alarm_engine_url="$MONITORING_ALARM_ENGINE_URL" - export kafka_platform_url="$KAFKA_PLATFORM_URL" - - echo "πŸ”Ž Effective gateway mapping:" - echo "public_gateway_url=$public_gateway_url" - echo "" + echo "πŸ“¦ Collections to execute (${#COLLECTIONS[@]}):" + for c in "${COLLECTIONS[@]}"; do + echo " - $c" + done + echo "==================================================" + + # Extract flags + BRUNO_FLAGS=$(jq -r '.flags[]?' <<< "$TEST_PARAMS" | xargs) + echo "🏁 Bruno flags: $BRUNO_FLAGS" + echo "==================================================" + # Prepare folders + mkdir -p "$TMP_DIR/attachments" + mkdir -p "$TMP_DIR/allure-results" + + TOTAL_FAILED=0 + + # Execute collections for COL in "${COLLECTIONS[@]}"; do - echo "--------------------------------------------------" - echo "πŸš€ Running collection: $COL" + echo "" + echo "##################################################" + echo "πŸš€ Starting collection: $COL" + echo "##################################################" if [ ! -d "$COL" ]; then - echo "❌ Collection not found: $COL" - return 1 + echo "❌ Collection directory not found: $COL" + TOTAL_FAILED=1 + continue fi - ( - cd "$COL" || exit 1 + COLLECTION_NAME=$(basename "$COL") + BRUNO_REPORT_PATH="$TMP_DIR/attachments/${COLLECTION_NAME}-result.json" - COLLECTION_NAME=$(basename "$COL") - BRUNO_REPORT_PATH="$TMP_DIR/attachments/${COLLECTION_NAME}-result.json" + echo "πŸ“‚ Entering directory: $COL" - mkdir -p "$TMP_DIR/attachments" - mkdir -p "$TMP_DIR/allure-results" + pushd "$COL" > /dev/null || { + echo "❌ Failed to enter directory: $COL" + TOTAL_FAILED=1 + continue + } - echo "πŸ“„ Saving Bruno JSON report to: $BRUNO_REPORT_PATH" + echo "β–Ά Running command:" + echo "bru run . --env \"$BRUNO_ENV\" $BRUNO_FLAGS --reporter-json \"$BRUNO_REPORT_PATH\" --verbose" + echo "--------------------------------------------------" - bru run . \ - --env "$BRUNO_ENV" \ - $BRUNO_FLAGS \ - --reporter-json "$BRUNO_REPORT_PATH" \ - --verbose + if ! bru run . \ + --env "$BRUNO_ENV" \ + $BRUNO_FLAGS \ + --reporter-json "$BRUNO_REPORT_PATH" \ + --verbose; then - echo "πŸ”„ Converting Bruno report to Allure format..." + echo "❌ Bruno FAILED for: $COLLECTION_NAME" + TOTAL_FAILED=1 + else + echo "βœ… Bruno SUCCEEDED for: $COLLECTION_NAME" + fi + + echo "--------------------------------------------------" + echo "πŸ”„ Converting Bruno JSON to Allure..." + if [ -f "$BRUNO_REPORT_PATH" ]; then node /tools/bruno-to-allure.js \ "$BRUNO_REPORT_PATH" \ "$TMP_DIR/allure-results" - ) + echo "βœ… Allure conversion completed" + else + echo "⚠️ Bruno report file not found: $BRUNO_REPORT_PATH" + TOTAL_FAILED=1 + fi + + popd > /dev/null + + echo "##################################################" + echo "🏁 Finished collection: $COLLECTION_NAME" + echo "##################################################" done - echo " Bruno tests completed successfully" + echo "" + echo "==================================================" + echo "πŸ“Š Bruno execution finished" + echo "==================================================" + + if [ "$TOTAL_FAILED" -ne 0 ]; then + echo "❌ Some collections FAILED" + return 1 + else + echo "βœ… All collections executed successfully" + return 0 + fi } \ No newline at end of file From f03510561cf780ecc8e6dc814fb7863d88a13d30 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Fri, 27 Feb 2026 11:53:52 +0500 Subject: [PATCH 16/83] fix: upd check this method --- test-runner.sh | 184 ++++++++++++++++--------------------------------- 1 file changed, 59 insertions(+), 125 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index d9618a8..b680a4d 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -42,174 +42,108 @@ run_tests() { return $TEST_EXIT_CODE } -#!/bin/bash - -# Test execution module -run_tests() { - echo "β–Ά Starting test execution..." - - # shellcheck disable=1091 - if [ -f "/app/scripts/upload-monitor.sh" ]; then - source "/app/scripts/upload-monitor.sh" - elif [ -f "/scripts/upload-monitor.sh" ]; then - source "/scripts/upload-monitor.sh" - else - echo "❌ upload-monitor.sh not found!" - exit 1 - fi - echo "πŸ“ Creating Allure results directory..." - mkdir -p "$TMP_DIR/allure-results" - - echo "πŸ” Clearing sensitive environment variables before tests..." - clear_sensitive_vars - - echo "πŸš€ Running test suite..." - - if [ -f "./start_tests.sh" ]; then - chmod +x "./start_tests.sh" - ./start_tests.sh || TEST_EXIT_CODE=$? - elif [ -d "./collections" ]; then - echo "ℹ️ start_tests.sh not found, but collections/ detected β€” running default Bruno runner" - run_bruno_from_test_params || TEST_EXIT_CODE=$? - else - echo "❌ Neither start_tests.sh nor collections/ directory found in tests repo" - exit 1 - fi - - TEST_EXIT_CODE=${TEST_EXIT_CODE:-0} - echo "ℹ️ Test script exited with code: $TEST_EXIT_CODE (but continuing...)" - echo "βœ… Test execution completed" -} run_bruno_from_test_params() { echo "==================================================" - echo "πŸš€ Starting Bruno execution from TEST_PARAMS" + echo "πŸš€ Bruno execution with EnvGene (legacy bru.js mode)" echo "==================================================" - echo "πŸ“ Working directory: $(pwd)" - echo "πŸ“ TMP_DIR: $TMP_DIR" - echo "πŸ”§ Bruno version: $(bru --version 2>/dev/null || echo 'NOT FOUND')" - echo "πŸ”§ Node version: $(node --version)" - echo "πŸ”§ NPM version: $(npm --version)" - echo "==================================================" - - # Validate TEST_PARAMS - if ! jq . <<< "$TEST_PARAMS" >/dev/null 2>&1; then - echo "❌ TEST_PARAMS is not valid JSON" - return 1 - fi - - echo "$TEST_PARAMS" | jq . - echo "==================================================" + source /tools/bru_tools.sh - # Extract ENV - BRUNO_ENV=$(jq -r '.env // empty' <<< "$TEST_PARAMS") + # ΠŸΡ€ΠΎΠ²Π΅Ρ€ΡΠ΅ΠΌ TEST_PARAMS + check_env_var "TEST_PARAMS" "" - if [ -z "$BRUNO_ENV" ]; then - echo "❌ TEST_PARAMS.env is required" - return 1 - fi + extract_bruno_env "$TEST_PARAMS" "BRUNO_ENV_STR" + extract_bruno_collections "$TEST_PARAMS" "BRUNO_COLLECTIONS_ARRAY" + extract_bruno_env_vars "$TEST_PARAMS" "BRUNO_ENV_VARS_CLI" + extract_bruno_flags "$TEST_PARAMS" "BRUNO_FLAGS_CLI" - echo "🌍 Bruno environment: $BRUNO_ENV" + cd "$TMP_DIR" - # Extract collections - mapfile -t COLLECTIONS < <(jq -r '.collections[]?' <<< "$TEST_PARAMS") + PATH_TO_ATTACHMENTS_DIR="${TMP_DIR}/attachments" + PATH_TO_ALLURE_RESULTS="${TMP_DIR}/allure-results" - if [ "${#COLLECTIONS[@]}" -eq 0 ]; then - echo "❌ No collections found in TEST_PARAMS" - return 1 - fi + mkdir -p "$PATH_TO_ATTACHMENTS_DIR" + mkdir -p "$PATH_TO_ALLURE_RESULTS" - echo "πŸ“¦ Collections to execute (${#COLLECTIONS[@]}):" - for c in "${COLLECTIONS[@]}"; do - echo " - $c" - done - echo "==================================================" + # === EnvGene экспорт === + echo "πŸ”§ EnvGene mapping:" + echo "PUBLIC_GATEWAY_URL=$PUBLIC_GATEWAY_URL" + echo "PRIVATE_GATEWAY_URL=$PRIVATE_GATEWAY_URL" + echo "INTERNAL_GATEWAY_URL=$INTERNAL_GATEWAY_URL" + echo "OPENSEARCH_URL=$OPENSEARCH_URL" - # Extract flags - BRUNO_FLAGS=$(jq -r '.flags[]?' <<< "$TEST_PARAMS" | xargs) - echo "🏁 Bruno flags: $BRUNO_FLAGS" - echo "==================================================" + export PUBLIC_GATEWAY_URL + export PRIVATE_GATEWAY_URL + export INTERNAL_GATEWAY_URL + export OPENSEARCH_URL + export HUAWEI_URL + export MONITORING_ALARM_ENGINE_URL + export KAFKA_PLATFORM_URL - # Prepare folders - mkdir -p "$TMP_DIR/attachments" - mkdir -p "$TMP_DIR/allure-results" + # === ΠžΠΏΡ€Π΅Π΄Π΅Π»ΡΠ΅ΠΌ BRU_BIN === + if [ -z "$BRU_BIN" ]; then + BRU_BIN="$(npm root -g)/@usebruno/cli" + fi TOTAL_FAILED=0 - # Execute collections - for COL in "${COLLECTIONS[@]}"; do + for collection_dir in "${BRUNO_COLLECTIONS_ARRAY[@]}"; do - echo "" - echo "##################################################" - echo "πŸš€ Starting collection: $COL" - echo "##################################################" + collection_path="${TMP_DIR}/${collection_dir}" - if [ ! -d "$COL" ]; then - echo "❌ Collection directory not found: $COL" + echo "--------------------------------------------------" + echo "➑️ Processing: $collection_path" + echo "--------------------------------------------------" + + if [ ! -d "$collection_path" ]; then + echo "❌ Collection not found: $collection_path" TOTAL_FAILED=1 continue fi - COLLECTION_NAME=$(basename "$COL") - BRUNO_REPORT_PATH="$TMP_DIR/attachments/${COLLECTION_NAME}-result.json" + collection_name=$(basename "$collection_dir") + bruno_report_path="${PATH_TO_ATTACHMENTS_DIR}/${collection_name}-result.json" - echo "πŸ“‚ Entering directory: $COL" + pushd "$collection_path" > /dev/null - pushd "$COL" > /dev/null || { - echo "❌ Failed to enter directory: $COL" - TOTAL_FAILED=1 - continue - } - - echo "β–Ά Running command:" - echo "bru run . --env \"$BRUNO_ENV\" $BRUNO_FLAGS --reporter-json \"$BRUNO_REPORT_PATH\" --verbose" - echo "--------------------------------------------------" + echo "β–Ά Running via bru.js" - if ! bru run . \ - --env "$BRUNO_ENV" \ - $BRUNO_FLAGS \ - --reporter-json "$BRUNO_REPORT_PATH" \ - --verbose; then + if ! output=$(${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ + --env "${BRUNO_ENV_STR}" \ + ${BRUNO_ENV_VARS_CLI} \ + --reporter-json "${bruno_report_path}" 2>&1); then - echo "❌ Bruno FAILED for: $COLLECTION_NAME" - TOTAL_FAILED=1 + echo "$output" + echo "❌ FAILED: $collection_name" + TOTAL_FAILED=1 else - echo "βœ… Bruno SUCCEEDED for: $COLLECTION_NAME" + echo "$output" + echo "βœ… SUCCESS: $collection_name" fi - echo "--------------------------------------------------" - echo "πŸ”„ Converting Bruno JSON to Allure..." + popd > /dev/null - if [ -f "$BRUNO_REPORT_PATH" ]; then + # ΠšΠΎΠ½Π²Π΅Ρ€Ρ‚Π°Ρ†ΠΈΡ Π² Allure + if [ -f "$bruno_report_path" ]; then node /tools/bruno-to-allure.js \ - "$BRUNO_REPORT_PATH" \ - "$TMP_DIR/allure-results" - echo "βœ… Allure conversion completed" + "$bruno_report_path" \ + "$PATH_TO_ALLURE_RESULTS" else - echo "⚠️ Bruno report file not found: $BRUNO_REPORT_PATH" + echo "⚠️ Report missing for $collection_name" TOTAL_FAILED=1 fi - popd > /dev/null - - echo "##################################################" - echo "🏁 Finished collection: $COLLECTION_NAME" - echo "##################################################" - done - echo "" - echo "==================================================" - echo "πŸ“Š Bruno execution finished" echo "==================================================" if [ "$TOTAL_FAILED" -ne 0 ]; then - echo "❌ Some collections FAILED" + echo "❌ Some collections failed" return 1 else - echo "βœ… All collections executed successfully" + echo " All collections executed" return 0 fi } \ No newline at end of file From aa793b30d94c22516c9877be7e7f2d3b40183c79 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Fri, 27 Feb 2026 12:32:18 +0500 Subject: [PATCH 17/83] fix: test_runner.sh BRU_BIN --- test-runner.sh | 73 ++++++++++++++++---------------------------------- 1 file changed, 23 insertions(+), 50 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index b680a4d..1b3396e 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -43,15 +43,15 @@ run_tests() { return $TEST_EXIT_CODE } + run_bruno_from_test_params() { echo "==================================================" - echo "πŸš€ Bruno execution with EnvGene (legacy bru.js mode)" + echo "πŸš€ Bruno execution with EnvGene (legacy mode)" echo "==================================================" source /tools/bru_tools.sh - # ΠŸΡ€ΠΎΠ²Π΅Ρ€ΡΠ΅ΠΌ TEST_PARAMS check_env_var "TEST_PARAMS" "" extract_bruno_env "$TEST_PARAMS" "BRUNO_ENV_STR" @@ -67,13 +67,7 @@ run_bruno_from_test_params() { mkdir -p "$PATH_TO_ATTACHMENTS_DIR" mkdir -p "$PATH_TO_ALLURE_RESULTS" - # === EnvGene экспорт === - echo "πŸ”§ EnvGene mapping:" - echo "PUBLIC_GATEWAY_URL=$PUBLIC_GATEWAY_URL" - echo "PRIVATE_GATEWAY_URL=$PRIVATE_GATEWAY_URL" - echo "INTERNAL_GATEWAY_URL=$INTERNAL_GATEWAY_URL" - echo "OPENSEARCH_URL=$OPENSEARCH_URL" - + # === EnvGene просто экспортируСм === export PUBLIC_GATEWAY_URL export PRIVATE_GATEWAY_URL export INTERNAL_GATEWAY_URL @@ -82,68 +76,47 @@ run_bruno_from_test_params() { export MONITORING_ALARM_ENGINE_URL export KAFKA_PLATFORM_URL - # === ΠžΠΏΡ€Π΅Π΄Π΅Π»ΡΠ΅ΠΌ BRU_BIN === - if [ -z "$BRU_BIN" ]; then - BRU_BIN="$(npm root -g)/@usebruno/cli" - fi - TOTAL_FAILED=0 for collection_dir in "${BRUNO_COLLECTIONS_ARRAY[@]}"; do collection_path="${TMP_DIR}/${collection_dir}" - echo "--------------------------------------------------" - echo "➑️ Processing: $collection_path" - echo "--------------------------------------------------" + echo "➑️ Processing collection: $collection_path" - if [ ! -d "$collection_path" ]; then - echo "❌ Collection not found: $collection_path" - TOTAL_FAILED=1 - continue - fi + if [ -d "$collection_path" ]; then - collection_name=$(basename "$collection_dir") - bruno_report_path="${PATH_TO_ATTACHMENTS_DIR}/${collection_name}-result.json" + collection_name=$(basename "$collection_dir") + bruno_report_path="${PATH_TO_ATTACHMENTS_DIR}/${collection_name}-result.json" - pushd "$collection_path" > /dev/null + pushd "$collection_path" > /dev/null - echo "β–Ά Running via bru.js" + if ! output=$(${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ + --env "${BRUNO_ENV_STR}" \ + ${BRUNO_ENV_VARS_CLI} \ + --reporter-json "${bruno_report_path}" 2>&1); then - if ! output=$(${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ - --env "${BRUNO_ENV_STR}" \ - ${BRUNO_ENV_VARS_CLI} \ - --reporter-json "${bruno_report_path}" 2>&1); then + echo "$output" + echo "❌ FAILED: $collection_name" + TOTAL_FAILED=1 + else + echo "$output" + echo "βœ… SUCCESS: $collection_name" + fi - echo "$output" - echo "❌ FAILED: $collection_name" - TOTAL_FAILED=1 - else - echo "$output" - echo "βœ… SUCCESS: $collection_name" - fi + popd > /dev/null - popd > /dev/null + node /tools/bruno-to-allure.js \ + "$bruno_report_path" \ + "$PATH_TO_ALLURE_RESULTS" - # ΠšΠΎΠ½Π²Π΅Ρ€Ρ‚Π°Ρ†ΠΈΡ Π² Allure - if [ -f "$bruno_report_path" ]; then - node /tools/bruno-to-allure.js \ - "$bruno_report_path" \ - "$PATH_TO_ALLURE_RESULTS" - else - echo "⚠️ Report missing for $collection_name" - TOTAL_FAILED=1 fi done - echo "==================================================" - if [ "$TOTAL_FAILED" -ne 0 ]; then - echo "❌ Some collections failed" return 1 else - echo " All collections executed" return 0 fi } \ No newline at end of file From b1a5d76c119a746d1ddd4275da1c9c27f8234337 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Mon, 2 Mar 2026 12:08:15 +0500 Subject: [PATCH 18/83] feat: add env in allure results --- envgene.sh | 7 +++++++ test-runner.sh | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/envgene.sh b/envgene.sh index 669bd2c..b365b93 100644 --- a/envgene.sh +++ b/envgene.sh @@ -17,6 +17,13 @@ load_envgene() { | jq -r '.systems[] | .["public-gateway"]? // empty | .connections[0].HTTP.login // empty') + if [ -n "$PUBLIC_GATEWAY_URL" ]; then + host=$(echo "$PUBLIC_GATEWAY_URL" | sed -E 's#https?://([^/]+).*#\1#') + namespace_part=${host#public-gateway-} + export NAMESPACE=${namespace_part%%.*} + else + export NAMESPACE="unknown" + fi export PUBLIC_GATEWAY_PASSWORD=$(echo "$ATP_ENVGENE_CONFIGURATION" \ | jq -r '.systems[] | .["public-gateway"]? // empty | .connections[0].HTTP.password // empty') diff --git a/test-runner.sh b/test-runner.sh index 1b3396e..0598503 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -46,9 +46,8 @@ run_tests() { run_bruno_from_test_params() { - echo "==================================================" echo "πŸš€ Bruno execution with EnvGene (legacy mode)" - echo "==================================================" + source /tools/bru_tools.sh @@ -75,6 +74,7 @@ run_bruno_from_test_params() { export HUAWEI_URL export MONITORING_ALARM_ENGINE_URL export KAFKA_PLATFORM_URL + export NAMESPACE TOTAL_FAILED=0 From bcfe09160963f0af2a8468c60cd7a5ec0698da67 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Mon, 2 Mar 2026 13:02:21 +0500 Subject: [PATCH 19/83] fix: upload-monitor.sh --- upload-monitor.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/upload-monitor.sh b/upload-monitor.sh index 0037ae6..d396aa4 100644 --- a/upload-monitor.sh +++ b/upload-monitor.sh @@ -108,7 +108,16 @@ sync_directory_to_s3() { # Finalize upload after tests finalize_upload() { echo "πŸ”„ Finalizing upload operations..." - + echo "πŸ“Š Generating Allure report..." + + allure generate "$TMP_DIR/allure-results" \ + -o "$TMP_DIR/allure-report" \ + --clean + + if [ $? -ne 0 ]; then + echo "❌ Allure report generation failed" + return 1 + fi # Prepare common S3 paths RESULTS_S3_PATH="s3://${ATP_STORAGE_BUCKET}/Result/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/" REPORTS_S3_PATH="s3://${ATP_STORAGE_BUCKET}/Report/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/" @@ -121,11 +130,11 @@ finalize_upload() { if [[ "$ATP_STORAGE_PROVIDER" == "aws" ]]; then s5cmd --no-verify-ssl sync "$TMP_DIR/allure-results/" "${RESULTS_S3_PATH}allure-results/" s5cmd --no-verify-ssl sync "$TMP_DIR/attachments/" "$ATTACHMENTS_S3_PATH" - s5cmd --no-verify-ssl sync "$TMP_DIR/scripts/email-notification-generated/" "${RESULTS_S3_PATH}email-notification-generated/" + s5cmd --no-verify-ssl sync "$TMP_DIR/allure-report/" "${REPORTS_S3_PATH}allure-report/" elif [[ "$ATP_STORAGE_PROVIDER" == "minio" || "$ATP_STORAGE_PROVIDER" == "s3" ]]; then s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/allure-results/" "${RESULTS_S3_PATH}allure-results/" s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/attachments/" "$ATTACHMENTS_S3_PATH" - s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/scripts/email-notification-generated/" "${RESULTS_S3_PATH}email-notification-generated/" + s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/allure-report/" "${REPORTS_S3_PATH}allure-report/" fi # Upload marker file From df93799dfef103e06175dc257bcc024c0d8658f0 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Mon, 2 Mar 2026 15:33:50 +0500 Subject: [PATCH 20/83] fix: updates for env --- test-runner.sh | 11 +++-- upload-monitor.sh | 102 ++++++++++------------------------------------ 2 files changed, 29 insertions(+), 84 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index 0598503..5774475 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -66,7 +66,10 @@ run_bruno_from_test_params() { mkdir -p "$PATH_TO_ATTACHMENTS_DIR" mkdir -p "$PATH_TO_ALLURE_RESULTS" - # === EnvGene просто экспортируСм === + echo "NAMESPACE=$NAMESPACE" > "$PATH_TO_ALLURE_RESULTS/environment.properties" + echo "PUBLIC_GATEWAY_URL=$PUBLIC_GATEWAY_URL" >> "$PATH_TO_ALLURE_RESULTS/environment.properties" + echo "BRUNO_ENV=$BRUNO_ENV_STR" >> "$PATH_TO_ALLURE_RESULTS/environment.properties" + export PUBLIC_GATEWAY_URL export PRIVATE_GATEWAY_URL export INTERNAL_GATEWAY_URL @@ -105,7 +108,7 @@ run_bruno_from_test_params() { fi popd > /dev/null - + node /tools/bruno-to-allure.js \ "$bruno_report_path" \ "$PATH_TO_ALLURE_RESULTS" @@ -113,7 +116,9 @@ run_bruno_from_test_params() { fi done - + echo " DEBUG ALLURE RESULTS " + ls -la "$PATH_TO_ALLURE_RESULTS" + echo "-----------------------------------------" if [ "$TOTAL_FAILED" -ne 0 ]; then return 1 else diff --git a/upload-monitor.sh b/upload-monitor.sh index d396aa4..2fa1ca3 100644 --- a/upload-monitor.sh +++ b/upload-monitor.sh @@ -4,26 +4,20 @@ start_upload_monitoring() { echo "πŸ“‘ Starting event-based upload monitoring..." - # Prepare common S3 paths RESULTS_S3_PATH="s3://${ATP_STORAGE_BUCKET}/Result/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/" REPORTS_S3_PATH="s3://${ATP_STORAGE_BUCKET}/Report/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/" ATTACHMENTS_S3_PATH="${REPORTS_S3_PATH}attachments/" - # Create attachments directory - mkdir -p $TMP_DIR/allure-results - mkdir -p $TMP_DIR/attachments + mkdir -p "$TMP_DIR/allure-results" + mkdir -p "$TMP_DIR/attachments" - # Store credentials for background processes (local variables, not exported) _BACKGROUND_S3_KEY="$_LOCAL_S3_KEY" _BACKGROUND_S3_SECRET="$_LOCAL_S3_SECRET" - # Choose upload method based on environment variable if [[ "${UPLOAD_METHOD:-cp}" == "sync" ]]; then - echo "πŸ”„ Using sync-based upload monitoring (inotifywait + sync)" start_sync_uploader "$TMP_DIR/allure-results" "${RESULTS_S3_PATH}allure-results/" "*result.json" & start_sync_uploader "$TMP_DIR/attachments" "$ATTACHMENTS_S3_PATH" & else - echo "πŸ“ Using file-based upload monitoring (inotifywait + cp)" start_inotify_uploader "$TMP_DIR/allure-results" "${RESULTS_S3_PATH}allure-results/" "*result.json" & start_inotify_uploader "$TMP_DIR/attachments" "$ATTACHMENTS_S3_PATH" & fi @@ -31,173 +25,119 @@ start_upload_monitoring() { echo "βœ… Upload monitoring started" } -# Inotify uploader function start_inotify_uploader() { WATCH_DIR="$1" DEST_PATH="$2" - FILE_PATTERN="${3:-*}" # Optional filename filter (e.g. *result.json) + FILE_PATTERN="${3:-*}" - echo "πŸ“‘ Starting inotify uploader for $WATCH_DIR => $DEST_PATH (filter: $FILE_PATTERN)" - - # Pass credentials as environment variables only for this process inotifywait -m -e close_write,create --format '%w%f' "$WATCH_DIR" | while read NEW_FILE; do FILE_NAME=$(basename "$NEW_FILE") if [[ "$FILE_NAME" == $FILE_PATTERN ]]; then - echo "πŸ†• Matching file: $FILE_NAME" upload_file_to_s3 "$NEW_FILE" "$DEST_PATH" - else - echo "⚠️ Ignored file: $FILE_NAME" fi done & - - # Store the background process PID - INOTIFY_PID=$! - echo "πŸ“‘ Inotify process started with PID: $INOTIFY_PID" } -# Upload file to S3/MinIO upload_file_to_s3() { local FILE_PATH="$1" local DEST_PATH="$2" - # Use background credentials for upload if [[ "$ATP_STORAGE_PROVIDER" == "aws" ]]; then - AWS_ACCESS_KEY_ID="$_BACKGROUND_S3_KEY" AWS_SECRET_ACCESS_KEY="$_BACKGROUND_S3_SECRET" s5cmd --no-verify-ssl cp "$FILE_PATH" "$DEST_PATH" > /dev/null 2>&1 - elif [[ "$ATP_STORAGE_PROVIDER" == "minio" || "$ATP_STORAGE_PROVIDER" == "s3" ]]; then - AWS_ACCESS_KEY_ID="$_BACKGROUND_S3_KEY" AWS_SECRET_ACCESS_KEY="$_BACKGROUND_S3_SECRET" s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" cp "$FILE_PATH" "$DEST_PATH" > /dev/null 2>&1 + AWS_ACCESS_KEY_ID="$_BACKGROUND_S3_KEY" AWS_SECRET_ACCESS_KEY="$_BACKGROUND_S3_SECRET" \ + s5cmd --no-verify-ssl cp "$FILE_PATH" "$DEST_PATH" > /dev/null 2>&1 + else + AWS_ACCESS_KEY_ID="$_BACKGROUND_S3_KEY" AWS_SECRET_ACCESS_KEY="$_BACKGROUND_S3_SECRET" \ + s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" cp "$FILE_PATH" "$DEST_PATH" > /dev/null 2>&1 fi } -# Sync-based uploader function (triggered by inotifywait) start_sync_uploader() { WATCH_DIR="$1" DEST_PATH="$2" - FILE_PATTERN="${3:-*}" # Optional filename filter - - echo "πŸ”„ Starting sync uploader for $WATCH_DIR => $DEST_PATH (filter: $FILE_PATTERN)" + FILE_PATTERN="${3:-*}" - # Pass credentials as environment variables only for this process inotifywait -m -e close_write,create --format '%w%f' "$WATCH_DIR" | while read NEW_FILE; do FILE_NAME=$(basename "$NEW_FILE") if [[ "$FILE_NAME" == $FILE_PATTERN ]]; then - echo "πŸ†• Matching file: $FILE_NAME - triggering sync" sync_directory_to_s3 "$WATCH_DIR" "$DEST_PATH" - #else - # echo "⚠️ Ignored file: $FILE_NAME" fi done & - - # Store the background process PID - SYNC_PID=$! - echo "πŸ”„ Sync process started with PID: $SYNC_PID" } -# Sync directory to S3/MinIO sync_directory_to_s3() { local SOURCE_DIR="$1" local DEST_PATH="$2" - # Use background credentials for sync if [[ "$ATP_STORAGE_PROVIDER" == "aws" ]]; then - AWS_ACCESS_KEY_ID="$_BACKGROUND_S3_KEY" AWS_SECRET_ACCESS_KEY="$_BACKGROUND_S3_SECRET" s5cmd --no-verify-ssl sync "$SOURCE_DIR/" "$DEST_PATH" > /dev/null 2>&1 - elif [[ "$ATP_STORAGE_PROVIDER" == "minio" || "$ATP_STORAGE_PROVIDER" == "s3" ]]; then - AWS_ACCESS_KEY_ID="$_BACKGROUND_S3_KEY" AWS_SECRET_ACCESS_KEY="$_BACKGROUND_S3_SECRET" s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$SOURCE_DIR/" "$DEST_PATH" > /dev/null 2>&1 + AWS_ACCESS_KEY_ID="$_BACKGROUND_S3_KEY" AWS_SECRET_ACCESS_KEY="$_BACKGROUND_S3_SECRET" \ + s5cmd --no-verify-ssl sync "$SOURCE_DIR/" "$DEST_PATH" > /dev/null 2>&1 + else + AWS_ACCESS_KEY_ID="$_BACKGROUND_S3_KEY" AWS_SECRET_ACCESS_KEY="$_BACKGROUND_S3_SECRET" \ + s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$SOURCE_DIR/" "$DEST_PATH" > /dev/null 2>&1 fi } -# Finalize upload after tests finalize_upload() { echo "πŸ”„ Finalizing upload operations..." - echo "πŸ“Š Generating Allure report..." - allure generate "$TMP_DIR/allure-results" \ - -o "$TMP_DIR/allure-report" \ - --clean - - if [ $? -ne 0 ]; then - echo "❌ Allure report generation failed" - return 1 - fi - # Prepare common S3 paths RESULTS_S3_PATH="s3://${ATP_STORAGE_BUCKET}/Result/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/" REPORTS_S3_PATH="s3://${ATP_STORAGE_BUCKET}/Report/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/" ATTACHMENTS_S3_PATH="${REPORTS_S3_PATH}attachments/" - # Restore credentials for final operations restore_aws_credentials - # Final sync to ensure all files are captured if [[ "$ATP_STORAGE_PROVIDER" == "aws" ]]; then s5cmd --no-verify-ssl sync "$TMP_DIR/allure-results/" "${RESULTS_S3_PATH}allure-results/" s5cmd --no-verify-ssl sync "$TMP_DIR/attachments/" "$ATTACHMENTS_S3_PATH" - s5cmd --no-verify-ssl sync "$TMP_DIR/allure-report/" "${REPORTS_S3_PATH}allure-report/" - elif [[ "$ATP_STORAGE_PROVIDER" == "minio" || "$ATP_STORAGE_PROVIDER" == "s3" ]]; then + else s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/allure-results/" "${RESULTS_S3_PATH}allure-results/" s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/attachments/" "$ATTACHMENTS_S3_PATH" - s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/allure-report/" "${REPORTS_S3_PATH}allure-report/" fi - # Upload marker file - echo "${ENABLE_JIRA_INTEGRATION:-false}" > $TMP_DIR/allure-results.uploaded + echo "${ENABLE_JIRA_INTEGRATION:-false}" > "$TMP_DIR/allure-results.uploaded" + if [[ "$ATP_STORAGE_PROVIDER" == "aws" ]]; then s5cmd --no-verify-ssl cp "$TMP_DIR/allure-results.uploaded" "${RESULTS_S3_PATH}allure-results.uploaded" - elif [[ "$ATP_STORAGE_PROVIDER" == "minio" || "$ATP_STORAGE_PROVIDER" == "s3" ]]; then + else s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" cp "$TMP_DIR/allure-results.uploaded" "${RESULTS_S3_PATH}allure-results.uploaded" fi - # Generate result URLs generate_result_urls - - # Final cleanup final_cleanup echo "" echo "Results are available at: ${RESULTS_URL}" echo "Reports are available at: ${REPORTS_URL}" - echo "Report view is available at: ${ATP_REPORT_VIEW_UI_URL}/${REPORTS_FOLDER_PATH}index.html" - echo "βœ… Upload finalization completed" } -# Generate URLs for results generate_result_urls() { if [[ "$ATP_STORAGE_PROVIDER" == "aws" ]]; then - RESULT_URL="${ATP_STORAGE_BUCKET}.${ATP_STORAGE_SERVER_UI_URL}/Result/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/allure-results/" - elif [[ "$ATP_STORAGE_PROVIDER" == "minio" || "$ATP_STORAGE_PROVIDER" == "s3" ]]; then - # Generate base64-encoded URLs for MinIO UI + RESULTS_URL="${ATP_STORAGE_BUCKET}.${ATP_STORAGE_SERVER_UI_URL}/Result/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/allure-results/" + else RESULTS_FOLDER_PATH="Result/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/allure-results/" RESULTS_ENCODED_PATH=$(echo -n "${RESULTS_FOLDER_PATH}" | base64) RESULTS_URL="${ATP_STORAGE_SERVER_UI_URL}/browser/${ATP_STORAGE_BUCKET}/${RESULTS_ENCODED_PATH}" - - REPORTS_FOLDER_PATH="Report/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/allure-report/" - REPORTS_ENCODED_PATH=$(echo -n "${REPORTS_FOLDER_PATH}" | base64) - REPORTS_URL="${ATP_STORAGE_SERVER_UI_URL}/browser/${ATP_STORAGE_BUCKET}/${REPORTS_ENCODED_PATH}" fi } -# Clear sensitive environment variables clear_sensitive_vars() { - echo "πŸ” Clearing sensitive environment variables..." unset AWS_ACCESS_KEY_ID unset AWS_SECRET_ACCESS_KEY unset ATP_STORAGE_USERNAME unset ATP_STORAGE_PASSWORD } -# Restore AWS credentials for final operations restore_aws_credentials() { - echo "πŸ”‘ Restoring AWS credentials for final operations..." export AWS_ACCESS_KEY_ID="$_LOCAL_S3_KEY" export AWS_SECRET_ACCESS_KEY="$_LOCAL_S3_SECRET" } -# Final cleanup of all credentials final_cleanup() { - echo "🧹 Final cleanup of all credentials..." unset AWS_ACCESS_KEY_ID unset AWS_SECRET_ACCESS_KEY unset _LOCAL_S3_KEY unset _LOCAL_S3_SECRET unset _BACKGROUND_S3_KEY unset _BACKGROUND_S3_SECRET -} +} \ No newline at end of file From 9b15c481867940134fe594661fdccb606dbbf198 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Mon, 2 Mar 2026 16:22:12 +0500 Subject: [PATCH 21/83] fix test runner sh --- test-runner.sh | 63 ++++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 33 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index 5774475..a79b6d3 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -5,7 +5,7 @@ run_tests() { set -o pipefail - # shellcheck disable=1091 + # shellcheck disable=SC1091 if [ -f "/app/scripts/upload-monitor.sh" ]; then source "/app/scripts/upload-monitor.sh" elif [ -f "/scripts/upload-monitor.sh" ]; then @@ -40,15 +40,13 @@ run_tests() { echo "ℹ️ Test script exited with code: $TEST_EXIT_CODE" echo "βœ… Test execution completed" - return $TEST_EXIT_CODE + return "$TEST_EXIT_CODE" } - run_bruno_from_test_params() { - echo "πŸš€ Bruno execution with EnvGene (legacy mode)" - + # shellcheck disable=SC1091 source /tools/bru_tools.sh check_env_var "TEST_PARAMS" "" @@ -58,7 +56,7 @@ run_bruno_from_test_params() { extract_bruno_env_vars "$TEST_PARAMS" "BRUNO_ENV_VARS_CLI" extract_bruno_flags "$TEST_PARAMS" "BRUNO_FLAGS_CLI" - cd "$TMP_DIR" + cd "$TMP_DIR" || return 1 PATH_TO_ATTACHMENTS_DIR="${TMP_DIR}/attachments" PATH_TO_ALLURE_RESULTS="${TMP_DIR}/allure-results" @@ -82,43 +80,42 @@ run_bruno_from_test_params() { TOTAL_FAILED=0 for collection_dir in "${BRUNO_COLLECTIONS_ARRAY[@]}"; do - collection_path="${TMP_DIR}/${collection_dir}" echo "➑️ Processing collection: $collection_path" if [ -d "$collection_path" ]; then - - collection_name=$(basename "$collection_dir") - bruno_report_path="${PATH_TO_ATTACHMENTS_DIR}/${collection_name}-result.json" - - pushd "$collection_path" > /dev/null - - if ! output=$(${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ - --env "${BRUNO_ENV_STR}" \ - ${BRUNO_ENV_VARS_CLI} \ - --reporter-json "${bruno_report_path}" 2>&1); then - - echo "$output" - echo "❌ FAILED: $collection_name" - TOTAL_FAILED=1 - else - echo "$output" - echo "βœ… SUCCESS: $collection_name" - fi - - popd > /dev/null - - node /tools/bruno-to-allure.js \ - "$bruno_report_path" \ - "$PATH_TO_ALLURE_RESULTS" - + collection_name=$(basename "$collection_dir") + bruno_report_path="${PATH_TO_ATTACHMENTS_DIR}/${collection_name}-result.json" + + pushd "$collection_path" > /dev/null || return 1 + + # shellcheck disable=SC2086 + if ! output=$(${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ + --env "${BRUNO_ENV_STR}" \ + ${BRUNO_ENV_VARS_CLI} \ + --reporter-json "${bruno_report_path}" 2>&1); then + + echo "$output" + echo "❌ FAILED: $collection_name" + TOTAL_FAILED=1 + else + echo "$output" + echo "βœ… SUCCESS: $collection_name" + fi + + popd > /dev/null || return 1 + + node /tools/bruno-to-allure.js \ + "$bruno_report_path" \ + "$PATH_TO_ALLURE_RESULTS" fi - done + echo " DEBUG ALLURE RESULTS " ls -la "$PATH_TO_ALLURE_RESULTS" echo "-----------------------------------------" + if [ "$TOTAL_FAILED" -ne 0 ]; then return 1 else From a2a185598ef7f582ac7cd8c1b4b8fcd7a5387a30 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Mon, 2 Mar 2026 19:00:14 +0500 Subject: [PATCH 22/83] fix: add allure results --- test-runner.sh | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/test-runner.sh b/test-runner.sh index a79b6d3..e89469d 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -109,9 +109,48 @@ run_bruno_from_test_params() { node /tools/bruno-to-allure.js \ "$bruno_report_path" \ "$PATH_TO_ALLURE_RESULTS" - fi + + else + echo "⚠️ Collection not found: $collection_path β€” skipping" + + uuid=$(cat /proc/sys/kernel/random/uuid) + skipped_file="$PATH_TO_ALLURE_RESULTS/${uuid}-result.json" + + cat > "$skipped_file" </dev/null 2>&1; then + if allure generate "$PATH_TO_ALLURE_RESULTS" -o "$TMP_DIR/allure-report" --clean; then + if [ -f "$TMP_DIR/allure-report/index.html" ]; then + echo "βœ… Allure report generated: $TMP_DIR/allure-report (index.html present)" + else + echo "⚠️ Allure report directory created but index.html missing" + ls -la "$TMP_DIR/allure-report" || true + fi + else + echo "⚠️ Allure report generation failed (will continue, results will still be uploaded)" + fi + else + echo "⚠️ Allure CLI not found in PATH, skipping HTML report generation" + fi + echo " DEBUG ALLURE RESULTS " ls -la "$PATH_TO_ALLURE_RESULTS" echo "-----------------------------------------" From d318f8f5f485039a4269ac6310ceecc7df0c61a0 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Tue, 3 Mar 2026 11:30:36 +0500 Subject: [PATCH 23/83] fix: add allure report in upload-monitor.sh --- upload-monitor.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/upload-monitor.sh b/upload-monitor.sh index 2fa1ca3..8505b71 100644 --- a/upload-monitor.sh +++ b/upload-monitor.sh @@ -89,9 +89,11 @@ finalize_upload() { if [[ "$ATP_STORAGE_PROVIDER" == "aws" ]]; then s5cmd --no-verify-ssl sync "$TMP_DIR/allure-results/" "${RESULTS_S3_PATH}allure-results/" s5cmd --no-verify-ssl sync "$TMP_DIR/attachments/" "$ATTACHMENTS_S3_PATH" + s5cmd --no-verify-ssl sync "$TMP_DIR/allure-report/" "${REPORTS_S3_PATH}allure-report/" else s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/allure-results/" "${RESULTS_S3_PATH}allure-results/" s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/attachments/" "$ATTACHMENTS_S3_PATH" + s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/allure-report/" "${REPORTS_S3_PATH}allure-report/" fi echo "${ENABLE_JIRA_INTEGRATION:-false}" > "$TMP_DIR/allure-results.uploaded" From ac87ee451ba7109ff1c9a3c4ff6a3d5e978422c6 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Tue, 3 Mar 2026 11:47:05 +0500 Subject: [PATCH 24/83] fix: allure-results in generate-email --- upload-monitor.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/upload-monitor.sh b/upload-monitor.sh index 8505b71..5bf68fe 100644 --- a/upload-monitor.sh +++ b/upload-monitor.sh @@ -90,10 +90,12 @@ finalize_upload() { s5cmd --no-verify-ssl sync "$TMP_DIR/allure-results/" "${RESULTS_S3_PATH}allure-results/" s5cmd --no-verify-ssl sync "$TMP_DIR/attachments/" "$ATTACHMENTS_S3_PATH" s5cmd --no-verify-ssl sync "$TMP_DIR/allure-report/" "${REPORTS_S3_PATH}allure-report/" + s5cmd --no-verify-ssl sync "$TMP_DIR/scripts/email-notification-generated/" "${RESULTS_S3_PATH}email-notification-generated/" else s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/allure-results/" "${RESULTS_S3_PATH}allure-results/" s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/attachments/" "$ATTACHMENTS_S3_PATH" s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/allure-report/" "${REPORTS_S3_PATH}allure-report/" + s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/scripts/email-notification-generated/" "${RESULTS_S3_PATH}email-notification-generated/" fi echo "${ENABLE_JIRA_INTEGRATION:-false}" > "$TMP_DIR/allure-results.uploaded" @@ -115,11 +117,16 @@ finalize_upload() { generate_result_urls() { if [[ "$ATP_STORAGE_PROVIDER" == "aws" ]]; then - RESULTS_URL="${ATP_STORAGE_BUCKET}.${ATP_STORAGE_SERVER_UI_URL}/Result/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/allure-results/" - else + RESULT_URL="${ATP_STORAGE_BUCKET}.${ATP_STORAGE_SERVER_UI_URL}/Result/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/allure-results/" + elif [[ "$ATP_STORAGE_PROVIDER" == "minio" || "$ATP_STORAGE_PROVIDER" == "s3" ]]; then + # Generate base64-encoded URLs for MinIO UI RESULTS_FOLDER_PATH="Result/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/allure-results/" RESULTS_ENCODED_PATH=$(echo -n "${RESULTS_FOLDER_PATH}" | base64) RESULTS_URL="${ATP_STORAGE_SERVER_UI_URL}/browser/${ATP_STORAGE_BUCKET}/${RESULTS_ENCODED_PATH}" + + REPORTS_FOLDER_PATH="Report/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/allure-report/" + REPORTS_ENCODED_PATH=$(echo -n "${REPORTS_FOLDER_PATH}" | base64) + REPORTS_URL="${ATP_STORAGE_SERVER_UI_URL}/browser/${ATP_STORAGE_BUCKET}/${REPORTS_ENCODED_PATH}" fi } From 478777b10485e16b26f749144de2ee427a34e314 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Tue, 3 Mar 2026 11:57:42 +0500 Subject: [PATCH 25/83] fix: shelchek --- upload-monitor.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/upload-monitor.sh b/upload-monitor.sh index 5bf68fe..e820bbf 100644 --- a/upload-monitor.sh +++ b/upload-monitor.sh @@ -1,5 +1,4 @@ #!/bin/bash - # Event-based upload monitoring module start_upload_monitoring() { echo "πŸ“‘ Starting event-based upload monitoring..." @@ -30,8 +29,9 @@ start_inotify_uploader() { DEST_PATH="$2" FILE_PATTERN="${3:-*}" - inotifywait -m -e close_write,create --format '%w%f' "$WATCH_DIR" | while read NEW_FILE; do + inotifywait -m -e close_write,create --format '%w%f' "$WATCH_DIR" | while read -r NEW_FILE; do FILE_NAME=$(basename "$NEW_FILE") + # shellcheck disable=SC2053 if [[ "$FILE_NAME" == $FILE_PATTERN ]]; then upload_file_to_s3 "$NEW_FILE" "$DEST_PATH" fi @@ -56,8 +56,9 @@ start_sync_uploader() { DEST_PATH="$2" FILE_PATTERN="${3:-*}" - inotifywait -m -e close_write,create --format '%w%f' "$WATCH_DIR" | while read NEW_FILE; do + inotifywait -m -e close_write,create --format '%w%f' "$WATCH_DIR" | while read -r NEW_FILE; do FILE_NAME=$(basename "$NEW_FILE") + # shellcheck disable=SC2053 if [[ "$FILE_NAME" == $FILE_PATTERN ]]; then sync_directory_to_s3 "$WATCH_DIR" "$DEST_PATH" fi @@ -117,7 +118,7 @@ finalize_upload() { generate_result_urls() { if [[ "$ATP_STORAGE_PROVIDER" == "aws" ]]; then - RESULT_URL="${ATP_STORAGE_BUCKET}.${ATP_STORAGE_SERVER_UI_URL}/Result/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/allure-results/" + RESULTS_URL="${ATP_STORAGE_BUCKET}.${ATP_STORAGE_SERVER_UI_URL}/Result/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/allure-results/" elif [[ "$ATP_STORAGE_PROVIDER" == "minio" || "$ATP_STORAGE_PROVIDER" == "s3" ]]; then # Generate base64-encoded URLs for MinIO UI RESULTS_FOLDER_PATH="Result/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/allure-results/" From 3f13fccb45e4f69fb0a7850845eb124abceda12a Mon Sep 17 00:00:00 2001 From: saju1025 Date: Tue, 3 Mar 2026 12:32:41 +0500 Subject: [PATCH 26/83] feat: add debug --- upload-monitor.sh | 91 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 77 insertions(+), 14 deletions(-) diff --git a/upload-monitor.sh b/upload-monitor.sh index e820bbf..aac71d9 100644 --- a/upload-monitor.sh +++ b/upload-monitor.sh @@ -77,45 +77,108 @@ sync_directory_to_s3() { s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$SOURCE_DIR/" "$DEST_PATH" > /dev/null 2>&1 fi } - finalize_upload() { - echo "πŸ”„ Finalizing upload operations..." + set -x + + echo "πŸ”„ FINALIZE_UPLOAD START" + date + echo "TMP_DIR: $TMP_DIR" + echo "ATP_STORAGE_PROVIDER: $ATP_STORAGE_PROVIDER" + echo "ATP_STORAGE_SERVER_URL: $ATP_STORAGE_SERVER_URL" + echo "ATP_STORAGE_BUCKET: $ATP_STORAGE_BUCKET" + echo "==================================================" RESULTS_S3_PATH="s3://${ATP_STORAGE_BUCKET}/Result/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/" REPORTS_S3_PATH="s3://${ATP_STORAGE_BUCKET}/Report/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/" ATTACHMENTS_S3_PATH="${REPORTS_S3_PATH}attachments/" + echo "πŸ“‚ RESULTS_S3_PATH: $RESULTS_S3_PATH" + echo "πŸ“‚ REPORTS_S3_PATH: $REPORTS_S3_PATH" + echo "πŸ“‚ ATTACHMENTS_S3_PATH: $ATTACHMENTS_S3_PATH" + + echo "πŸ”‘ Restoring AWS credentials..." restore_aws_credentials + echo "πŸ“Š Local directory sizes:" + du -sh "$TMP_DIR/allure-results" || true + du -sh "$TMP_DIR/allure-report" || true + du -sh "$TMP_DIR/attachments" || true + du -sh "$TMP_DIR/scripts/email-notification-generated" || true + + echo "πŸš€ Uploading allure-results..." + date + if [[ "$ATP_STORAGE_PROVIDER" == "aws" ]]; then + s5cmd -v --no-verify-ssl sync "$TMP_DIR/allure-results/" "${RESULTS_S3_PATH}allure-results/" + else + s5cmd -v --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" \ + sync "$TMP_DIR/allure-results/" "${RESULTS_S3_PATH}allure-results/" + fi + echo "βœ… Done allure-results" + date + + echo "πŸš€ Uploading attachments..." + if [[ "$ATP_STORAGE_PROVIDER" == "aws" ]]; then + s5cmd -v --no-verify-ssl sync "$TMP_DIR/attachments/" "$ATTACHMENTS_S3_PATH" + else + s5cmd -v --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" \ + sync "$TMP_DIR/attachments/" "$ATTACHMENTS_S3_PATH" + fi + echo "βœ… Done attachments" + date + + echo "πŸš€ Uploading allure-report..." + if [[ "$ATP_STORAGE_PROVIDER" == "aws" ]]; then + s5cmd -v --no-verify-ssl sync "$TMP_DIR/allure-report/" "${REPORTS_S3_PATH}allure-report/" + else + s5cmd -v --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" \ + sync "$TMP_DIR/allure-report/" "${REPORTS_S3_PATH}allure-report/" + fi + echo "βœ… Done allure-report" + date + + echo "πŸš€ Uploading email notification..." if [[ "$ATP_STORAGE_PROVIDER" == "aws" ]]; then - s5cmd --no-verify-ssl sync "$TMP_DIR/allure-results/" "${RESULTS_S3_PATH}allure-results/" - s5cmd --no-verify-ssl sync "$TMP_DIR/attachments/" "$ATTACHMENTS_S3_PATH" - s5cmd --no-verify-ssl sync "$TMP_DIR/allure-report/" "${REPORTS_S3_PATH}allure-report/" - s5cmd --no-verify-ssl sync "$TMP_DIR/scripts/email-notification-generated/" "${RESULTS_S3_PATH}email-notification-generated/" + s5cmd -v --no-verify-ssl sync "$TMP_DIR/scripts/email-notification-generated/" \ + "${RESULTS_S3_PATH}email-notification-generated/" else - s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/allure-results/" "${RESULTS_S3_PATH}allure-results/" - s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/attachments/" "$ATTACHMENTS_S3_PATH" - s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/allure-report/" "${REPORTS_S3_PATH}allure-report/" - s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/scripts/email-notification-generated/" "${RESULTS_S3_PATH}email-notification-generated/" + s5cmd -v --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" \ + sync "$TMP_DIR/scripts/email-notification-generated/" \ + "${RESULTS_S3_PATH}email-notification-generated/" fi + echo "βœ… Done email notification" + date + echo "πŸ“„ Creating upload marker..." echo "${ENABLE_JIRA_INTEGRATION:-false}" > "$TMP_DIR/allure-results.uploaded" + echo "πŸš€ Uploading marker file..." if [[ "$ATP_STORAGE_PROVIDER" == "aws" ]]; then - s5cmd --no-verify-ssl cp "$TMP_DIR/allure-results.uploaded" "${RESULTS_S3_PATH}allure-results.uploaded" + s5cmd -v --no-verify-ssl cp "$TMP_DIR/allure-results.uploaded" \ + "${RESULTS_S3_PATH}allure-results.uploaded" else - s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" cp "$TMP_DIR/allure-results.uploaded" "${RESULTS_S3_PATH}allure-results.uploaded" + s5cmd -v --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" \ + cp "$TMP_DIR/allure-results.uploaded" \ + "${RESULTS_S3_PATH}allure-results.uploaded" fi + echo "πŸ”— Generating URLs..." generate_result_urls + + echo "πŸ›‘ Killing background watchers..." + pkill -f inotifywait || true + jobs -p | xargs -r kill || true + + echo "🧹 Cleaning credentials..." final_cleanup echo "" echo "Results are available at: ${RESULTS_URL}" echo "Reports are available at: ${REPORTS_URL}" - echo "βœ… Upload finalization completed" -} + echo "βœ… FINALIZE_UPLOAD DONE" + echo "==================================================" + set +x +} generate_result_urls() { if [[ "$ATP_STORAGE_PROVIDER" == "aws" ]]; then RESULTS_URL="${ATP_STORAGE_BUCKET}.${ATP_STORAGE_SERVER_UI_URL}/Result/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/allure-results/" From 9c295c7e28cf57ac7db65091e302ddc93f699e49 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Tue, 3 Mar 2026 12:59:41 +0500 Subject: [PATCH 27/83] fix: add debug --- upload-monitor.sh | 105 ++++++++++++---------------------------------- 1 file changed, 27 insertions(+), 78 deletions(-) diff --git a/upload-monitor.sh b/upload-monitor.sh index aac71d9..848ab08 100644 --- a/upload-monitor.sh +++ b/upload-monitor.sh @@ -77,108 +77,57 @@ sync_directory_to_s3() { s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$SOURCE_DIR/" "$DEST_PATH" > /dev/null 2>&1 fi } -finalize_upload() { - set -x - echo "πŸ”„ FINALIZE_UPLOAD START" - date - echo "TMP_DIR: $TMP_DIR" - echo "ATP_STORAGE_PROVIDER: $ATP_STORAGE_PROVIDER" - echo "ATP_STORAGE_SERVER_URL: $ATP_STORAGE_SERVER_URL" - echo "ATP_STORAGE_BUCKET: $ATP_STORAGE_BUCKET" - echo "==================================================" +finalize_upload() { + echo "πŸ”„ Finalizing upload operations..." RESULTS_S3_PATH="s3://${ATP_STORAGE_BUCKET}/Result/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/" REPORTS_S3_PATH="s3://${ATP_STORAGE_BUCKET}/Report/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/" ATTACHMENTS_S3_PATH="${REPORTS_S3_PATH}attachments/" - echo "πŸ“‚ RESULTS_S3_PATH: $RESULTS_S3_PATH" - echo "πŸ“‚ REPORTS_S3_PATH: $REPORTS_S3_PATH" - echo "πŸ“‚ ATTACHMENTS_S3_PATH: $ATTACHMENTS_S3_PATH" - - echo "πŸ”‘ Restoring AWS credentials..." restore_aws_credentials - echo "πŸ“Š Local directory sizes:" - du -sh "$TMP_DIR/allure-results" || true - du -sh "$TMP_DIR/allure-report" || true - du -sh "$TMP_DIR/attachments" || true - du -sh "$TMP_DIR/scripts/email-notification-generated" || true - - echo "πŸš€ Uploading allure-results..." - date if [[ "$ATP_STORAGE_PROVIDER" == "aws" ]]; then - s5cmd -v --no-verify-ssl sync "$TMP_DIR/allure-results/" "${RESULTS_S3_PATH}allure-results/" + echo "πŸ“€ Performing final sync to AWS S3..." + echo " Source: $TMP_DIR/allure-results/ -> Destination: ${RESULTS_S3_PATH}allure-results/" + echo " Source: $TMP_DIR/attachments/ -> Destination: $ATTACHMENTS_S3_PATH" + echo " Source: $TMP_DIR/allure-report/ -> Destination: ${REPORTS_S3_PATH}allure-report/" + echo " Source: $TMP_DIR/scripts/email-notification-generated/ -> Destination: ${RESULTS_S3_PATH}email-notification-generated/" + s5cmd --no-verify-ssl sync "$TMP_DIR/allure-results/" "${RESULTS_S3_PATH}allure-results/" + s5cmd --no-verify-ssl sync "$TMP_DIR/attachments/" "$ATTACHMENTS_S3_PATH" + s5cmd --no-verify-ssl sync "$TMP_DIR/allure-report/" "${REPORTS_S3_PATH}allure-report/" + s5cmd --no-verify-ssl sync "$TMP_DIR/scripts/email-notification-generated/" "${RESULTS_S3_PATH}email-notification-generated/" else - s5cmd -v --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" \ - sync "$TMP_DIR/allure-results/" "${RESULTS_S3_PATH}allure-results/" + echo "πŸ“€ Performing final sync to MinIO/S3-compatible storage..." + echo " Source: $TMP_DIR/allure-results/ -> Destination: ${RESULTS_S3_PATH}allure-results/" + echo " Source: $TMP_DIR/attachments/ -> Destination: $ATTACHMENTS_S3_PATH" + echo " Source: $TMP_DIR/allure-report/ -> Destination: ${REPORTS_S3_PATH}allure-report/" + echo " Source: $TMP_DIR/scripts/email-notification-generated/ -> Destination: ${RESULTS_S3_PATH}email-notification-generated/" + s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/allure-results/" "${RESULTS_S3_PATH}allure-results/" + s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/attachments/" "$ATTACHMENTS_S3_PATH" + s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/allure-report/" "${REPORTS_S3_PATH}allure-report/" + s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/scripts/email-notification-generated/" "${RESULTS_S3_PATH}email-notification-generated/" fi - echo "βœ… Done allure-results" - date - echo "πŸš€ Uploading attachments..." - if [[ "$ATP_STORAGE_PROVIDER" == "aws" ]]; then - s5cmd -v --no-verify-ssl sync "$TMP_DIR/attachments/" "$ATTACHMENTS_S3_PATH" - else - s5cmd -v --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" \ - sync "$TMP_DIR/attachments/" "$ATTACHMENTS_S3_PATH" - fi - echo "βœ… Done attachments" - date - - echo "πŸš€ Uploading allure-report..." - if [[ "$ATP_STORAGE_PROVIDER" == "aws" ]]; then - s5cmd -v --no-verify-ssl sync "$TMP_DIR/allure-report/" "${REPORTS_S3_PATH}allure-report/" - else - s5cmd -v --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" \ - sync "$TMP_DIR/allure-report/" "${REPORTS_S3_PATH}allure-report/" - fi - echo "βœ… Done allure-report" - date - - echo "πŸš€ Uploading email notification..." - if [[ "$ATP_STORAGE_PROVIDER" == "aws" ]]; then - s5cmd -v --no-verify-ssl sync "$TMP_DIR/scripts/email-notification-generated/" \ - "${RESULTS_S3_PATH}email-notification-generated/" - else - s5cmd -v --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" \ - sync "$TMP_DIR/scripts/email-notification-generated/" \ - "${RESULTS_S3_PATH}email-notification-generated/" - fi - echo "βœ… Done email notification" - date - - echo "πŸ“„ Creating upload marker..." echo "${ENABLE_JIRA_INTEGRATION:-false}" > "$TMP_DIR/allure-results.uploaded" - echo "πŸš€ Uploading marker file..." if [[ "$ATP_STORAGE_PROVIDER" == "aws" ]]; then - s5cmd -v --no-verify-ssl cp "$TMP_DIR/allure-results.uploaded" \ - "${RESULTS_S3_PATH}allure-results.uploaded" + echo "πŸ“€ Uploading marker file to AWS S3: ${RESULTS_S3_PATH}allure-results.uploaded" + s5cmd --no-verify-ssl cp "$TMP_DIR/allure-results.uploaded" "${RESULTS_S3_PATH}allure-results.uploaded" else - s5cmd -v --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" \ - cp "$TMP_DIR/allure-results.uploaded" \ - "${RESULTS_S3_PATH}allure-results.uploaded" + echo "πŸ“€ Uploading marker file to MinIO/S3-compatible storage: ${RESULTS_S3_PATH}allure-results.uploaded" + s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" cp "$TMP_DIR/allure-results.uploaded" "${RESULTS_S3_PATH}allure-results.uploaded" fi - - echo "πŸ”— Generating URLs..." + echo "βœ… Final sync completed, marker file uploaded" generate_result_urls - - echo "πŸ›‘ Killing background watchers..." - pkill -f inotifywait || true - jobs -p | xargs -r kill || true - - echo "🧹 Cleaning credentials..." final_cleanup echo "" echo "Results are available at: ${RESULTS_URL}" echo "Reports are available at: ${REPORTS_URL}" - echo "βœ… FINALIZE_UPLOAD DONE" - echo "==================================================" - - set +x + echo "βœ… Upload finalization completed" } + generate_result_urls() { if [[ "$ATP_STORAGE_PROVIDER" == "aws" ]]; then RESULTS_URL="${ATP_STORAGE_BUCKET}.${ATP_STORAGE_SERVER_UI_URL}/Result/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/allure-results/" From 952bc0f415de01e44e8fc95ea519a7695ef7873e Mon Sep 17 00:00:00 2001 From: saju1025 Date: Tue, 3 Mar 2026 13:42:06 +0500 Subject: [PATCH 28/83] fix: add echo report view --- upload-monitor.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/upload-monitor.sh b/upload-monitor.sh index 848ab08..52948ca 100644 --- a/upload-monitor.sh +++ b/upload-monitor.sh @@ -125,6 +125,7 @@ finalize_upload() { echo "" echo "Results are available at: ${RESULTS_URL}" echo "Reports are available at: ${REPORTS_URL}" + echo "Report view is available at: ${ATP_REPORT_VIEW_UI_URL}/${REPORTS_FOLDER_PATH}index.html" echo "βœ… Upload finalization completed" } From f991cff17e4c4ecd69f264d9e225d7a1b28b510d Mon Sep 17 00:00:00 2001 From: saju1025 Date: Tue, 3 Mar 2026 16:48:51 +0500 Subject: [PATCH 29/83] fix: update email notification deleted export and fix printf --- email-notification/README-email-notification-json.md | 2 +- .../calculate-email-notification-variables.sh | 10 ++++++---- email-notification/generate-email-notification-json.sh | 8 +++++--- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/email-notification/README-email-notification-json.md b/email-notification/README-email-notification-json.md index 59b5564..6ec2487 100644 --- a/email-notification/README-email-notification-json.md +++ b/email-notification/README-email-notification-json.md @@ -119,7 +119,7 @@ echo "$json_content" # Or use exported variables echo "JSON file: $JSON_FILE" -echo "Content: $GENERATED_JSON" + # File will be saved to: ../email-notification-generated/email-notification-results-generated.json ``` diff --git a/email-notification/calculate-email-notification-variables.sh b/email-notification/calculate-email-notification-variables.sh index fe57282..28d5b2f 100644 --- a/email-notification/calculate-email-notification-variables.sh +++ b/email-notification/calculate-email-notification-variables.sh @@ -113,8 +113,10 @@ if [ "$BC_AVAILABLE" = true ]; then pass_rate_rounded=$(echo "scale=0; $passed_tests * 100 / $total_tests" | bc) else # Use awk for calculations if bc is not available - pass_rate=$(awk "BEGIN {printf \"%.2f\", $passed_tests * 100 / $total_tests}") - pass_rate_rounded=$(awk "BEGIN {printf \"%.0f\", $passed_tests * 100 / $total_tests}") + pass_rate=$(awk -v p="$passed_tests" -v t="$total_tests" \ + 'BEGIN { if (t > 0) printf "%.2f", p * 100 / t; else print "0.00" }') + pass_rate_rounded=$(awk -v p="$passed_tests" -v t="$total_tests" \ + 'BEGIN { if (t > 0) printf "%.0f", p * 100 / t; else print "0" }') fi # Determine overall status @@ -135,8 +137,8 @@ export TEST_FAILED_COUNT="$failed_tests" export TEST_SKIPPED_COUNT="$skipped_tests" export TEST_OVERALL_STATUS="$overall_status" -# Create test details string TEST_DETAILS_STRING="" +# Create test details string for test_detail in "${test_details[@]}"; do if [ -n "$TEST_DETAILS_STRING" ]; then TEST_DETAILS_STRING="$TEST_DETAILS_STRING\n$test_detail" @@ -144,7 +146,7 @@ for test_detail in "${test_details[@]}"; do TEST_DETAILS_STRING="$test_detail" fi done -export TEST_DETAILS_STRING="$TEST_DETAILS_STRING" +TEST_DETAILS_STRING="$TEST_DETAILS_STRING" # Display summary echo "" diff --git a/email-notification/generate-email-notification-json.sh b/email-notification/generate-email-notification-json.sh index 41e742f..e7ad4fb 100644 --- a/email-notification/generate-email-notification-json.sh +++ b/email-notification/generate-email-notification-json.sh @@ -50,7 +50,8 @@ generate_email_notification_json() { # Calculate additional metrics if [ -n "${TEST_TOTAL_COUNT:-}" ] && [ "$TEST_TOTAL_COUNT" -gt 0 ]; then - TEST_FAILURE_RATE=$(awk "BEGIN {printf \"%.2f\", $TEST_FAILED_COUNT * 100 / $TEST_TOTAL_COUNT}") + TEST_FAILURE_RATE=$(awk -v failed="$TEST_FAILED_COUNT" -v total="$TEST_TOTAL_COUNT" \ + 'BEGIN { if (total > 0) printf "%.2f", failed * 100 / total; else print "0.00" }') else TEST_FAILURE_RATE="0.00" fi @@ -230,10 +231,11 @@ generate_email_notification_json() { # Export the JSON content as environment variable for use in other scripts - export GENERATED_JSON="$json_content" export JSON_FILE="$output_file" - log_info "Environment variables exported: GENERATED_JSON, JSON_FILE" + log_info "Environment variables exported: JSON_FILE" + echo "$output_file" + return 0 # Return the JSON content # echo "$json_content" From 64cbacbc93ef1762054c73729713b676e076f2b2 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Tue, 3 Mar 2026 17:12:54 +0500 Subject: [PATCH 30/83] shellcheck --- .../calculate-email-notification-variables.sh | 7 +++---- .../generate-email-notification-json.sh | 14 ++++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/email-notification/calculate-email-notification-variables.sh b/email-notification/calculate-email-notification-variables.sh index 28d5b2f..9a5a30e 100644 --- a/email-notification/calculate-email-notification-variables.sh +++ b/email-notification/calculate-email-notification-variables.sh @@ -19,15 +19,15 @@ log_info() { log_success() { echo "βœ… $1" } - +# shellcheck disable=SC2329 log_warning() { echo "⚠️ $1" } - +# shellcheck disable=SC2329 log_error() { echo "❌ $1" } - +# shellcheck disable=SC2034 # Get script directory SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" @@ -146,7 +146,6 @@ for test_detail in "${test_details[@]}"; do TEST_DETAILS_STRING="$test_detail" fi done -TEST_DETAILS_STRING="$TEST_DETAILS_STRING" # Display summary echo "" diff --git a/email-notification/generate-email-notification-json.sh b/email-notification/generate-email-notification-json.sh index e7ad4fb..67e9dbd 100644 --- a/email-notification/generate-email-notification-json.sh +++ b/email-notification/generate-email-notification-json.sh @@ -22,17 +22,17 @@ generate_email_notification_json() { log_success() { echo "βœ… $1" } - + # shellcheck disable=SC2329 log_warning() { echo "⚠️ $1" } - + # shellcheck disable=SC2329 log_error() { echo "❌ $1" } - # Get script directory - local SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + local SCRIPT_DIR + SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # Set allure results directory to default location local allure_results_dir="/tmp/clone/allure-results" @@ -119,8 +119,10 @@ generate_email_notification_json() { for result_file in "$allure_results_dir"/*-result.json; do if [ -f "$result_file" ]; then # Extract test status and name using jq - local status=$(jq -r '.status' "$result_file" 2>/dev/null || echo "unknown") - local test_name=$(jq -r '.name' "$result_file" 2>/dev/null || echo "Unknown Test") + local status + status=$(jq -r '.status' "$result_file" 2>/dev/null || echo "unknown") + local test_name + test_name=$(jq -r '.name' "$result_file" 2>/dev/null || echo "Unknown Test") # Determine status and emoji local emoji="❓" From 0dfcb75ddb2210f3dd8681a857ef1c88f61008db Mon Sep 17 00:00:00 2001 From: saju1025 Date: Thu, 5 Mar 2026 18:53:23 +0500 Subject: [PATCH 31/83] feat: add pararell --- envgene.sh | 4 +++- test-runner.sh | 46 +++++++++++++++++++--------------------------- 2 files changed, 22 insertions(+), 28 deletions(-) diff --git a/envgene.sh b/envgene.sh index b365b93..66e51a1 100644 --- a/envgene.sh +++ b/envgene.sh @@ -65,5 +65,7 @@ load_envgene() { echo " PUBLIC_GATEWAY_URL=$PUBLIC_GATEWAY_URL" echo " PRIVATE_GATEWAY_URL=$PRIVATE_GATEWAY_URL" echo " INTERNAL_GATEWAY_URL=$INTERNAL_GATEWAY_URL" - echo " OPENSEARCH_URL=$OPENSEARCH_URL" + echo " NAMESPACE=$NAMESPACE" + echo " PUBLIC_GATEWAY_LOGIN=$PUBLIC_GATEWAY_LOGIN" + echo " PUBLIC_GATEWAY_PASSWORD=$PUBLIC_GATEWAY_PASSWORD" } diff --git a/test-runner.sh b/test-runner.sh index e89469d..b12726e 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -76,10 +76,14 @@ run_bruno_from_test_params() { export MONITORING_ALARM_ENGINE_URL export KAFKA_PLATFORM_URL export NAMESPACE + export PUBLIC_GATEWAY_LOGIN + export PUBLIC_GATEWAY_PASSWORD - TOTAL_FAILED=0 + + PIDS=() for collection_dir in "${BRUNO_COLLECTIONS_ARRAY[@]}"; do + ( collection_path="${TMP_DIR}/${collection_dir}" echo "➑️ Processing collection: $collection_path" @@ -88,9 +92,8 @@ run_bruno_from_test_params() { collection_name=$(basename "$collection_dir") bruno_report_path="${PATH_TO_ATTACHMENTS_DIR}/${collection_name}-result.json" - pushd "$collection_path" > /dev/null || return 1 + cd "$collection_path" || exit 1 - # shellcheck disable=SC2086 if ! output=$(${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ --env "${BRUNO_ENV_STR}" \ ${BRUNO_ENV_VARS_CLI} \ @@ -98,43 +101,32 @@ run_bruno_from_test_params() { echo "$output" echo "❌ FAILED: $collection_name" - TOTAL_FAILED=1 + exit 1 else echo "$output" echo "βœ… SUCCESS: $collection_name" fi - popd > /dev/null || return 1 - node /tools/bruno-to-allure.js \ "$bruno_report_path" \ "$PATH_TO_ALLURE_RESULTS" else echo "⚠️ Collection not found: $collection_path β€” skipping" + fi + ) & - uuid=$(cat /proc/sys/kernel/random/uuid) - skipped_file="$PATH_TO_ALLURE_RESULTS/${uuid}-result.json" - - cat > "$skipped_file" </dev/null 2>&1; then if allure generate "$PATH_TO_ALLURE_RESULTS" -o "$TMP_DIR/allure-report" --clean; then @@ -155,7 +147,7 @@ EOF ls -la "$PATH_TO_ALLURE_RESULTS" echo "-----------------------------------------" - if [ "$TOTAL_FAILED" -ne 0 ]; then + if [ "$FAIL" -ne 0 ]; then return 1 else return 0 From 161672d9138bf3492bad5d484084d4da5fd9749f Mon Sep 17 00:00:00 2001 From: saju1025 Date: Fri, 6 Mar 2026 12:32:45 +0500 Subject: [PATCH 32/83] fix: del pararell run and fix problem in JSON --- .../calculate-email-notification-variables.sh | 3 +- .../generate-email-notification-json.sh | 4 ++ test-runner.sh | 46 +++++++++++-------- 3 files changed, 34 insertions(+), 19 deletions(-) diff --git a/email-notification/calculate-email-notification-variables.sh b/email-notification/calculate-email-notification-variables.sh index 9a5a30e..445b171 100644 --- a/email-notification/calculate-email-notification-variables.sh +++ b/email-notification/calculate-email-notification-variables.sh @@ -74,7 +74,8 @@ for result_file in "$ALLURE_RESULTS_DIR"/*-result.json; do # Extract test status using jq status=$(jq -r '.status' "$result_file" 2>/dev/null || echo "unknown") test_name=$(jq -r '.name' "$result_file" 2>/dev/null || echo "Unknown Test") - + test_name=$(printf '%s' "$test_name" | jq -R .) + test_name=${test_name:1:-1} case "$status" in "passed") passed_tests=$((passed_tests + 1)) diff --git a/email-notification/generate-email-notification-json.sh b/email-notification/generate-email-notification-json.sh index 67e9dbd..4dfa401 100644 --- a/email-notification/generate-email-notification-json.sh +++ b/email-notification/generate-email-notification-json.sh @@ -83,6 +83,8 @@ generate_email_notification_json() { local status_part="${BASH_REMATCH[1]// /}" # Keep test name exactly as is (no formatting applied) local test_name="${BASH_REMATCH[2]}" + test_name=$(printf '%s' "$test_name" | jq -R .) + test_name=${test_name:1:-1} # Determine status and emoji @@ -123,6 +125,8 @@ generate_email_notification_json() { status=$(jq -r '.status' "$result_file" 2>/dev/null || echo "unknown") local test_name test_name=$(jq -r '.name' "$result_file" 2>/dev/null || echo "Unknown Test") + test_name=$(printf '%s' "$test_name" | jq -R .) + test_name=${test_name:1:-1} # Determine status and emoji local emoji="❓" diff --git a/test-runner.sh b/test-runner.sh index b12726e..5876a08 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -79,11 +79,9 @@ run_bruno_from_test_params() { export PUBLIC_GATEWAY_LOGIN export PUBLIC_GATEWAY_PASSWORD - - PIDS=() + TOTAL_FAILED=0 for collection_dir in "${BRUNO_COLLECTIONS_ARRAY[@]}"; do - ( collection_path="${TMP_DIR}/${collection_dir}" echo "➑️ Processing collection: $collection_path" @@ -92,8 +90,9 @@ run_bruno_from_test_params() { collection_name=$(basename "$collection_dir") bruno_report_path="${PATH_TO_ATTACHMENTS_DIR}/${collection_name}-result.json" - cd "$collection_path" || exit 1 + pushd "$collection_path" > /dev/null || return 1 + # shellcheck disable=SC2086 if ! output=$(${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ --env "${BRUNO_ENV_STR}" \ ${BRUNO_ENV_VARS_CLI} \ @@ -101,32 +100,43 @@ run_bruno_from_test_params() { echo "$output" echo "❌ FAILED: $collection_name" - exit 1 + TOTAL_FAILED=1 else echo "$output" echo "βœ… SUCCESS: $collection_name" fi + popd > /dev/null || return 1 + node /tools/bruno-to-allure.js \ "$bruno_report_path" \ "$PATH_TO_ALLURE_RESULTS" - + else echo "⚠️ Collection not found: $collection_path β€” skipping" - fi - ) & - PIDS+=($!) - done - FAIL=0 - echo "⏳ Waiting for ${#PIDS[@]} collections to finish..." + uuid=$(cat /proc/sys/kernel/random/uuid) + skipped_file="$PATH_TO_ALLURE_RESULTS/${uuid}-result.json" + + cat > "$skipped_file" </dev/null 2>&1; then if allure generate "$PATH_TO_ALLURE_RESULTS" -o "$TMP_DIR/allure-report" --clean; then @@ -147,7 +157,7 @@ run_bruno_from_test_params() { ls -la "$PATH_TO_ALLURE_RESULTS" echo "-----------------------------------------" - if [ "$FAIL" -ne 0 ]; then + if [ "$TOTAL_FAILED" -ne 0 ]; then return 1 else return 0 From 0727c6bece779b62f2aa5d1c1668f881e7433453 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Wed, 11 Mar 2026 12:37:45 +0500 Subject: [PATCH 33/83] feat: add folder in TEST PARMAS and fix upload-monitor.sh --- test-runner.sh | 6 ++++++ upload-monitor.sh | 15 +++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index 5876a08..85069f1 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -55,6 +55,7 @@ run_bruno_from_test_params() { extract_bruno_collections "$TEST_PARAMS" "BRUNO_COLLECTIONS_ARRAY" extract_bruno_env_vars "$TEST_PARAMS" "BRUNO_ENV_VARS_CLI" extract_bruno_flags "$TEST_PARAMS" "BRUNO_FLAGS_CLI" + extract_bruno_folders "$TEST_PARAMS" "BRUNO_FOLDERS_ARRAY" cd "$TMP_DIR" || return 1 @@ -80,7 +81,11 @@ run_bruno_from_test_params() { export PUBLIC_GATEWAY_PASSWORD TOTAL_FAILED=0 + BRUNO_FOLDERS_CLI=() + for folder in "${BRUNO_FOLDERS_ARRAY[@]}"; do + BRUNO_FOLDERS_CLI+=(--folder "$folder") + done for collection_dir in "${BRUNO_COLLECTIONS_ARRAY[@]}"; do collection_path="${TMP_DIR}/${collection_dir}" @@ -96,6 +101,7 @@ run_bruno_from_test_params() { if ! output=$(${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ --env "${BRUNO_ENV_STR}" \ ${BRUNO_ENV_VARS_CLI} \ + "${BRUNO_FOLDERS_CLI[@]}" \ --reporter-json "${bruno_report_path}" 2>&1); then echo "$output" diff --git a/upload-monitor.sh b/upload-monitor.sh index 52948ca..3e3dd4f 100644 --- a/upload-monitor.sh +++ b/upload-monitor.sh @@ -95,7 +95,12 @@ finalize_upload() { echo " Source: $TMP_DIR/scripts/email-notification-generated/ -> Destination: ${RESULTS_S3_PATH}email-notification-generated/" s5cmd --no-verify-ssl sync "$TMP_DIR/allure-results/" "${RESULTS_S3_PATH}allure-results/" s5cmd --no-verify-ssl sync "$TMP_DIR/attachments/" "$ATTACHMENTS_S3_PATH" - s5cmd --no-verify-ssl sync "$TMP_DIR/allure-report/" "${REPORTS_S3_PATH}allure-report/" + if [ -d "$TMP_DIR/allure-report" ]; then + echo "πŸ“€ Uploading Allure HTML report..." + s5cmd --no-verify-ssl sync "$TMP_DIR/allure-report/" "${REPORTS_S3_PATH}allure-report/" + else + echo "ℹ️ allure-report directory not found β€” skipping HTML upload" + fi s5cmd --no-verify-ssl sync "$TMP_DIR/scripts/email-notification-generated/" "${RESULTS_S3_PATH}email-notification-generated/" else echo "πŸ“€ Performing final sync to MinIO/S3-compatible storage..." @@ -105,7 +110,13 @@ finalize_upload() { echo " Source: $TMP_DIR/scripts/email-notification-generated/ -> Destination: ${RESULTS_S3_PATH}email-notification-generated/" s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/allure-results/" "${RESULTS_S3_PATH}allure-results/" s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/attachments/" "$ATTACHMENTS_S3_PATH" - s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/allure-report/" "${REPORTS_S3_PATH}allure-report/" + if [ -d "$TMP_DIR/allure-report" ]; then + echo "πŸ“€ Uploading Allure HTML report..." + s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" \ + sync "$TMP_DIR/allure-report/" "${REPORTS_S3_PATH}allure-report/" + else + echo "ℹ️ allure-report directory not found β€” skipping HTML upload" + fi s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/scripts/email-notification-generated/" "${RESULTS_S3_PATH}email-notification-generated/" fi From 91c4c86e4d2845cc2c6edd46bcb4e03d4bfd86b7 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Wed, 11 Mar 2026 13:27:53 +0500 Subject: [PATCH 34/83] fix: del --folder and start folder --- test-runner.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-runner.sh b/test-runner.sh index 85069f1..a017052 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -84,7 +84,7 @@ run_bruno_from_test_params() { BRUNO_FOLDERS_CLI=() for folder in "${BRUNO_FOLDERS_ARRAY[@]}"; do - BRUNO_FOLDERS_CLI+=(--folder "$folder") + BRUNO_FOLDERS_CLI+=("$folder") done for collection_dir in "${BRUNO_COLLECTIONS_ARRAY[@]}"; do collection_path="${TMP_DIR}/${collection_dir}" From acfbcf604efdd1309688267098bd742d7caa62c7 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Wed, 11 Mar 2026 14:46:47 +0500 Subject: [PATCH 35/83] fix: folder search --- test-runner.sh | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index a017052..67ea574 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -81,11 +81,7 @@ run_bruno_from_test_params() { export PUBLIC_GATEWAY_PASSWORD TOTAL_FAILED=0 - BRUNO_FOLDERS_CLI=() - for folder in "${BRUNO_FOLDERS_ARRAY[@]}"; do - BRUNO_FOLDERS_CLI+=("$folder") - done for collection_dir in "${BRUNO_COLLECTIONS_ARRAY[@]}"; do collection_path="${TMP_DIR}/${collection_dir}" @@ -97,11 +93,29 @@ run_bruno_from_test_params() { pushd "$collection_path" > /dev/null || return 1 - # shellcheck disable=SC2086 + RESOLVED_FOLDERS=() + + for folder in "${BRUNO_FOLDERS_ARRAY[@]}"; do + found=$(find . -type d -name "$folder" | head -n 1) + + if [ -n "$found" ]; then + echo "Found folder in $collection_name: $found" + RESOLVED_FOLDERS+=("$found") + else + echo "Folder not found in $collection_name: $folder" + fi + done + + if [ ${#RESOLVED_FOLDERS[@]} -eq 0 ]; then + echo " No matching folders found β€” skipping collection" + popd > /dev/null + continue + fi + if ! output=$(${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ --env "${BRUNO_ENV_STR}" \ ${BRUNO_ENV_VARS_CLI} \ - "${BRUNO_FOLDERS_CLI[@]}" \ + "${RESOLVED_FOLDERS[@]}" \ --reporter-json "${bruno_report_path}" 2>&1); then echo "$output" From c7109041e167539ec45441d12c724c430ec7ba56 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Wed, 11 Mar 2026 15:54:04 +0500 Subject: [PATCH 36/83] fix: folder and found --- test-runner.sh | 79 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 56 insertions(+), 23 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index 67ea574..268e2dd 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -95,35 +95,68 @@ run_bruno_from_test_params() { RESOLVED_FOLDERS=() - for folder in "${BRUNO_FOLDERS_ARRAY[@]}"; do - found=$(find . -type d -name "$folder" | head -n 1) + if [ ${#BRUNO_FOLDERS_ARRAY[@]} -gt 0 ]; then - if [ -n "$found" ]; then - echo "Found folder in $collection_name: $found" - RESOLVED_FOLDERS+=("$found") - else - echo "Folder not found in $collection_name: $folder" - fi - done + for folder in "${BRUNO_FOLDERS_ARRAY[@]}"; do + found_any=false + + while IFS= read -r found; do + echo "βœ” Found folder in $collection_name: $found" + RESOLVED_FOLDERS+=("$found") + found_any=true + done < <(find . -maxdepth 5 -type d -name "$folder" -not -path "*/.git/*" -not -path "*/node_modules/*") + + if [ "$found_any" = false ]; then + echo "⚠ Folder not found in $collection_name: $folder" + fi + done - if [ ${#RESOLVED_FOLDERS[@]} -eq 0 ]; then - echo " No matching folders found β€” skipping collection" - popd > /dev/null - continue fi - if ! output=$(${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ - --env "${BRUNO_ENV_STR}" \ - ${BRUNO_ENV_VARS_CLI} \ - "${RESOLVED_FOLDERS[@]}" \ - --reporter-json "${bruno_report_path}" 2>&1); then - echo "$output" - echo "❌ FAILED: $collection_name" - TOTAL_FAILED=1 + if [ ${#BRUNO_FOLDERS_ARRAY[@]} -eq 0 ]; then + + echo "➑ Running full collection" + + if ! output=$(${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ + --env "${BRUNO_ENV_STR}" \ + ${BRUNO_ENV_VARS_CLI} \ + --reporter-json "${bruno_report_path}" 2>&1); then + + echo "$output" + echo "❌ FAILED: $collection_name" + TOTAL_FAILED=1 + + else + echo "$output" + echo "βœ… SUCCESS: $collection_name" + fi + else - echo "$output" - echo "βœ… SUCCESS: $collection_name" + + if [ ${#RESOLVED_FOLDERS[@]} -eq 0 ]; then + echo "⚠ No matching folders found β€” skipping collection" + popd > /dev/null + continue + fi + + echo "➑ Running folders: ${RESOLVED_FOLDERS[*]}" + + if ! output=$(${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ + --env "${BRUNO_ENV_STR}" \ + ${BRUNO_ENV_VARS_CLI} \ + "${RESOLVED_FOLDERS[@]}" \ + --reporter-json "${bruno_report_path}" 2>&1); then + + echo "$output" + echo "❌ FAILED: $collection_name" + TOTAL_FAILED=1 + + else + echo "$output" + echo "βœ… SUCCESS: $collection_name" + fi + fi popd > /dev/null || return 1 From d3eca42661ce0e9b2215676e4325f9c2bb57c723 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Thu, 12 Mar 2026 10:43:52 +0500 Subject: [PATCH 37/83] feat: check add pararell for xargs --- test-runner.sh | 235 ++++++++++++++++++++++++++----------------------- 1 file changed, 125 insertions(+), 110 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index 268e2dd..d01ebf5 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -43,8 +43,118 @@ run_tests() { return "$TEST_EXIT_CODE" } +run_collection_body() { + + collection_dir="$1" + collection_path="${TMP_DIR}/${collection_dir}" + + echo "➑️ Processing collection: $collection_path" + + if [ -d "$collection_path" ]; then + collection_name=$(basename "$collection_dir") + bruno_report_path="${PATH_TO_ATTACHMENTS_DIR}/${collection_name}-result.json" + + pushd "$collection_path" > /dev/null || return 1 + + RESOLVED_FOLDERS=() + + if [ ${#BRUNO_FOLDERS_ARRAY[@]} -gt 0 ]; then + + for folder in "${BRUNO_FOLDERS_ARRAY[@]}"; do + found_any=false + + while IFS= read -r found; do + echo "βœ” Found folder in $collection_name: $found" + RESOLVED_FOLDERS+=("$found") + found_any=true + done < <(find . -maxdepth 5 -type d -name "$folder" -not -path "*/.git/*" -not -path "*/node_modules/*") + + if [ "$found_any" = false ]; then + echo "⚠ Folder not found in $collection_name: $folder" + fi + done + + fi + + + if [ ${#BRUNO_FOLDERS_ARRAY[@]} -eq 0 ]; then + + echo "➑ Running full collection" + + if ! output=$(${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ + --env "${BRUNO_ENV_STR}" \ + ${BRUNO_ENV_VARS_CLI} \ + --reporter-json "${bruno_report_path}" 2>&1); then + + echo "$output" + echo "❌ FAILED: $collection_name" + TOTAL_FAILED=1 + + else + echo "$output" + echo "βœ… SUCCESS: $collection_name" + fi + + else + + if [ ${#RESOLVED_FOLDERS[@]} -eq 0 ]; then + echo "⚠ No matching folders found β€” skipping collection" + popd > /dev/null + return + fi + + echo "➑ Running folders: ${RESOLVED_FOLDERS[*]}" + + if ! output=$(${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ + --env "${BRUNO_ENV_STR}" \ + ${BRUNO_ENV_VARS_CLI} \ + "${RESOLVED_FOLDERS[@]}" \ + --reporter-json "${bruno_report_path}" 2>&1); then + + echo "$output" + echo "❌ FAILED: $collection_name" + TOTAL_FAILED=1 + + else + echo "$output" + echo "βœ… SUCCESS: $collection_name" + fi + + fi + + popd > /dev/null || return 1 + + node /tools/bruno-to-allure.js \ + "$bruno_report_path" \ + "$PATH_TO_ALLURE_RESULTS" + + else + echo "⚠️ Collection not found: $collection_path β€” skipping" + + uuid=$(cat /proc/sys/kernel/random/uuid) + skipped_file="$PATH_TO_ALLURE_RESULTS/${uuid}-result.json" + + cat > "$skipped_file" < /dev/null || return 1 - - RESOLVED_FOLDERS=() - - if [ ${#BRUNO_FOLDERS_ARRAY[@]} -gt 0 ]; then - - for folder in "${BRUNO_FOLDERS_ARRAY[@]}"; do - found_any=false - - while IFS= read -r found; do - echo "βœ” Found folder in $collection_name: $found" - RESOLVED_FOLDERS+=("$found") - found_any=true - done < <(find . -maxdepth 5 -type d -name "$folder" -not -path "*/.git/*" -not -path "*/node_modules/*") - - if [ "$found_any" = false ]; then - echo "⚠ Folder not found in $collection_name: $folder" - fi - done - - fi - - - if [ ${#BRUNO_FOLDERS_ARRAY[@]} -eq 0 ]; then - - echo "➑ Running full collection" - - if ! output=$(${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ - --env "${BRUNO_ENV_STR}" \ - ${BRUNO_ENV_VARS_CLI} \ - --reporter-json "${bruno_report_path}" 2>&1); then - - echo "$output" - echo "❌ FAILED: $collection_name" - TOTAL_FAILED=1 + export TMP_DIR + export PATH_TO_ATTACHMENTS_DIR + export PATH_TO_ALLURE_RESULTS + export BRU_BIN + export BRUNO_ENV_STR + export BRUNO_ENV_VARS_CLI + export BRUNO_FLAGS_CLI + export BRUNO_FOLDERS_ARRAY - else - echo "$output" - echo "βœ… SUCCESS: $collection_name" - fi - - else - - if [ ${#RESOLVED_FOLDERS[@]} -eq 0 ]; then - echo "⚠ No matching folders found β€” skipping collection" - popd > /dev/null - continue - fi + PARALLELISM=${PARALLELISM:-4} - echo "➑ Running folders: ${RESOLVED_FOLDERS[*]}" + echo "⚑ Running ${#BRUNO_COLLECTIONS_ARRAY[@]} collections with parallelism=$PARALLELISM" - if ! output=$(${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ - --env "${BRUNO_ENV_STR}" \ - ${BRUNO_ENV_VARS_CLI} \ - "${RESOLVED_FOLDERS[@]}" \ - --reporter-json "${bruno_report_path}" 2>&1); then - - echo "$output" - echo "❌ FAILED: $collection_name" - TOTAL_FAILED=1 - - else - echo "$output" - echo "βœ… SUCCESS: $collection_name" - fi - - fi - - popd > /dev/null || return 1 - - node /tools/bruno-to-allure.js \ - "$bruno_report_path" \ - "$PATH_TO_ALLURE_RESULTS" - - else - echo "⚠️ Collection not found: $collection_path β€” skipping" - - uuid=$(cat /proc/sys/kernel/random/uuid) - skipped_file="$PATH_TO_ALLURE_RESULTS/${uuid}-result.json" - - cat > "$skipped_file" </dev/null 2>&1; then @@ -210,9 +229,5 @@ EOF ls -la "$PATH_TO_ALLURE_RESULTS" echo "-----------------------------------------" - if [ "$TOTAL_FAILED" -ne 0 ]; then - return 1 - else - return 0 - fi + return 0 } \ No newline at end of file From d9694de5f7ad0fb31360a35a36a5a7686b189bb7 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Thu, 12 Mar 2026 17:25:40 +0500 Subject: [PATCH 38/83] feat: add full debug in allure results --- test-runner.sh | 78 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 63 insertions(+), 15 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index d01ebf5..b1fd1ac 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -100,11 +100,29 @@ run_collection_body() { if [ ${#RESOLVED_FOLDERS[@]} -eq 0 ]; then echo "⚠ No matching folders found β€” skipping collection" popd > /dev/null + uuid=$(cat /proc/sys/kernel/random/uuid) + + cat > "$PATH_TO_ALLURE_RESULTS/${uuid}-result.json" < /dev/null || return 1 - node /tools/bruno-to-allure.js \ - "$bruno_report_path" \ - "$PATH_TO_ALLURE_RESULTS" + if [ -f "$bruno_report_path" ]; then + + node /tools/bruno-to-allure.js \ + "$bruno_report_path" \ + "$PATH_TO_ALLURE_RESULTS" + + else + + echo "⚠ Bruno report missing β€” writing broken test to Allure" + + uuid=$(cat /proc/sys/kernel/random/uuid) + + cat > "$PATH_TO_ALLURE_RESULTS/${uuid}-result.json" < "$skipped_file" < "$PATH_TO_ALLURE_RESULTS/collections.txt" + printf "%s\n" "${BRUNO_COLLECTIONS_ARRAY[@]}" \ | xargs -I {} -P "${PARALLELISM}" bash -c 'run_collection_body "$@"' _ {} || true From b58dbb8abca229970045c0d5e157045a07523817 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Fri, 13 Mar 2026 12:29:45 +0500 Subject: [PATCH 39/83] fix: add debug and fix folder select --- test-runner.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index b1fd1ac..b9b557a 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -48,6 +48,8 @@ run_collection_body() { collection_dir="$1" collection_path="${TMP_DIR}/${collection_dir}" + mapfile -t BRUNO_FOLDERS_ARRAY <<< "$BRUNO_FOLDERS_STR" + echo "➑️ Processing collection: $collection_path" if [ -d "$collection_path" ]; then @@ -144,6 +146,10 @@ EOF if [ -f "$bruno_report_path" ]; then + count=$(jq '.results | length' "$bruno_report_path") + + echo "πŸ“Š $collection_name β†’ $count tests" + printf "%s,%s\n" "$collection_name" "$count" >> "$TMP_DIR/tests_count.csv" node /tools/bruno-to-allure.js \ "$bruno_report_path" \ "$PATH_TO_ALLURE_RESULTS" @@ -217,6 +223,7 @@ run_bruno_from_test_params() { mkdir -p "$PATH_TO_ATTACHMENTS_DIR" mkdir -p "$PATH_TO_ALLURE_RESULTS" + : > "$TMP_DIR/tests_count.csv" echo "NAMESPACE=$NAMESPACE" > "$PATH_TO_ALLURE_RESULTS/environment.properties" echo "PUBLIC_GATEWAY_URL=$PUBLIC_GATEWAY_URL" >> "$PATH_TO_ALLURE_RESULTS/environment.properties" @@ -243,7 +250,8 @@ run_bruno_from_test_params() { export BRUNO_ENV_STR export BRUNO_ENV_VARS_CLI export BRUNO_FLAGS_CLI - export BRUNO_FOLDERS_ARRAY + BRUNO_FOLDERS_STR=$(printf "%s\n" "${BRUNO_FOLDERS_ARRAY[@]}") + export BRUNO_FOLDERS_STR PARALLELISM=${PARALLELISM:-4} echo "Collections to run:" @@ -273,8 +281,10 @@ run_bruno_from_test_params() { echo "⚠️ Allure CLI not found in PATH, skipping HTML report generation" fi - echo " DEBUG ALLURE RESULTS " - ls -la "$PATH_TO_ALLURE_RESULTS" + # echo " DEBUG ALLURE RESULTS " + # ls -la "$PATH_TO_ALLURE_RESULTS" + echo "==== TEST COUNT BY COLLECTION ====" + sort "$TMP_DIR/tests_count.csv" echo "-----------------------------------------" return 0 From 0c18a0df79dd647fb0bff01f169f1e2f1d3f4d02 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Fri, 13 Mar 2026 13:03:55 +0500 Subject: [PATCH 40/83] fix: folder --- test-runner.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index b9b557a..41599c8 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -48,7 +48,11 @@ run_collection_body() { collection_dir="$1" collection_path="${TMP_DIR}/${collection_dir}" - mapfile -t BRUNO_FOLDERS_ARRAY <<< "$BRUNO_FOLDERS_STR" + if [ -n "$BRUNO_FOLDERS_STR" ]; then + mapfile -t BRUNO_FOLDERS_ARRAY <<< "$BRUNO_FOLDERS_STR" + else + BRUNO_FOLDERS_ARRAY=() + fi echo "➑️ Processing collection: $collection_path" @@ -250,8 +254,13 @@ run_bruno_from_test_params() { export BRUNO_ENV_STR export BRUNO_ENV_VARS_CLI export BRUNO_FLAGS_CLI - BRUNO_FOLDERS_STR=$(printf "%s\n" "${BRUNO_FOLDERS_ARRAY[@]}") - export BRUNO_FOLDERS_STR + if [ ${#BRUNO_FOLDERS_ARRAY[@]} -gt 0 ]; then + BRUNO_FOLDERS_STR=$(printf "%s\n" "${BRUNO_FOLDERS_ARRAY[@]}") + else + BRUNO_FOLDERS_STR="" + fi + +export BRUNO_FOLDERS_STR PARALLELISM=${PARALLELISM:-4} echo "Collections to run:" From 677492dfae1b03b3d04a40dd6a2ae22b17f076fe Mon Sep 17 00:00:00 2001 From: saju1025 Date: Mon, 16 Mar 2026 14:58:14 +0500 Subject: [PATCH 41/83] fix allure results --- test-runner.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index 41599c8..1ed1824 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -156,7 +156,8 @@ EOF printf "%s,%s\n" "$collection_name" "$count" >> "$TMP_DIR/tests_count.csv" node /tools/bruno-to-allure.js \ "$bruno_report_path" \ - "$PATH_TO_ALLURE_RESULTS" + "$PATH_TO_ALLURE_RESULTS" \ + "$collection_name" else @@ -170,15 +171,19 @@ EOF "name": "Collection: $collection_name", "status": "broken", "stage": "finished", + "labels": [ + { "name": "parentSuite", "value": "Bruno" }, + { "name": "suite", "value": "$collection_name" } + ], "statusDetails": { "message": "Bruno report file not generated", - "trace": "$output" + "trace": $(jq -Rs . <<< "$output") }, "start": $(date +%s)000, "stop": $(date +%s)000 } EOF - + fi else @@ -193,6 +198,10 @@ EOF "name": "Collection: $(basename "$collection_dir")", "status": "skipped", "stage": "finished", + "labels": [ + { "name": "parentSuite", "value": "Bruno" }, + { "name": "suite", "value": "$(basename "$collection_dir")" } + ], "statusDetails": { "message": "Collection directory not found: $collection_path", "trace": "" @@ -224,7 +233,7 @@ run_bruno_from_test_params() { PATH_TO_ATTACHMENTS_DIR="${TMP_DIR}/attachments" PATH_TO_ALLURE_RESULTS="${TMP_DIR}/allure-results" - + rm -rf "$PATH_TO_ATTACHMENTS_DIR" "$PATH_TO_ALLURE_RESULTS" "$TMP_DIR/allure-report" mkdir -p "$PATH_TO_ATTACHMENTS_DIR" mkdir -p "$PATH_TO_ALLURE_RESULTS" : > "$TMP_DIR/tests_count.csv" From c2a5130742c930939103f80bf1070f5aaea7569d Mon Sep 17 00:00:00 2001 From: saju1025 Date: Tue, 17 Mar 2026 16:58:21 +0500 Subject: [PATCH 42/83] feat: add if submodule --- git-clone.sh | 101 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 81 insertions(+), 20 deletions(-) diff --git a/git-clone.sh b/git-clone.sh index c47638c..bd1d7f0 100644 --- a/git-clone.sh +++ b/git-clone.sh @@ -4,31 +4,85 @@ clone_repository() { if [ -d "$TMP_DIR" ] && [ "$(ls -A "$TMP_DIR" 2>/dev/null)" ]; then echo "ℹ️ Cloning tests repository is not required, because tests are already in image..." - else - echo "πŸ“₯ Cloning tests repository..." + return 0 + fi + + echo "πŸ“₯ Preparing tests repository..." + + REPO_PATH=$(echo "$ATP_TESTS_GIT_REPO_URL" | sed 's|\.git$||') + GIT_BRANCH_CLEANED=$(echo "$ATP_TESTS_GIT_REPO_BRANCH" | sed 's|/|-|') + REPO_NAME=$(basename "$REPO_PATH") + ARCHIVE_URL="${REPO_PATH}/-/archive/${ATP_TESTS_GIT_REPO_BRANCH}/${REPO_NAME}-${GIT_BRANCH_CLEANED}.zip" + + fetch_by_clone_with_submodules() { + if ! command -v git >/dev/null 2>&1; then + echo "❌ git is not installed in the container, cannot clone repository with submodules" + return 1 + fi - # Strip .git from URL and extract repo name - REPO_PATH=$(echo "$ATP_TESTS_GIT_REPO_URL" | sed 's|\.git$||') - GIT_BRANCH_CLEANED=$(echo "$ATP_TESTS_GIT_REPO_BRANCH" | sed 's|/|-|') - REPO_NAME=$(basename "$REPO_PATH") - ARCHIVE_URL="${REPO_PATH}/-/archive/${ATP_TESTS_GIT_REPO_BRANCH}/${REPO_NAME}-${GIT_BRANCH_CLEANED}.zip" + echo "πŸ“₯ .gitmodules detected β€” switching to git clone with submodules..." - echo "πŸ“₯ Downloading archive from: $ARCHIVE_URL" - curl -sSL --fail -H "PRIVATE-TOKEN: ${ATP_TESTS_GIT_TOKEN}" "$ARCHIVE_URL" -o "$TMP_DIR/repo.zip" + rm -rf "$TMP_DIR" - if [[ $? -ne 0 ]]; then + AUTH_REPO_URL="$ATP_TESTS_GIT_REPO_URL" + if [[ "$AUTH_REPO_URL" =~ ^https:// ]]; then + AUTH_REPO_URL=$(echo "$AUTH_REPO_URL" | sed "s|^https://|https://oauth2:${ATP_TESTS_GIT_TOKEN}@|") + fi + + git clone \ + --branch "$ATP_TESTS_GIT_REPO_BRANCH" \ + --single-branch \ + --recurse-submodules \ + "$AUTH_REPO_URL" \ + "$TMP_DIR" || return 1 + + cd "$TMP_DIR" || return 1 + git submodule sync --recursive + git submodule update --init --recursive || return 1 + + echo "βœ… Repository cloned with submodules to: $TMP_DIR" + } + + echo "πŸ“₯ Downloading repository archive from: $ARCHIVE_URL" + curl -sSL --fail \ + -H "PRIVATE-TOKEN: ${ATP_TESTS_GIT_TOKEN}" \ + "$ARCHIVE_URL" \ + -o "$TMP_DIR/repo.zip" || { echo "❌ Failed to download repository archive" exit 1 - fi + } - echo "πŸ“¦ Unzipping..." - unzip -q "$TMP_DIR/repo.zip" -d "$TMP_DIR" - mv "$TMP_DIR"/${REPO_NAME}-${GIT_BRANCH_CLEANED}/* "$TMP_DIR" + echo "πŸ“¦ Unzipping..." + unzip -q "$TMP_DIR/repo.zip" -d "$TMP_DIR" || { + echo "❌ Failed to unzip repository archive" + exit 1 + } + + extracted_dir="$TMP_DIR/${REPO_NAME}-${GIT_BRANCH_CLEANED}" + + if [ -f "$extracted_dir/.gitmodules" ]; then + rm -rf "$extracted_dir" + rm -f "$TMP_DIR/repo.zip" + + fetch_by_clone_with_submodules || { + echo "❌ Failed to clone repository with submodules" + exit 1 + } + else + shopt -s dotglob + mv "$extracted_dir"/* "$TMP_DIR" || { + shopt -u dotglob + echo "❌ Failed to move extracted repository contents" + exit 1 + } + shopt -u dotglob + + rm -rf "$extracted_dir" + rm -f "$TMP_DIR/repo.zip" echo "βœ… Repository extracted to: $TMP_DIR" fi - # Check for either 'app/' nor 'tests/' nor 'collections/' directory (for different runtime types) if [ -d "$TMP_DIR/app" ]; then echo "βœ… Validation successful. Found 'app/' directory in the repo." elif [ -d "$TMP_DIR/tests" ]; then @@ -42,10 +96,8 @@ clone_repository() { exit 1 fi - # Move into the work directory - cd $TMP_DIR + cd "$TMP_DIR" || exit 1 - # List contents to verify if [ -d "$TMP_DIR/app" ]; then echo "πŸ“‹ Contents of $TMP_DIR/app directory:" ls -la app @@ -54,8 +106,17 @@ clone_repository() { ls -la tests fi - # Clear Git token from environment for security + if [ -f "$TMP_DIR/.gitmodules" ]; then + echo "πŸ“‹ .gitmodules detected:" + cat "$TMP_DIR/.gitmodules" + + if command -v git >/dev/null 2>&1; then + echo "πŸ“‹ Submodule status:" + git submodule status || true + fi + fi + unset ATP_TESTS_GIT_TOKEN echo "πŸ” Git token cleared from environment" echo "βœ… Tests repository prepared successfully" -} +} \ No newline at end of file From 62049ca69ac1a40abd15410d9ba29d7a1f80304b Mon Sep 17 00:00:00 2001 From: saju1025 Date: Wed, 18 Mar 2026 12:06:19 +0500 Subject: [PATCH 43/83] fix: submodule --- git-clone.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/git-clone.sh b/git-clone.sh index bd1d7f0..1003c04 100644 --- a/git-clone.sh +++ b/git-clone.sh @@ -32,13 +32,27 @@ clone_repository() { git clone \ --branch "$ATP_TESTS_GIT_REPO_BRANCH" \ --single-branch \ - --recurse-submodules \ "$AUTH_REPO_URL" \ "$TMP_DIR" || return 1 cd "$TMP_DIR" || return 1 + + if [ -f .gitmodules ]; then + echo "πŸ”§ Rewriting submodule URLs to use token authentication..." + + git config --file=.gitmodules --get-regexp '^submodule\..*\.url$' | while read -r key url; do + if [[ "$url" =~ ^https://git\.netcracker\.com/ ]]; then + auth_url=$(echo "$url" | sed "s|^https://|https://oauth2:${ATP_TESTS_GIT_TOKEN}@|") + echo " $key -> authenticated git.netcracker.com URL" + git config --file=.gitmodules "$key" "$auth_url" + fi + done + fi + git submodule sync --recursive git submodule update --init --recursive || return 1 + echo "πŸ“‹ Submodule status after initialization:" + git submodule status || true echo "βœ… Repository cloned with submodules to: $TMP_DIR" } From de223424e73ef5cddec270f02bfa66e6e2a0c2d7 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Thu, 19 Mar 2026 11:47:35 +0500 Subject: [PATCH 44/83] feat: add serverhostname --- envgene.sh | 80 +++++++++++++++++++++----------------------------- test-runner.sh | 2 ++ 2 files changed, 36 insertions(+), 46 deletions(-) diff --git a/envgene.sh b/envgene.sh index 66e51a1..80e7572 100644 --- a/envgene.sh +++ b/envgene.sh @@ -3,69 +3,57 @@ load_envgene() { if [ -z "${ATP_ENVGENE_CONFIGURATION:-}" ]; then - echo " ATP_ENVGENE_CONFIGURATION is empty, skipping EnvGene mapping" + echo "ATP_ENVGENE_CONFIGURATION is empty, skipping EnvGene mapping" return fi - echo " Loading EnvGene configuration..." + echo "Loading EnvGene configuration..." - export PUBLIC_GATEWAY_URL=$(echo "$ATP_ENVGENE_CONFIGURATION" \ - | jq -r '.systems[] | .["public-gateway"]? // empty - | .connections[0].HTTP.url // empty') + get_value() { + echo "$ATP_ENVGENE_CONFIGURATION" | jq -r "$1 // empty" + } - export PUBLIC_GATEWAY_LOGIN=$(echo "$ATP_ENVGENE_CONFIGURATION" \ - | jq -r '.systems[] | .["public-gateway"]? // empty - | .connections[0].HTTP.login // empty') + export PUBLIC_GATEWAY_URL=$(get_value '.systems[] | .["public-gateway"]? | .connections[0].HTTP.url') + export PUBLIC_GATEWAY_LOGIN=$(get_value '.systems[] | .["public-gateway"]? | .connections[0].HTTP.login') + export PUBLIC_GATEWAY_PASSWORD=$(get_value '.systems[] | .["public-gateway"]? | .connections[0].HTTP.password') if [ -n "$PUBLIC_GATEWAY_URL" ]; then + host=$(echo "$PUBLIC_GATEWAY_URL" | sed -E 's#https?://([^/]+).*#\1#') - namespace_part=${host#public-gateway-} - export NAMESPACE=${namespace_part%%.*} + + if [[ "$host" == public-gateway-*.* ]]; then + namespace_part=${host#public-gateway-} + export NAMESPACE=${namespace_part%%.*} + + if [[ "$host" == public-gateway-$NAMESPACE.* ]]; then + export SERVER_HOSTNAME=${host#public-gateway-$NAMESPACE.} + else + export SERVER_HOSTNAME="$host" + fi + else + export NAMESPACE="unknown" + export SERVER_HOSTNAME="$host" + fi else export NAMESPACE="unknown" + export SERVER_HOSTNAME="unknown" fi - export PUBLIC_GATEWAY_PASSWORD=$(echo "$ATP_ENVGENE_CONFIGURATION" \ - | jq -r '.systems[] | .["public-gateway"]? // empty - | .connections[0].HTTP.password // empty') - - - export PRIVATE_GATEWAY_URL=$(echo "$ATP_ENVGENE_CONFIGURATION" \ - | jq -r '.systems[] | .["private-gateway"]? // empty - | .connections[0].HTTP.url // empty') - - export INTERNAL_GATEWAY_URL=$(echo "$ATP_ENVGENE_CONFIGURATION" \ - | jq -r '.systems[] | .["internal-gateway"]? // empty - | .connections[0].HTTP.url // empty') - - export OPENSEARCH_URL=$(echo "$ATP_ENVGENE_CONFIGURATION" \ - | jq -r '.systems[] | .["opensearch"]? // empty - | .connections[0].HTTP.url // empty') - - export HUAWEI_URL=$(echo "$ATP_ENVGENE_CONFIGURATION" \ - | jq -r '.systems[] | .["huawei"]? // empty - | .connections[0].HTTP.url // empty') - - export HUAWEI_LOGIN=$(echo "$ATP_ENVGENE_CONFIGURATION" \ - | jq -r '.systems[] | .["huawei"]? // empty - | .connections[0].HTTP.login // empty') - - export HUAWEI_PASSWORD=$(echo "$ATP_ENVGENE_CONFIGURATION" \ - | jq -r '.systems[] | .["huawei"]? // empty - | .connections[0].HTTP.password // empty') - export MONITORING_ALARM_ENGINE_URL=$(echo "$ATP_ENVGENE_CONFIGURATION" \ - | jq -r '.systems[] | .["monitoring-alarm-engine"]? // empty - | .connections[0].HTTP.url // empty') - - export KAFKA_PLATFORM_URL=$(echo "$ATP_ENVGENE_CONFIGURATION" \ - | jq -r '.systems[] | .["kafka-platform"]? // empty - | .connections[0].HTTP.url // empty') + export PRIVATE_GATEWAY_URL=$(get_value '.systems[] | .["private-gateway"]? | .connections[0].HTTP.url') + export INTERNAL_GATEWAY_URL=$(get_value '.systems[] | .["internal-gateway"]? | .connections[0].HTTP.url') + export OPENSEARCH_URL=$(get_value '.systems[] | .["opensearch"]? | .connections[0].HTTP.url') + export HUAWEI_URL=$(get_value '.systems[] | .["huawei"]? | .connections[0].HTTP.url') + export HUAWEI_LOGIN=$(get_value '.systems[] | .["huawei"]? | .connections[0].HTTP.login') + export HUAWEI_PASSWORD=$(get_value '.systems[] | .["huawei"]? | .connections[0].HTTP.password') + export MONITORING_ALARM_ENGINE_URL=$(get_value '.systems[] | .["monitoring-alarm-engine"]? | .connections[0].HTTP.url') + export KAFKA_PLATFORM_URL=$(get_value '.systems[] | .["kafka-platform"]? | .connections[0].HTTP.url') echo "EnvGene mapped:" echo " PUBLIC_GATEWAY_URL=$PUBLIC_GATEWAY_URL" echo " PRIVATE_GATEWAY_URL=$PRIVATE_GATEWAY_URL" echo " INTERNAL_GATEWAY_URL=$INTERNAL_GATEWAY_URL" echo " NAMESPACE=$NAMESPACE" + echo " SERVER_HOSTNAME=$SERVER_HOSTNAME" echo " PUBLIC_GATEWAY_LOGIN=$PUBLIC_GATEWAY_LOGIN" echo " PUBLIC_GATEWAY_PASSWORD=$PUBLIC_GATEWAY_PASSWORD" -} +} \ No newline at end of file diff --git a/test-runner.sh b/test-runner.sh index 1ed1824..9110a8b 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -252,6 +252,7 @@ run_bruno_from_test_params() { export NAMESPACE export PUBLIC_GATEWAY_LOGIN export PUBLIC_GATEWAY_PASSWORD + export SERVER_HOSTNAME TOTAL_FAILED=0 export -f run_collection_body @@ -263,6 +264,7 @@ run_bruno_from_test_params() { export BRUNO_ENV_STR export BRUNO_ENV_VARS_CLI export BRUNO_FLAGS_CLI + if [ ${#BRUNO_FOLDERS_ARRAY[@]} -gt 0 ]; then BRUNO_FOLDERS_STR=$(printf "%s\n" "${BRUNO_FOLDERS_ARRAY[@]}") else From a9c6f2526dd57499467fd058663643d5108a35fc Mon Sep 17 00:00:00 2001 From: saju1025 Date: Fri, 20 Mar 2026 15:01:41 +0500 Subject: [PATCH 45/83] fix: add debug --- test-runner.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index 9110a8b..4098098 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -143,15 +143,23 @@ EOF echo "$output" echo "βœ… SUCCESS: $collection_name" fi - + echo "πŸ§ͺ Bruno finished for $collection_name at $(date)" fi popd > /dev/null || return 1 if [ -f "$bruno_report_path" ]; then + echo "πŸ“¦ Parsing report: $bruno_report_path" + echo "⏱ Time before jq: $(date)" - count=$(jq '.results | length' "$bruno_report_path") + echo "DEBUG JSON TYPE:" + jq 'type' "$bruno_report_path" + echo "DEBUG JSON HEAD:" + head -n 5 "$bruno_report_path" + count=$(jq 'if type=="array" then length else .results | length end' "$bruno_report_path") + echo "πŸ“Š $collection_name β†’ $count tests" + echo "⏱ Time after jq: $(date)" echo "πŸ“Š $collection_name β†’ $count tests" printf "%s,%s\n" "$collection_name" "$count" >> "$TMP_DIR/tests_count.csv" node /tools/bruno-to-allure.js \ From 4f6cdcbc648f5e658a4cbd9ab8bf7e7488f7cfd3 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Mon, 30 Mar 2026 15:59:08 +0500 Subject: [PATCH 46/83] fix: jq parse erorr --- test-runner.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-runner.sh b/test-runner.sh index 4098098..4f121d5 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -157,7 +157,7 @@ EOF echo "DEBUG JSON HEAD:" head -n 5 "$bruno_report_path" - count=$(jq 'if type=="array" then length else .results | length end' "$bruno_report_path") + count=$(jq 'if type=="array" then length elif type=="object" and has("results") then (.results | length) else 0 end' "$bruno_report_path") echo "πŸ“Š $collection_name β†’ $count tests" echo "⏱ Time after jq: $(date)" echo "πŸ“Š $collection_name β†’ $count tests" From afe963ab21c5e978cccb566f021f25ea30598d79 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Mon, 30 Mar 2026 16:45:15 +0500 Subject: [PATCH 47/83] fix: allure report fix --- test-runner.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-runner.sh b/test-runner.sh index 4f121d5..2049ec6 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -157,7 +157,7 @@ EOF echo "DEBUG JSON HEAD:" head -n 5 "$bruno_report_path" - count=$(jq 'if type=="array" then length elif type=="object" and has("results") then (.results | length) else 0 end' "$bruno_report_path") + count=$(jq 'if type=="array" then (if (.[0]?|type)=="object" and (.[0]?|has("results")) then ([.[].results[]]|length) else length end) elif type=="object" and has("results") then (.results|length) else 0 end' "$bruno_report_path") echo "πŸ“Š $collection_name β†’ $count tests" echo "⏱ Time after jq: $(date)" echo "πŸ“Š $collection_name β†’ $count tests" From 8e3bb44c50a0183840d76be450c62e74351e8eea Mon Sep 17 00:00:00 2001 From: saju1025 Date: Tue, 31 Mar 2026 11:17:54 +0500 Subject: [PATCH 48/83] feat: add debug in test_runner --- test-runner.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index 2049ec6..9af7f38 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -60,6 +60,9 @@ run_collection_body() { collection_name=$(basename "$collection_dir") bruno_report_path="${PATH_TO_ATTACHMENTS_DIR}/${collection_name}-result.json" + collection_start_ts=$(date +%s) + echo "πŸš€ START collection=$collection_name pid=$$ time=$(date '+%H:%M:%S')" + pushd "$collection_path" > /dev/null || return 1 RESOLVED_FOLDERS=() @@ -87,6 +90,8 @@ run_collection_body() { echo "➑ Running full collection" + echo "β–Ά BRUNO RUN START collection=$collection_name pid=$$ mode=full time=$(date '+%H:%M:%S')" + if ! output=$(${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ --env "${BRUNO_ENV_STR}" \ ${BRUNO_ENV_VARS_CLI} \ @@ -100,7 +105,7 @@ run_collection_body() { echo "$output" echo "βœ… SUCCESS: $collection_name" fi - + echo "β—€ BRUNO RUN END collection=$collection_name pid=$$ time=$(date '+%H:%M:%S')" else if [ ${#RESOLVED_FOLDERS[@]} -eq 0 ]; then @@ -122,12 +127,14 @@ run_collection_body() { "stop": $(date +%s)000 } EOF - + collection_end_ts=$(date +%s) + echo "🏁 END collection=$collection_name pid=$$ duration=$((collection_end_ts-collection_start_ts))s time=$(date '+%H:%M:%S')" return fi echo "➑ Running folders: ${RESOLVED_FOLDERS[*]}" + echo "β–Ά BRUNO RUN START collection=$collection_name pid=$$ mode=folders time=$(date '+%H:%M:%S')" if ! output=$(${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ --env "${BRUNO_ENV_STR}" \ @@ -143,14 +150,17 @@ EOF echo "$output" echo "βœ… SUCCESS: $collection_name" fi - echo "πŸ§ͺ Bruno finished for $collection_name at $(date)" + echo "β—€ BRUNO RUN END collection=$collection_name pid=$$ time=$(date '+%H:%M:%S')" fi popd > /dev/null || return 1 + collection_end_ts=$(date +%s) + + echo "🏁 END collection=$collection_name pid=$$ duration=$((collection_end_ts-collection_start_ts))s time=$(date '+%H:%M:%S')" + if [ -f "$bruno_report_path" ]; then echo "πŸ“¦ Parsing report: $bruno_report_path" - echo "⏱ Time before jq: $(date)" echo "DEBUG JSON TYPE:" jq 'type' "$bruno_report_path" @@ -159,8 +169,6 @@ EOF head -n 5 "$bruno_report_path" count=$(jq 'if type=="array" then (if (.[0]?|type)=="object" and (.[0]?|has("results")) then ([.[].results[]]|length) else length end) elif type=="object" and has("results") then (.results|length) else 0 end' "$bruno_report_path") echo "πŸ“Š $collection_name β†’ $count tests" - echo "⏱ Time after jq: $(date)" - echo "πŸ“Š $collection_name β†’ $count tests" printf "%s,%s\n" "$collection_name" "$count" >> "$TMP_DIR/tests_count.csv" node /tools/bruno-to-allure.js \ "$bruno_report_path" \ From f039d9afb9051dc997a348caaf421776986866f2 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Tue, 31 Mar 2026 12:42:44 +0500 Subject: [PATCH 49/83] feat: add new debug in tets_runner --- test-runner.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test-runner.sh b/test-runner.sh index 9af7f38..7e6ded7 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -298,9 +298,15 @@ export BRUNO_FOLDERS_STR printf "%s\n" "${BRUNO_COLLECTIONS_ARRAY[@]}" > "$PATH_TO_ALLURE_RESULTS/collections.txt" + parallel_start_ts=$(date +%s) + echo "⏳ XARGS PHASE START time=$(date '+%H:%M:%S')" + printf "%s\n" "${BRUNO_COLLECTIONS_ARRAY[@]}" \ | xargs -I {} -P "${PARALLELISM}" bash -c 'run_collection_body "$@"' _ {} || true + parallel_end_ts=$(date +%s) + echo "βœ… XARGS PHASE END time=$(date '+%H:%M:%S') took=$((parallel_end_ts-parallel_start_ts))s" + echo "πŸ“Š Generating Allure HTML report..." if command -v allure >/dev/null 2>&1; then if allure generate "$PATH_TO_ALLURE_RESULTS" -o "$TMP_DIR/allure-report" --clean; then From dd9fd4f057abe071d98a0dd3e8ac33daeee8ad23 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Tue, 31 Mar 2026 13:51:12 +0500 Subject: [PATCH 50/83] ATPIII-1 upd vrs --- test-runner.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index 7e6ded7..16ae606 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -128,7 +128,7 @@ run_collection_body() { } EOF collection_end_ts=$(date +%s) - echo "🏁 END collection=$collection_name pid=$$ duration=$((collection_end_ts-collection_start_ts))s time=$(date '+%H:%M:%S')" + echo "🏁 BRUNO EXECUTION FINISHED =$collection_name pid=$$ duration=$((collection_end_ts-collection_start_ts))s time=$(date '+%H:%M:%S')" return fi @@ -157,7 +157,7 @@ EOF collection_end_ts=$(date +%s) - echo "🏁 END collection=$collection_name pid=$$ duration=$((collection_end_ts-collection_start_ts))s time=$(date '+%H:%M:%S')" + echo "🏁 BRUNO EXECUTION FINISHED =$collection_name pid=$$ duration=$((collection_end_ts-collection_start_ts))s time=$(date '+%H:%M:%S')" if [ -f "$bruno_report_path" ]; then echo "πŸ“¦ Parsing report: $bruno_report_path" @@ -174,7 +174,7 @@ EOF "$bruno_report_path" \ "$PATH_TO_ALLURE_RESULTS" \ "$collection_name" - + echo "βœ… COLLECTION FULLY FINISHED collection=$collection_name pid=$$ time=$(date '+%H:%M:%S')" else echo "⚠ Bruno report missing β€” writing broken test to Allure" @@ -306,7 +306,7 @@ export BRUNO_FOLDERS_STR parallel_end_ts=$(date +%s) echo "βœ… XARGS PHASE END time=$(date '+%H:%M:%S') took=$((parallel_end_ts-parallel_start_ts))s" - + echo "πŸ“Š Generating Allure HTML report..." if command -v allure >/dev/null 2>&1; then if allure generate "$PATH_TO_ALLURE_RESULTS" -o "$TMP_DIR/allure-report" --clean; then From 4bbb44c23f82b9ff45062614b6f4b90010b6c91a Mon Sep 17 00:00:00 2001 From: saju1025 Date: Tue, 31 Mar 2026 15:09:53 +0500 Subject: [PATCH 51/83] fix: delete logs bruno --- test-runner.sh | 46 +++++++++++++++++++--------------------------- 1 file changed, 19 insertions(+), 27 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index 16ae606..840d539 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -59,6 +59,7 @@ run_collection_body() { if [ -d "$collection_path" ]; then collection_name=$(basename "$collection_dir") bruno_report_path="${PATH_TO_ATTACHMENTS_DIR}/${collection_name}-result.json" + raw_log_path="${PATH_TO_ATTACHMENTS_DIR}/${collection_name}.raw.log" collection_start_ts=$(date +%s) echo "πŸš€ START collection=$collection_name pid=$$ time=$(date '+%H:%M:%S')" @@ -89,22 +90,20 @@ run_collection_body() { if [ ${#BRUNO_FOLDERS_ARRAY[@]} -eq 0 ]; then echo "➑ Running full collection" - echo "β–Ά BRUNO RUN START collection=$collection_name pid=$$ mode=full time=$(date '+%H:%M:%S')" - if ! output=$(${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ + if ${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ --env "${BRUNO_ENV_STR}" \ ${BRUNO_ENV_VARS_CLI} \ - --reporter-json "${bruno_report_path}" 2>&1); then - - echo "$output" - echo "❌ FAILED: $collection_name" - TOTAL_FAILED=1 - - else - echo "$output" + --reporter-json "${bruno_report_path}" \ + >"${raw_log_path}" 2>&1; then echo "βœ… SUCCESS: $collection_name" + else + rc=$? + echo "❌ FAILED: $collection_name rc=$rc" + TOTAL_FAILED=0 fi + echo "β—€ BRUNO RUN END collection=$collection_name pid=$$ time=$(date '+%H:%M:%S')" else @@ -133,23 +132,21 @@ EOF fi echo "➑ Running folders: ${RESOLVED_FOLDERS[*]}" - echo "β–Ά BRUNO RUN START collection=$collection_name pid=$$ mode=folders time=$(date '+%H:%M:%S')" - - if ! output=$(${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ + + if ${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ --env "${BRUNO_ENV_STR}" \ ${BRUNO_ENV_VARS_CLI} \ "${RESOLVED_FOLDERS[@]}" \ - --reporter-json "${bruno_report_path}" 2>&1); then - - echo "$output" - echo "❌ FAILED: $collection_name" - TOTAL_FAILED=1 - - else - echo "$output" + --reporter-json "${bruno_report_path}" \ + >"${raw_log_path}" 2>&1; then echo "βœ… SUCCESS: $collection_name" + else + rc=$? + echo "❌ FAILED: $collection_name rc=$rc" + TOTAL_FAILED=1 fi + echo "β—€ BRUNO RUN END collection=$collection_name pid=$$ time=$(date '+%H:%M:%S')" fi @@ -162,11 +159,6 @@ EOF if [ -f "$bruno_report_path" ]; then echo "πŸ“¦ Parsing report: $bruno_report_path" - echo "DEBUG JSON TYPE:" - jq 'type' "$bruno_report_path" - - echo "DEBUG JSON HEAD:" - head -n 5 "$bruno_report_path" count=$(jq 'if type=="array" then (if (.[0]?|type)=="object" and (.[0]?|has("results")) then ([.[].results[]]|length) else length end) elif type=="object" and has("results") then (.results|length) else 0 end' "$bruno_report_path") echo "πŸ“Š $collection_name β†’ $count tests" printf "%s,%s\n" "$collection_name" "$count" >> "$TMP_DIR/tests_count.csv" @@ -193,7 +185,7 @@ EOF ], "statusDetails": { "message": "Bruno report file not generated", - "trace": $(jq -Rs . <<< "$output") + "trace": "See raw log: $raw_log_path" }, "start": $(date +%s)000, "stop": $(date +%s)000 From c8da24d63f6a7a5a1703f739c633fe6a8ea0fefc Mon Sep 17 00:00:00 2001 From: saju1025 Date: Tue, 31 Mar 2026 16:13:19 +0500 Subject: [PATCH 52/83] fix: upload monitor --- test-runner.sh | 2 ++ upload-monitor.sh | 33 ++++++++++++++++++++++----------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index 840d539..4433c29 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -296,6 +296,8 @@ export BRUNO_FOLDERS_STR printf "%s\n" "${BRUNO_COLLECTIONS_ARRAY[@]}" \ | xargs -I {} -P "${PARALLELISM}" bash -c 'run_collection_body "$@"' _ {} || true + stop_upload_monitoring + parallel_end_ts=$(date +%s) echo "βœ… XARGS PHASE END time=$(date '+%H:%M:%S') took=$((parallel_end_ts-parallel_start_ts))s" diff --git a/upload-monitor.sh b/upload-monitor.sh index 3e3dd4f..df732a5 100644 --- a/upload-monitor.sh +++ b/upload-monitor.sh @@ -2,7 +2,7 @@ # Event-based upload monitoring module start_upload_monitoring() { echo "πŸ“‘ Starting event-based upload monitoring..." - + UPLOAD_MONITOR_PIDS=() RESULTS_S3_PATH="s3://${ATP_STORAGE_BUCKET}/Result/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/" REPORTS_S3_PATH="s3://${ATP_STORAGE_BUCKET}/Report/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/" ATTACHMENTS_S3_PATH="${REPORTS_S3_PATH}attachments/" @@ -14,8 +14,8 @@ start_upload_monitoring() { _BACKGROUND_S3_SECRET="$_LOCAL_S3_SECRET" if [[ "${UPLOAD_METHOD:-cp}" == "sync" ]]; then - start_sync_uploader "$TMP_DIR/allure-results" "${RESULTS_S3_PATH}allure-results/" "*result.json" & - start_sync_uploader "$TMP_DIR/attachments" "$ATTACHMENTS_S3_PATH" & + start_sync_uploader "$TMP_DIR/allure-results" "${RESULTS_S3_PATH}allure-results/" "*result.json" + start_sync_uploader "$TMP_DIR/attachments" "$ATTACHMENTS_S3_PATH" else start_inotify_uploader "$TMP_DIR/allure-results" "${RESULTS_S3_PATH}allure-results/" "*result.json" & start_inotify_uploader "$TMP_DIR/attachments" "$ATTACHMENTS_S3_PATH" & @@ -25,17 +25,18 @@ start_upload_monitoring() { } start_inotify_uploader() { - WATCH_DIR="$1" - DEST_PATH="$2" - FILE_PATTERN="${3:-*}" + local WATCH_DIR="$1" + local DEST_PATH="$2" + local FILE_PATTERN="${3:-*}" inotifywait -m -e close_write,create --format '%w%f' "$WATCH_DIR" | while read -r NEW_FILE; do FILE_NAME=$(basename "$NEW_FILE") - # shellcheck disable=SC2053 if [[ "$FILE_NAME" == $FILE_PATTERN ]]; then upload_file_to_s3 "$NEW_FILE" "$DEST_PATH" fi done & + + UPLOAD_MONITOR_PIDS+=($!) } upload_file_to_s3() { @@ -52,17 +53,18 @@ upload_file_to_s3() { } start_sync_uploader() { - WATCH_DIR="$1" - DEST_PATH="$2" - FILE_PATTERN="${3:-*}" + local WATCH_DIR="$1" + local DEST_PATH="$2" + local FILE_PATTERN="${3:-*}" inotifywait -m -e close_write,create --format '%w%f' "$WATCH_DIR" | while read -r NEW_FILE; do FILE_NAME=$(basename "$NEW_FILE") - # shellcheck disable=SC2053 if [[ "$FILE_NAME" == $FILE_PATTERN ]]; then sync_directory_to_s3 "$WATCH_DIR" "$DEST_PATH" fi done & + + UPLOAD_MONITOR_PIDS+=($!) } sync_directory_to_s3() { @@ -78,6 +80,15 @@ sync_directory_to_s3() { fi } +stop_upload_monitoring() { + echo "πŸ›‘ Stopping upload monitors..." + for pid in "${UPLOAD_MONITOR_PIDS[@]}"; do + kill "$pid" 2>/dev/null || true + wait "$pid" 2>/dev/null || true + done + echo "βœ… Upload monitors stopped" +} + finalize_upload() { echo "πŸ”„ Finalizing upload operations..." From a22ab0a411a3e657097fecf78ec138a6f9d42414 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Tue, 31 Mar 2026 17:29:17 +0500 Subject: [PATCH 53/83] fix: update xargs --- test-runner.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index 4433c29..ca6737a 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -293,8 +293,7 @@ export BRUNO_FOLDERS_STR parallel_start_ts=$(date +%s) echo "⏳ XARGS PHASE START time=$(date '+%H:%M:%S')" - printf "%s\n" "${BRUNO_COLLECTIONS_ARRAY[@]}" \ - | xargs -I {} -P "${PARALLELISM}" bash -c 'run_collection_body "$@"' _ {} || true + xargs -P "${PARALLELISM}" -I {} bash -c 'run_collection_body "$@"' _ {} <<< "$(printf "%s\n" "${BRUNO_COLLECTIONS_ARRAY[@]}")" || true stop_upload_monitoring From 11a61ebca07c39fa030793a1ac2ac6b88d33963d Mon Sep 17 00:00:00 2001 From: saju1025 Date: Wed, 1 Apr 2026 11:17:01 +0500 Subject: [PATCH 54/83] feat: check this update --- test-runner.sh | 1 - upload-monitor.sh | 50 +++++++++++++++++++++++------------------------ 2 files changed, 24 insertions(+), 27 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index ca6737a..1fbe69d 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -295,7 +295,6 @@ export BRUNO_FOLDERS_STR xargs -P "${PARALLELISM}" -I {} bash -c 'run_collection_body "$@"' _ {} <<< "$(printf "%s\n" "${BRUNO_COLLECTIONS_ARRAY[@]}")" || true - stop_upload_monitoring parallel_end_ts=$(date +%s) echo "βœ… XARGS PHASE END time=$(date '+%H:%M:%S') took=$((parallel_end_ts-parallel_start_ts))s" diff --git a/upload-monitor.sh b/upload-monitor.sh index df732a5..6aa3690 100644 --- a/upload-monitor.sh +++ b/upload-monitor.sh @@ -17,8 +17,8 @@ start_upload_monitoring() { start_sync_uploader "$TMP_DIR/allure-results" "${RESULTS_S3_PATH}allure-results/" "*result.json" start_sync_uploader "$TMP_DIR/attachments" "$ATTACHMENTS_S3_PATH" else - start_inotify_uploader "$TMP_DIR/allure-results" "${RESULTS_S3_PATH}allure-results/" "*result.json" & - start_inotify_uploader "$TMP_DIR/attachments" "$ATTACHMENTS_S3_PATH" & + start_inotify_uploader "$TMP_DIR/allure-results" "${RESULTS_S3_PATH}allure-results/" "*result.json" + start_inotify_uploader "$TMP_DIR/attachments" "$ATTACHMENTS_S3_PATH" fi echo "βœ… Upload monitoring started" @@ -29,14 +29,17 @@ start_inotify_uploader() { local DEST_PATH="$2" local FILE_PATTERN="${3:-*}" - inotifywait -m -e close_write,create --format '%w%f' "$WATCH_DIR" | while read -r NEW_FILE; do - FILE_NAME=$(basename "$NEW_FILE") - if [[ "$FILE_NAME" == $FILE_PATTERN ]]; then - upload_file_to_s3 "$NEW_FILE" "$DEST_PATH" - fi - done & - - UPLOAD_MONITOR_PIDS+=($!) + ( + inotifywait -m -e close_write,create --format '%w%f' "$WATCH_DIR" | + while read -r NEW_FILE; do + FILE_NAME=$(basename "$NEW_FILE") + if [[ "$FILE_NAME" == $FILE_PATTERN ]]; then + upload_file_to_s3 "$NEW_FILE" "$DEST_PATH" + fi + done + ) /dev/null 2>&1 & + + UPLOAD_MONITOR_PIDS+=("$!") } upload_file_to_s3() { @@ -57,14 +60,17 @@ start_sync_uploader() { local DEST_PATH="$2" local FILE_PATTERN="${3:-*}" - inotifywait -m -e close_write,create --format '%w%f' "$WATCH_DIR" | while read -r NEW_FILE; do - FILE_NAME=$(basename "$NEW_FILE") - if [[ "$FILE_NAME" == $FILE_PATTERN ]]; then - sync_directory_to_s3 "$WATCH_DIR" "$DEST_PATH" - fi - done & - - UPLOAD_MONITOR_PIDS+=($!) + ( + inotifywait -m -e close_write,create --format '%w%f' "$WATCH_DIR" | + while read -r NEW_FILE; do + FILE_NAME=$(basename "$NEW_FILE") + if [[ "$FILE_NAME" == $FILE_PATTERN ]]; then + sync_directory_to_s3 "$WATCH_DIR" "$DEST_PATH" + fi + done + ) /dev/null 2>&1 & + + UPLOAD_MONITOR_PIDS+=("$!") } sync_directory_to_s3() { @@ -80,14 +86,6 @@ sync_directory_to_s3() { fi } -stop_upload_monitoring() { - echo "πŸ›‘ Stopping upload monitors..." - for pid in "${UPLOAD_MONITOR_PIDS[@]}"; do - kill "$pid" 2>/dev/null || true - wait "$pid" 2>/dev/null || true - done - echo "βœ… Upload monitors stopped" -} finalize_upload() { echo "πŸ”„ Finalizing upload operations..." From cd8ecd04e25b68f12fc493bae942a95af05537fd Mon Sep 17 00:00:00 2001 From: saju1025 Date: Wed, 1 Apr 2026 12:23:51 +0500 Subject: [PATCH 55/83] fix: add debug --- upload-monitor.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/upload-monitor.sh b/upload-monitor.sh index 6aa3690..78bf2eb 100644 --- a/upload-monitor.sh +++ b/upload-monitor.sh @@ -28,6 +28,7 @@ start_inotify_uploader() { local WATCH_DIR="$1" local DEST_PATH="$2" local FILE_PATTERN="${3:-*}" + echo "πŸ“‘ Starting inotify uploader for directory: $WATCH_DIR, pattern: $FILE_PATTERN" ( inotifywait -m -e close_write,create --format '%w%f' "$WATCH_DIR" | @@ -59,7 +60,7 @@ start_sync_uploader() { local WATCH_DIR="$1" local DEST_PATH="$2" local FILE_PATTERN="${3:-*}" - + echo "πŸ“‘ Starting sync uploader for directory: $WATCH_DIR, pattern: $FILE_PATTERN" ( inotifywait -m -e close_write,create --format '%w%f' "$WATCH_DIR" | while read -r NEW_FILE; do From 06753ce737b93ef313db83066c56c1943dda6afb Mon Sep 17 00:00:00 2001 From: saju1025 Date: Wed, 1 Apr 2026 12:29:46 +0500 Subject: [PATCH 56/83] feat: delete super linter warning --- upload-monitor.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/upload-monitor.sh b/upload-monitor.sh index 78bf2eb..10c6622 100644 --- a/upload-monitor.sh +++ b/upload-monitor.sh @@ -34,6 +34,7 @@ start_inotify_uploader() { inotifywait -m -e close_write,create --format '%w%f' "$WATCH_DIR" | while read -r NEW_FILE; do FILE_NAME=$(basename "$NEW_FILE") + # shellcheck disable=SC2053 if [[ "$FILE_NAME" == $FILE_PATTERN ]]; then upload_file_to_s3 "$NEW_FILE" "$DEST_PATH" fi @@ -65,6 +66,7 @@ start_sync_uploader() { inotifywait -m -e close_write,create --format '%w%f' "$WATCH_DIR" | while read -r NEW_FILE; do FILE_NAME=$(basename "$NEW_FILE") + # shellcheck disable=SC2053 if [[ "$FILE_NAME" == $FILE_PATTERN ]]; then sync_directory_to_s3 "$WATCH_DIR" "$DEST_PATH" fi From 3d9197d2c180305ba9dc4a130de5139324f76961 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Wed, 1 Apr 2026 15:05:26 +0500 Subject: [PATCH 57/83] fix: optimizated sync --- upload-monitor.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/upload-monitor.sh b/upload-monitor.sh index 10c6622..4b903c3 100644 --- a/upload-monitor.sh +++ b/upload-monitor.sh @@ -9,18 +9,17 @@ start_upload_monitoring() { mkdir -p "$TMP_DIR/allure-results" mkdir -p "$TMP_DIR/attachments" - + _BACKGROUND_S3_KEY="$_LOCAL_S3_KEY" _BACKGROUND_S3_SECRET="$_LOCAL_S3_SECRET" - + if [[ "${UPLOAD_METHOD:-cp}" == "sync" ]]; then - start_sync_uploader "$TMP_DIR/allure-results" "${RESULTS_S3_PATH}allure-results/" "*result.json" - start_sync_uploader "$TMP_DIR/attachments" "$ATTACHMENTS_S3_PATH" + echo "ℹ️ Live sync monitoring disabled in sync mode; relying on finalize_upload" else - start_inotify_uploader "$TMP_DIR/allure-results" "${RESULTS_S3_PATH}allure-results/" "*result.json" - start_inotify_uploader "$TMP_DIR/attachments" "$ATTACHMENTS_S3_PATH" + start_inotify_uploader "$TMP_DIR/allure-results" "${RESULTS_S3_PATH}allure-results/" "*result.json" + echo "ℹ️ Attachments live upload disabled; relying on finalize_upload" fi - + echo "βœ… Upload monitoring started" } @@ -120,8 +119,8 @@ finalize_upload() { echo " Source: $TMP_DIR/attachments/ -> Destination: $ATTACHMENTS_S3_PATH" echo " Source: $TMP_DIR/allure-report/ -> Destination: ${REPORTS_S3_PATH}allure-report/" echo " Source: $TMP_DIR/scripts/email-notification-generated/ -> Destination: ${RESULTS_S3_PATH}email-notification-generated/" - s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/allure-results/" "${RESULTS_S3_PATH}allure-results/" - s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/attachments/" "$ATTACHMENTS_S3_PATH" + s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/allure-results/" "${RESULTS_S3_PATH}allure-results/" > /dev/null 2>&1 + s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/attachments/" "$ATTACHMENTS_S3_PATH" > /dev/null 2>&1 if [ -d "$TMP_DIR/allure-report" ]; then echo "πŸ“€ Uploading Allure HTML report..." s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" \ From ebd07875c3f12eeac08156ee8130ec6bc0ccc057 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Wed, 1 Apr 2026 16:32:46 +0500 Subject: [PATCH 58/83] fix: delete xargs --- test-runner.sh | 21 ++++++++++++++++++--- upload-monitor.sh | 20 ++++++++++---------- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index 1fbe69d..c9f18e6 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -291,13 +291,28 @@ export BRUNO_FOLDERS_STR printf "%s\n" "${BRUNO_COLLECTIONS_ARRAY[@]}" > "$PATH_TO_ALLURE_RESULTS/collections.txt" parallel_start_ts=$(date +%s) - echo "⏳ XARGS PHASE START time=$(date '+%H:%M:%S')" + echo "⏳ PARALLEL PHASE START time=$(date '+%H:%M:%S')" - xargs -P "${PARALLELISM}" -I {} bash -c 'run_collection_body "$@"' _ {} <<< "$(printf "%s\n" "${BRUNO_COLLECTIONS_ARRAY[@]}")" || true + running_jobs=0 + for collection in "${BRUNO_COLLECTIONS_ARRAY[@]}"; do + bash -c 'run_collection_body "$1"' _ "$collection" & + running_jobs=$((running_jobs + 1)) + if [ "$running_jobs" -ge "$PARALLELISM" ]; then + wait -n || true + running_jobs=$((running_jobs - 1)) + fi + done + + while [ "$running_jobs" -gt 0 ]; do + wait -n || true + running_jobs=$((running_jobs - 1)) + done + parallel_end_ts=$(date +%s) - echo "βœ… XARGS PHASE END time=$(date '+%H:%M:%S') took=$((parallel_end_ts-parallel_start_ts))s" + + echo "βœ… PARALLEL PHASE END time=$(date '+%H:%M:%S') took=$((parallel_end_ts-parallel_start_ts))s" echo "πŸ“Š Generating Allure HTML report..." if command -v allure >/dev/null 2>&1; then diff --git a/upload-monitor.sh b/upload-monitor.sh index 4b903c3..ef506d8 100644 --- a/upload-monitor.sh +++ b/upload-monitor.sh @@ -9,17 +9,18 @@ start_upload_monitoring() { mkdir -p "$TMP_DIR/allure-results" mkdir -p "$TMP_DIR/attachments" - + _BACKGROUND_S3_KEY="$_LOCAL_S3_KEY" _BACKGROUND_S3_SECRET="$_LOCAL_S3_SECRET" - + if [[ "${UPLOAD_METHOD:-cp}" == "sync" ]]; then - echo "ℹ️ Live sync monitoring disabled in sync mode; relying on finalize_upload" + start_sync_uploader "$TMP_DIR/allure-results" "${RESULTS_S3_PATH}allure-results/" "*result.json" + start_sync_uploader "$TMP_DIR/attachments" "$ATTACHMENTS_S3_PATH" else - start_inotify_uploader "$TMP_DIR/allure-results" "${RESULTS_S3_PATH}allure-results/" "*result.json" - echo "ℹ️ Attachments live upload disabled; relying on finalize_upload" + start_inotify_uploader "$TMP_DIR/allure-results" "${RESULTS_S3_PATH}allure-results/" "*result.json" + start_inotify_uploader "$TMP_DIR/attachments" "$ATTACHMENTS_S3_PATH" fi - + echo "βœ… Upload monitoring started" } @@ -33,7 +34,6 @@ start_inotify_uploader() { inotifywait -m -e close_write,create --format '%w%f' "$WATCH_DIR" | while read -r NEW_FILE; do FILE_NAME=$(basename "$NEW_FILE") - # shellcheck disable=SC2053 if [[ "$FILE_NAME" == $FILE_PATTERN ]]; then upload_file_to_s3 "$NEW_FILE" "$DEST_PATH" fi @@ -65,7 +65,7 @@ start_sync_uploader() { inotifywait -m -e close_write,create --format '%w%f' "$WATCH_DIR" | while read -r NEW_FILE; do FILE_NAME=$(basename "$NEW_FILE") - # shellcheck disable=SC2053 + #shellcheck disable=SC2233 if [[ "$FILE_NAME" == $FILE_PATTERN ]]; then sync_directory_to_s3 "$WATCH_DIR" "$DEST_PATH" fi @@ -119,8 +119,8 @@ finalize_upload() { echo " Source: $TMP_DIR/attachments/ -> Destination: $ATTACHMENTS_S3_PATH" echo " Source: $TMP_DIR/allure-report/ -> Destination: ${REPORTS_S3_PATH}allure-report/" echo " Source: $TMP_DIR/scripts/email-notification-generated/ -> Destination: ${RESULTS_S3_PATH}email-notification-generated/" - s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/allure-results/" "${RESULTS_S3_PATH}allure-results/" > /dev/null 2>&1 - s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/attachments/" "$ATTACHMENTS_S3_PATH" > /dev/null 2>&1 + s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/allure-results/" "${RESULTS_S3_PATH}allure-results/" + s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/attachments/" "$ATTACHMENTS_S3_PATH" if [ -d "$TMP_DIR/allure-report" ]; then echo "πŸ“€ Uploading Allure HTML report..." s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" \ From f505e7149d59273c4a852ae35e06b8597b0ee3b9 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Wed, 1 Apr 2026 17:38:57 +0500 Subject: [PATCH 59/83] fix: pararel 2 --- test-runner.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index c9f18e6..4bb059f 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -281,7 +281,7 @@ run_bruno_from_test_params() { export BRUNO_FOLDERS_STR - PARALLELISM=${PARALLELISM:-4} + PARALLELISM=${PARALLELISM:-2} echo "Collections to run:" printf "%s\n" "${BRUNO_COLLECTIONS_ARRAY[@]}" echo "Total collections: ${#BRUNO_COLLECTIONS_ARRAY[@]}" @@ -291,7 +291,7 @@ export BRUNO_FOLDERS_STR printf "%s\n" "${BRUNO_COLLECTIONS_ARRAY[@]}" > "$PATH_TO_ALLURE_RESULTS/collections.txt" parallel_start_ts=$(date +%s) - echo "⏳ PARALLEL PHASE START time=$(date '+%H:%M:%S')" + echo "βœ… PARALLEL PHASE START time=$(date '+%H:%M:%S')" running_jobs=0 @@ -309,7 +309,7 @@ export BRUNO_FOLDERS_STR wait -n || true running_jobs=$((running_jobs - 1)) done - + parallel_end_ts=$(date +%s) echo "βœ… PARALLEL PHASE END time=$(date '+%H:%M:%S') took=$((parallel_end_ts-parallel_start_ts))s" From c77c526586123adba45a9a8a6473c8165f05e963 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Thu, 2 Apr 2026 13:08:39 +0500 Subject: [PATCH 60/83] feat: add new logic for test --- test-runner.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/test-runner.sh b/test-runner.sh index 4bb059f..f8ac19d 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -1,11 +1,52 @@ #!/bin/bash +resolve_execution_name() { + local execution_name="$1" + local tests_root="${TMP_DIR}/tests" + + echo "πŸ”Ž Resolving EXECUTION_NAME: $execution_name" + echo "πŸ”Ž Searching inside: $tests_root" + + if [ -z "$execution_name" ]; then + echo "❌ EXECUTION_NAME is empty" + return 1 + fi + + if [ ! -d "$tests_root" ]; then + echo "❌ Tests directory not found: $tests_root" + return 1 + fi + + mapfile -t matches < <(find "$tests_root" -type f -name "$execution_name") + + if [ "${#matches[@]}" -eq 1 ]; then + printf '%s\n' "${matches[0]}" + return 0 + fi + + if [ "${#matches[@]}" -gt 1 ]; then + echo "❌ Multiple files found for EXECUTION_NAME=$execution_name" >&2 + printf ' %s\n' "${matches[@]}" >&2 + return 1 + fi + + echo "❌ Test file not found: $execution_name" >&2 + echo "πŸ“‹ Available *.feature.spec.js files:" >&2 + find "$tests_root" -type f -name "*.feature.spec.js" >&2 + return 1 +} + run_tests() { echo "β–Ά Starting test execution..." set -o pipefail # shellcheck disable=SC1091 + if [ -n "${EXECUTION_NAME:-}" ] && [ -d "${TMP_DIR}/tests" ]; then + RESOLVED_EXECUTION_NAME="$(resolve_execution_name "$EXECUTION_NAME")" || exit 1 + export EXECUTION_NAME="$RESOLVED_EXECUTION_NAME" + echo "βœ… Updated EXECUTION_NAME: $EXECUTION_NAME" + fi if [ -f "/app/scripts/upload-monitor.sh" ]; then source "/app/scripts/upload-monitor.sh" elif [ -f "/scripts/upload-monitor.sh" ]; then From e84ff8d75669ae7f7d7c9c5caf509bcc39bca5e9 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Thu, 2 Apr 2026 15:13:59 +0500 Subject: [PATCH 61/83] fix: deleted new logic --- test-runner.sh | 41 ----------------------------------------- 1 file changed, 41 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index f8ac19d..4bb059f 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -1,52 +1,11 @@ #!/bin/bash -resolve_execution_name() { - local execution_name="$1" - local tests_root="${TMP_DIR}/tests" - - echo "πŸ”Ž Resolving EXECUTION_NAME: $execution_name" - echo "πŸ”Ž Searching inside: $tests_root" - - if [ -z "$execution_name" ]; then - echo "❌ EXECUTION_NAME is empty" - return 1 - fi - - if [ ! -d "$tests_root" ]; then - echo "❌ Tests directory not found: $tests_root" - return 1 - fi - - mapfile -t matches < <(find "$tests_root" -type f -name "$execution_name") - - if [ "${#matches[@]}" -eq 1 ]; then - printf '%s\n' "${matches[0]}" - return 0 - fi - - if [ "${#matches[@]}" -gt 1 ]; then - echo "❌ Multiple files found for EXECUTION_NAME=$execution_name" >&2 - printf ' %s\n' "${matches[@]}" >&2 - return 1 - fi - - echo "❌ Test file not found: $execution_name" >&2 - echo "πŸ“‹ Available *.feature.spec.js files:" >&2 - find "$tests_root" -type f -name "*.feature.spec.js" >&2 - return 1 -} - run_tests() { echo "β–Ά Starting test execution..." set -o pipefail # shellcheck disable=SC1091 - if [ -n "${EXECUTION_NAME:-}" ] && [ -d "${TMP_DIR}/tests" ]; then - RESOLVED_EXECUTION_NAME="$(resolve_execution_name "$EXECUTION_NAME")" || exit 1 - export EXECUTION_NAME="$RESOLVED_EXECUTION_NAME" - echo "βœ… Updated EXECUTION_NAME: $EXECUTION_NAME" - fi if [ -f "/app/scripts/upload-monitor.sh" ]; then source "/app/scripts/upload-monitor.sh" elif [ -f "/scripts/upload-monitor.sh" ]; then From 7060e34edcf19f3d27624329251c7e6673343d76 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Fri, 3 Apr 2026 13:12:41 +0500 Subject: [PATCH 62/83] feat: merge conflicts deleted --- git-clone.sh | 381 ++++++++++++++++++++++++--------------------------- 1 file changed, 177 insertions(+), 204 deletions(-) diff --git a/git-clone.sh b/git-clone.sh index bae4dbc..7aef14d 100644 --- a/git-clone.sh +++ b/git-clone.sh @@ -7,14 +7,44 @@ clone_repository() { return 0 fi -<<<<<<< HEAD echo "πŸ“₯ Preparing tests repository..." + # ============================================ + # Pre-flight validation + # ============================================ + if [ -z "${ATP_TESTS_GIT_TOKEN:-}" ]; then + echo "❌ ERROR: ATP_TESTS_GIT_TOKEN is not set (required to download repository archive)" + exit 1 + fi + if [ -z "${ATP_TESTS_GIT_REPO_URL:-}" ]; then + echo "❌ ERROR: ATP_TESTS_GIT_REPO_URL is not set" + exit 1 + fi + if [ -z "${ATP_TESTS_GIT_REPO_BRANCH:-}" ]; then + echo "❌ ERROR: ATP_TESTS_GIT_REPO_BRANCH is not set" + exit 1 + fi + if [ -z "${TMP_DIR:-}" ]; then + echo "❌ ERROR: TMP_DIR is not set" + exit 1 + fi + + # Basic URL sanity check (no whitespace, http/https) + if [[ "$ATP_TESTS_GIT_REPO_URL" =~ [[:space:]] ]] || [[ ! "$ATP_TESTS_GIT_REPO_URL" =~ ^https?:// ]]; then + echo "❌ ERROR: ATP_TESTS_GIT_REPO_URL is invalid URL: $ATP_TESTS_GIT_REPO_URL" + exit 1 + fi + + # Strip .git from URL and extract repo name REPO_PATH=$(echo "$ATP_TESTS_GIT_REPO_URL" | sed 's|\.git$||') GIT_BRANCH_CLEANED=$(echo "$ATP_TESTS_GIT_REPO_BRANCH" | sed 's|/|-|') REPO_NAME=$(basename "$REPO_PATH") ARCHIVE_URL="${REPO_PATH}/-/archive/${ATP_TESTS_GIT_REPO_BRANCH}/${REPO_NAME}-${GIT_BRANCH_CLEANED}.zip" + mkdir -p "$TMP_DIR" 2>/dev/null || true + ZIP_PATH="$TMP_DIR/repo.zip" + CURL_ERR_PATH="$TMP_DIR/curl_download.err" + fetch_by_clone_with_submodules() { if ! command -v git >/dev/null 2>&1; then echo "❌ git is not installed in the container, cannot clone repository with submodules" @@ -52,23 +82,158 @@ clone_repository() { git submodule sync --recursive git submodule update --init --recursive || return 1 + echo "πŸ“‹ Submodule status after initialization:" git submodule status || true echo "βœ… Repository cloned with submodules to: $TMP_DIR" } - echo "πŸ“₯ Downloading repository archive from: $ARCHIVE_URL" - curl -sSL --fail \ - -H "PRIVATE-TOKEN: ${ATP_TESTS_GIT_TOKEN}" \ - "$ARCHIVE_URL" \ - -o "$TMP_DIR/repo.zip" || { - echo "❌ Failed to download repository archive" + echo "πŸ“₯ Downloading archive from: $ARCHIVE_URL" + + # ============================================ + # Download archive with enhanced error handling + # - connect timeout: 30s + # - max time: 120s + # ============================================ + HTTP_CODE="$( + curl -sS -L \ + --connect-timeout 30 \ + --max-time 120 \ + --fail \ + -H "PRIVATE-TOKEN: ${ATP_TESTS_GIT_TOKEN}" \ + "$ARCHIVE_URL" \ + -o "$ZIP_PATH" \ + -w "%{http_code}" \ + 2>"$CURL_ERR_PATH" + )" + CURL_EXIT_CODE=$? + + # ============================================ + # Error detection and messaging + # ============================================ + if [ "$CURL_EXIT_CODE" -ne 0 ]; then + CURL_ERR_MSG="" + if [ -f "$CURL_ERR_PATH" ]; then + CURL_ERR_MSG=$(tr '\n' ' ' < "$CURL_ERR_PATH" | sed 's/[[:space:]]\+/ /g' | sed 's/[[:space:]]*$//') + fi + + case "$CURL_EXIT_CODE" in + 6) + echo "❌ ERROR: Couldn't resolve host while downloading repository archive." + ;; + 7) + echo "❌ ERROR: Failed to connect to host while downloading repository archive." + ;; + 22) + # HTTP error (4xx/5xx). We'll handle using HTTP_CODE below. + ;; + 28) + echo "❌ ERROR: Download timed out (connect-timeout=30s, max-time=120s)." + ;; + 35) + echo "❌ ERROR: SSL/TLS connection error while downloading repository archive." + ;; + 52) + echo "❌ ERROR: Empty reply from server while downloading repository archive." + ;; + 56) + echo "❌ ERROR: Network receive error while downloading repository archive." + ;; + *) + echo "❌ ERROR: Network error while downloading repository archive (curl exit code: $CURL_EXIT_CODE)." + ;; + esac + + if [ -n "$CURL_ERR_MSG" ]; then + echo " curl: $CURL_ERR_MSG" + fi + + # For non-HTTP curl failures, stop here (HTTP_CODE may be empty/undefined). + if [ "$CURL_EXIT_CODE" -ne 22 ]; then exit 1 - } + fi + fi + + # HTTP code interpretation (also covers curl --fail exit 22) + if [ "$HTTP_CODE" != "200" ]; then + case "$HTTP_CODE" in + 200) + ;; + 000) + echo "❌ ERROR: No HTTP response received from server (HTTP 000)." + echo " Check network connectivity and URL: $ARCHIVE_URL" + exit 1 + ;; + 401|403) + echo "❌ ERROR: Authentication failed (HTTP $HTTP_CODE)." + echo " Check that ATP_TESTS_GIT_TOKEN is valid and has access to the repository." + exit 1 + ;; + 404) + echo "❌ ERROR: Repository or branch not found (HTTP 404)." + echo " Check URL and branch:" + echo " - URL: $ATP_TESTS_GIT_REPO_URL" + echo " - Branch: $ATP_TESTS_GIT_REPO_BRANCH" + echo " - Archive URL: $ARCHIVE_URL" + exit 1 + ;; + 429) + echo "❌ ERROR: Rate limited by the server (HTTP 429)." + echo " Try again later or reduce request frequency." + exit 1 + ;; + 5??) + echo "❌ ERROR: Server error while downloading archive (HTTP $HTTP_CODE)." + echo " The Git server may be temporarily unavailable." + exit 1 + ;; + *) + echo "❌ ERROR: Failed to download repository archive (HTTP $HTTP_CODE, curl exit code: $CURL_EXIT_CODE)." + echo " Archive URL: $ARCHIVE_URL" + exit 1 + ;; + esac + fi + + # ============================================ + # Downloaded archive validation + # ============================================ + if [ ! -f "$ZIP_PATH" ] || [ ! -s "$ZIP_PATH" ]; then + echo "❌ ERROR: Downloaded file is missing or empty: $ZIP_PATH" + exit 1 + fi + + if command -v file >/dev/null 2>&1; then + FILE_TYPE="$(file "$ZIP_PATH" 2>/dev/null || true)" + if ! printf '%s' "$FILE_TYPE" | grep -qi "zip archive"; then + # Git servers sometimes return an HTML login page when the token is invalid/expired. + if printf '%s' "$FILE_TYPE" | grep -qi "html"; then + echo "❌ ERROR: Downloaded an HTML login page instead of a repository." + echo " Check that ATP_TESTS_GIT_TOKEN is valid and has access to the repository." + echo " Check that the repository URL is correct." + else + echo "❌ ERROR: Downloaded repository is not recognized as a zip archive." + fi + echo " File type: $FILE_TYPE" + exit 1 + fi + else + echo "⚠️ 'file' command not available; skipping zip magic-byte validation." + fi + + if command -v unzip >/dev/null 2>&1; then + if ! unzip -t "$ZIP_PATH" > /dev/null 2>&1; then + echo "❌ ERROR: Archive integrity test failed (unzip -t). Please retry the operation." + exit 1 + fi + else + echo "❌ ERROR: 'unzip' command is not available; cannot validate/extract archive." + exit 1 + fi echo "πŸ“¦ Unzipping..." - unzip -q "$TMP_DIR/repo.zip" -d "$TMP_DIR" || { + unzip -q "$ZIP_PATH" -d "$TMP_DIR" || { echo "❌ Failed to unzip repository archive" exit 1 } @@ -77,7 +242,7 @@ clone_repository() { if [ -f "$extracted_dir/.gitmodules" ]; then rm -rf "$extracted_dir" - rm -f "$TMP_DIR/repo.zip" + rm -f "$ZIP_PATH" fetch_by_clone_with_submodules || { echo "❌ Failed to clone repository with submodules" @@ -93,190 +258,7 @@ clone_repository() { shopt -u dotglob rm -rf "$extracted_dir" - rm -f "$TMP_DIR/repo.zip" -======= - # ============================================ - # Pre-flight validation - # ============================================ - if [ -z "${ATP_TESTS_GIT_TOKEN:-}" ]; then - echo "❌ ERROR: ATP_TESTS_GIT_TOKEN is not set (required to download repository archive)" - exit 1 - fi - if [ -z "${ATP_TESTS_GIT_REPO_URL:-}" ]; then - echo "❌ ERROR: ATP_TESTS_GIT_REPO_URL is not set" - exit 1 - fi - if [ -z "${ATP_TESTS_GIT_REPO_BRANCH:-}" ]; then - echo "❌ ERROR: ATP_TESTS_GIT_REPO_BRANCH is not set" - exit 1 - fi - # Basic URL sanity check (no whitespace, http/https) - if [[ "$ATP_TESTS_GIT_REPO_URL" =~ [[:space:]] ]] || [[ ! "$ATP_TESTS_GIT_REPO_URL" =~ ^https?:// ]]; then - echo "❌ ERROR: ATP_TESTS_GIT_REPO_URL is invalid URL: $ATP_TESTS_GIT_REPO_URL" - exit 1 - fi - - # Strip .git from URL and extract repo name - REPO_PATH=$(echo "$ATP_TESTS_GIT_REPO_URL" | sed 's|\.git$||') - GIT_BRANCH_CLEANED=$(echo "$ATP_TESTS_GIT_REPO_BRANCH" | sed 's|/|-|') - REPO_NAME=$(basename "$REPO_PATH") - ARCHIVE_URL="${REPO_PATH}/-/archive/${ATP_TESTS_GIT_REPO_BRANCH}/${REPO_NAME}-${GIT_BRANCH_CLEANED}.zip" - - if [ -z "${TMP_DIR:-}" ]; then - echo "❌ ERROR: TMP_DIR is not set" - exit 1 - fi - echo "πŸ“₯ Downloading archive from: $ARCHIVE_URL" - mkdir -p "$TMP_DIR" 2>/dev/null || true - ZIP_PATH="$TMP_DIR/repo.zip" - CURL_ERR_PATH="$TMP_DIR/curl_download.err" - - # ============================================ - # Download archive with enhanced error handling - # - connect timeout: 30s - # - max time: 120s - # ============================================ - HTTP_CODE="$( - curl -sS -L \ - --connect-timeout 30 \ - --max-time 120 \ - --fail \ - -H "PRIVATE-TOKEN: ${ATP_TESTS_GIT_TOKEN}" \ - "$ARCHIVE_URL" \ - -o "$ZIP_PATH" \ - -w "%{http_code}" \ - 2>"$CURL_ERR_PATH" - )" - CURL_EXIT_CODE=$? - - # ============================================ - # Error detection and messaging - # ============================================ - if [ "$CURL_EXIT_CODE" -ne 0 ]; then - CURL_ERR_MSG="" - if [ -f "$CURL_ERR_PATH" ]; then - CURL_ERR_MSG=$(tr '\n' ' ' < "$CURL_ERR_PATH" | sed 's/[[:space:]]\+/ /g' | sed 's/[[:space:]]*$//') - fi - - case "$CURL_EXIT_CODE" in - 6) - echo "❌ ERROR: Couldn't resolve host while downloading repository archive." - ;; - 7) - echo "❌ ERROR: Failed to connect to host while downloading repository archive." - ;; - 22) - # HTTP error (4xx/5xx). We'll handle using HTTP_CODE below. - ;; - 28) - echo "❌ ERROR: Download timed out (connect-timeout=30s, max-time=120s)." - ;; - 35) - echo "❌ ERROR: SSL/TLS connection error while downloading repository archive." - ;; - 52) - echo "❌ ERROR: Empty reply from server while downloading repository archive." - ;; - 56) - echo "❌ ERROR: Network receive error while downloading repository archive." - ;; - *) - echo "❌ ERROR: Network error while downloading repository archive (curl exit code: $CURL_EXIT_CODE)." - ;; - esac - - if [ -n "$CURL_ERR_MSG" ]; then - echo " curl: $CURL_ERR_MSG" - fi - - # For non-HTTP curl failures, stop here (HTTP_CODE may be empty/undefined). - if [ "$CURL_EXIT_CODE" -ne 22 ]; then - exit 1 - fi - fi - - # HTTP code interpretation (also covers curl --fail exit 22) - if [ "$HTTP_CODE" != "200" ]; then - case "$HTTP_CODE" in - 200) - # ok - ;; - 000) - echo "❌ ERROR: No HTTP response received from server (HTTP 000)." - echo " Check network connectivity and URL: $ARCHIVE_URL" - exit 1 - ;; - 401|403) - echo "❌ ERROR: Authentication failed (HTTP $HTTP_CODE)." - echo " Check that ATP_TESTS_GIT_TOKEN is valid and has access to the repository." - exit 1 - ;; - 404) - echo "❌ ERROR: Repository or branch not found (HTTP 404)." - echo " Check URL and branch:" - echo " - URL: $ATP_TESTS_GIT_REPO_URL" - echo " - Branch: $ATP_TESTS_GIT_REPO_BRANCH" - echo " - Archive URL: $ARCHIVE_URL" - exit 1 - ;; - 429) - echo "❌ ERROR: Rate limited by the server (HTTP 429)." - echo " Try again later or reduce request frequency." - exit 1 - ;; - 5??) - echo "❌ ERROR: Server error while downloading archive (HTTP $HTTP_CODE)." - echo " The Git server may be temporarily unavailable." - exit 1 - ;; - *) - echo "❌ ERROR: Failed to download repository archive (HTTP $HTTP_CODE, curl exit code: $CURL_EXIT_CODE)." - echo " Archive URL: $ARCHIVE_URL" - exit 1 - ;; - esac - fi - - # ============================================ - # Downloaded archive validation - # ============================================ - if [ ! -f "$ZIP_PATH" ] || [ ! -s "$ZIP_PATH" ]; then - echo "❌ ERROR: Downloaded file is missing or empty: $ZIP_PATH" - exit 1 - fi - - if command -v file >/dev/null 2>&1; then - FILE_TYPE="$(file "$ZIP_PATH" 2>/dev/null || true)" - if ! printf '%s' "$FILE_TYPE" | grep -qi "zip archive"; then - # Git servers sometimes return an HTML login page when the token is invalid/expired. - if printf '%s' "$FILE_TYPE" | grep -qi "html"; then - echo "❌ ERROR: Downloaded an HTML login page instead of a repository." - echo " Check that ATP_TESTS_GIT_TOKEN is valid and has access to the repository." - echo " Check that the repository URL is correct." - else - echo "❌ ERROR: Downloaded repository is not recognized as a zip archive." - fi - echo " File type: $FILE_TYPE" - exit 1 - fi - else - echo "⚠️ 'file' command not available; skipping zip magic-byte validation." - fi - - if command -v unzip >/dev/null 2>&1; then - if ! unzip -t "$ZIP_PATH" > /dev/null 2>&1; then - echo "❌ ERROR: Archive integrity test failed (unzip -t). Please retry the operation." - exit 1 - fi - else - echo "❌ ERROR: 'unzip' command is not available; cannot validate/extract archive." - exit 1 - fi - - echo "πŸ“¦ Unzipping..." - unzip -q "$ZIP_PATH" -d "$TMP_DIR" - mv "$TMP_DIR"/${REPO_NAME}-${GIT_BRANCH_CLEANED}/* "$TMP_DIR" ->>>>>>> main + rm -f "$ZIP_PATH" echo "βœ… Repository extracted to: $TMP_DIR" fi @@ -291,15 +273,10 @@ clone_repository() { echo "βœ… Validation successful. Found 'collections/' directory in the repo." else echo "❌ ERROR: Neither 'app/' nor 'tests/' nor 'collections/' directory nor 'postman_collection' file found in the cloned repo!" - exit 1 + exit 1 fi -<<<<<<< HEAD cd "$TMP_DIR" || exit 1 -======= - # Move into the work directory - cd "$TMP_DIR" ->>>>>>> main if [ -d "$TMP_DIR/app" ]; then echo "πŸ“‹ Contents of $TMP_DIR/app directory:" @@ -309,7 +286,6 @@ clone_repository() { ls -la tests fi -<<<<<<< HEAD if [ -f "$TMP_DIR/.gitmodules" ]; then echo "πŸ“‹ .gitmodules detected:" cat "$TMP_DIR/.gitmodules" @@ -320,10 +296,7 @@ clone_repository() { fi fi -======= - # Clear Git token from environment for security ->>>>>>> main unset ATP_TESTS_GIT_TOKEN echo "πŸ” Git token cleared from environment" echo "βœ… Tests repository prepared successfully" From b6cb2464a82417b0759d38eabfa68eaa8b8d087e Mon Sep 17 00:00:00 2001 From: saju1025 Date: Mon, 6 Apr 2026 15:28:41 +0500 Subject: [PATCH 63/83] feat: add run full clc --- test-runner.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test-runner.sh b/test-runner.sh index 4bb059f..18793c0 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -233,6 +233,19 @@ run_bruno_from_test_params() { extract_bruno_env "$TEST_PARAMS" "BRUNO_ENV_STR" extract_bruno_collections "$TEST_PARAMS" "BRUNO_COLLECTIONS_ARRAY" + if [ ${#BRUNO_COLLECTIONS_ARRAY[@]} -eq 0 ]; then + echo "⚠ No collections provided β€” discovering all collections automatically" + + mapfile -t BRUNO_COLLECTIONS_ARRAY < <( + find collections -mindepth 1 -maxdepth 1 -type d \ + ! -name ".git" \ + ! -name "node_modules" \ + | sort + ) + + echo "πŸ“¦ Discovered collections:" + printf " - %s\n" "${BRUNO_COLLECTIONS_ARRAY[@]}" + fi extract_bruno_env_vars "$TEST_PARAMS" "BRUNO_ENV_VARS_CLI" extract_bruno_flags "$TEST_PARAMS" "BRUNO_FLAGS_CLI" extract_bruno_folders "$TEST_PARAMS" "BRUNO_FOLDERS_ARRAY" From fd93146f1467d0105482691a380a4a4d1cbb45b4 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Wed, 8 Apr 2026 11:56:36 +0500 Subject: [PATCH 64/83] feat: one env for all clc --- test-runner.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index 18793c0..c4f856b 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -48,6 +48,12 @@ run_collection_body() { collection_dir="$1" collection_path="${TMP_DIR}/${collection_dir}" + COMMON_ENV_FILE="${TMP_DIR}/environments/${BRUNO_ENV_STR}.bru" + + if [ ! -f "${COMMON_ENV_FILE}" ]; then + echo "❌ Common Bruno env file not found: ${COMMON_ENV_FILE}" + return 1 + fi if [ -n "$BRUNO_FOLDERS_STR" ]; then mapfile -t BRUNO_FOLDERS_ARRAY <<< "$BRUNO_FOLDERS_STR" else @@ -93,7 +99,7 @@ run_collection_body() { echo "β–Ά BRUNO RUN START collection=$collection_name pid=$$ mode=full time=$(date '+%H:%M:%S')" if ${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ - --env "${BRUNO_ENV_STR}" \ + --env-file "${COMMON_ENV_FILE}" \ ${BRUNO_ENV_VARS_CLI} \ --reporter-json "${bruno_report_path}" \ >"${raw_log_path}" 2>&1; then @@ -135,7 +141,7 @@ EOF echo "β–Ά BRUNO RUN START collection=$collection_name pid=$$ mode=folders time=$(date '+%H:%M:%S')" if ${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ - --env "${BRUNO_ENV_STR}" \ + --env-file "${COMMON_ENV_FILE}" \ ${BRUNO_ENV_VARS_CLI} \ "${RESOLVED_FOLDERS[@]}" \ --reporter-json "${bruno_report_path}" \ From 4c7cd32581f1de96ddd836deb52550822d459ff9 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Fri, 10 Apr 2026 11:57:53 +0500 Subject: [PATCH 65/83] feat: add universal envgene download --- envgene.sh | 83 +++++++++++++++++++++++++++++--------------------- test-runner.sh | 40 +++++++++++++----------- 2 files changed, 71 insertions(+), 52 deletions(-) diff --git a/envgene.sh b/envgene.sh index 80e7572..657d724 100644 --- a/envgene.sh +++ b/envgene.sh @@ -1,32 +1,37 @@ -#!/bin/bash +#!/usr/bin/env bash load_envgene() { - if [ -z "${ATP_ENVGENE_CONFIGURATION:-}" ]; then echo "ATP_ENVGENE_CONFIGURATION is empty, skipping EnvGene mapping" - return + return 0 fi echo "Loading EnvGene configuration..." - get_value() { - echo "$ATP_ENVGENE_CONFIGURATION" | jq -r "$1 // empty" + to_env_name() { + printf '%s\n' "$1" \ + | tr '[:lower:]' '[:upper:]' \ + | sed 's/[^A-Z0-9]/_/g' } - export PUBLIC_GATEWAY_URL=$(get_value '.systems[] | .["public-gateway"]? | .connections[0].HTTP.url') - export PUBLIC_GATEWAY_LOGIN=$(get_value '.systems[] | .["public-gateway"]? | .connections[0].HTTP.login') - export PUBLIC_GATEWAY_PASSWORD=$(get_value '.systems[] | .["public-gateway"]? | .connections[0].HTTP.password') + derive_namespace_and_hostname() { + local url="$1" + local host namespace_part - if [ -n "$PUBLIC_GATEWAY_URL" ]; then + if [ -z "$url" ]; then + export NAMESPACE="unknown" + export SERVER_HOSTNAME="unknown" + return 0 + fi - host=$(echo "$PUBLIC_GATEWAY_URL" | sed -E 's#https?://([^/]+).*#\1#') + host=$(printf '%s\n' "$url" | sed -E 's#https?://([^/]+).*#\1#') if [[ "$host" == public-gateway-*.* ]]; then - namespace_part=${host#public-gateway-} - export NAMESPACE=${namespace_part%%.*} + namespace_part="${host#public-gateway-}" + export NAMESPACE="${namespace_part%%.*}" - if [[ "$host" == public-gateway-$NAMESPACE.* ]]; then - export SERVER_HOSTNAME=${host#public-gateway-$NAMESPACE.} + if [[ "$host" == public-gateway-"$NAMESPACE".* ]]; then + export SERVER_HOSTNAME="${host#public-gateway-$NAMESPACE.}" else export SERVER_HOSTNAME="$host" fi @@ -34,26 +39,34 @@ load_envgene() { export NAMESPACE="unknown" export SERVER_HOSTNAME="$host" fi - else - export NAMESPACE="unknown" - export SERVER_HOSTNAME="unknown" - fi + } + + while IFS=$'\t' read -r system_name field_name field_value; do + [ -z "$system_name" ] && continue + [ -z "$field_name" ] && continue + [ -z "$field_value" ] && continue + + env_name="$(to_env_name "${system_name}_${field_name}")" + export "${env_name}=${field_value}" + + echo " ${env_name}=${field_value}" + done < <( + jq -r ' + .systems[] + | to_entries[] + | .key as $system_name + | .value.connections[0].HTTP? // empty + | to_entries[] + | select(.key == "url" or .key == "login" or .key == "password") + | select(.value != null and .value != "") + | [$system_name, .key, (.value | tostring)] + | @tsv + ' <<< "$ATP_ENVGENE_CONFIGURATION" + ) + + derive_namespace_and_hostname "${PUBLIC_GATEWAY_URL:-}" - export PRIVATE_GATEWAY_URL=$(get_value '.systems[] | .["private-gateway"]? | .connections[0].HTTP.url') - export INTERNAL_GATEWAY_URL=$(get_value '.systems[] | .["internal-gateway"]? | .connections[0].HTTP.url') - export OPENSEARCH_URL=$(get_value '.systems[] | .["opensearch"]? | .connections[0].HTTP.url') - export HUAWEI_URL=$(get_value '.systems[] | .["huawei"]? | .connections[0].HTTP.url') - export HUAWEI_LOGIN=$(get_value '.systems[] | .["huawei"]? | .connections[0].HTTP.login') - export HUAWEI_PASSWORD=$(get_value '.systems[] | .["huawei"]? | .connections[0].HTTP.password') - export MONITORING_ALARM_ENGINE_URL=$(get_value '.systems[] | .["monitoring-alarm-engine"]? | .connections[0].HTTP.url') - export KAFKA_PLATFORM_URL=$(get_value '.systems[] | .["kafka-platform"]? | .connections[0].HTTP.url') - - echo "EnvGene mapped:" - echo " PUBLIC_GATEWAY_URL=$PUBLIC_GATEWAY_URL" - echo " PRIVATE_GATEWAY_URL=$PRIVATE_GATEWAY_URL" - echo " INTERNAL_GATEWAY_URL=$INTERNAL_GATEWAY_URL" - echo " NAMESPACE=$NAMESPACE" - echo " SERVER_HOSTNAME=$SERVER_HOSTNAME" - echo " PUBLIC_GATEWAY_LOGIN=$PUBLIC_GATEWAY_LOGIN" - echo " PUBLIC_GATEWAY_PASSWORD=$PUBLIC_GATEWAY_PASSWORD" + echo "Derived values:" + echo " NAMESPACE=${NAMESPACE}" + echo " SERVER_HOSTNAME=${SERVER_HOSTNAME}" } \ No newline at end of file diff --git a/test-runner.sh b/test-runner.sh index c4f856b..6362bea 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -265,21 +265,27 @@ run_bruno_from_test_params() { mkdir -p "$PATH_TO_ALLURE_RESULTS" : > "$TMP_DIR/tests_count.csv" - echo "NAMESPACE=$NAMESPACE" > "$PATH_TO_ALLURE_RESULTS/environment.properties" - echo "PUBLIC_GATEWAY_URL=$PUBLIC_GATEWAY_URL" >> "$PATH_TO_ALLURE_RESULTS/environment.properties" - echo "BRUNO_ENV=$BRUNO_ENV_STR" >> "$PATH_TO_ALLURE_RESULTS/environment.properties" - - export PUBLIC_GATEWAY_URL - export PRIVATE_GATEWAY_URL - export INTERNAL_GATEWAY_URL - export OPENSEARCH_URL - export HUAWEI_URL - export MONITORING_ALARM_ENGINE_URL - export KAFKA_PLATFORM_URL - export NAMESPACE - export PUBLIC_GATEWAY_LOGIN - export PUBLIC_GATEWAY_PASSWORD - export SERVER_HOSTNAME + { + echo "BRUNO_ENV=$BRUNO_ENV_STR" + + while IFS= read -r key; do + case "$key" in + *_URL|*_LOGIN|*_PASSWORD|NAMESPACE|SERVER_HOSTNAME) + printf '%s=%s\n' "$key" "${!key}" + ;; + esac + done < <(compgen -e | sort) + } > "$PATH_TO_ALLURE_RESULTS/environment.properties" + + echo "Env vars exported to Bruno child processes:" + while IFS= read -r key; do + case "$key" in + *_URL|*_LOGIN|*_PASSWORD|NAMESPACE|SERVER_HOSTNAME) + export "$key" + echo " - $key" + ;; + esac + done < <(compgen -e) TOTAL_FAILED=0 export -f run_collection_body @@ -334,8 +340,8 @@ export BRUNO_FOLDERS_STR echo "βœ… PARALLEL PHASE END time=$(date '+%H:%M:%S') took=$((parallel_end_ts-parallel_start_ts))s" echo "πŸ“Š Generating Allure HTML report..." - if command -v allure >/dev/null 2>&1; then - if allure generate "$PATH_TO_ALLURE_RESULTS" -o "$TMP_DIR/allure-report" --clean; then + if npx allure --version >/dev/null 2>&1; then + if npx allure generate "$PATH_TO_ALLURE_RESULTS" -o "$TMP_DIR/allure-report" --clean; then if [ -f "$TMP_DIR/allure-report/index.html" ]; then echo "βœ… Allure report generated: $TMP_DIR/allure-report (index.html present)" else From a4333a107819939e61cf925ba7b6995cedd142de Mon Sep 17 00:00:00 2001 From: saju1025 Date: Mon, 13 Apr 2026 15:23:00 +0500 Subject: [PATCH 66/83] feat: add debug --- upload-monitor.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/upload-monitor.sh b/upload-monitor.sh index ef506d8..a582fdc 100644 --- a/upload-monitor.sh +++ b/upload-monitor.sh @@ -34,6 +34,7 @@ start_inotify_uploader() { inotifywait -m -e close_write,create --format '%w%f' "$WATCH_DIR" | while read -r NEW_FILE; do FILE_NAME=$(basename "$NEW_FILE") + echo "πŸ“‘ Detected new file for upload: $NEW_FILE" if [[ "$FILE_NAME" == $FILE_PATTERN ]]; then upload_file_to_s3 "$NEW_FILE" "$DEST_PATH" fi @@ -48,9 +49,11 @@ upload_file_to_s3() { local DEST_PATH="$2" if [[ "$ATP_STORAGE_PROVIDER" == "aws" ]]; then + echo "πŸ“€ Uploading file to AWS S3: $FILE_PATH -> $DEST_PATH" AWS_ACCESS_KEY_ID="$_BACKGROUND_S3_KEY" AWS_SECRET_ACCESS_KEY="$_BACKGROUND_S3_SECRET" \ s5cmd --no-verify-ssl cp "$FILE_PATH" "$DEST_PATH" > /dev/null 2>&1 else + echo "πŸ“€ Uploading file to MinIO/S3-compatible storage: $FILE_PATH -> $DEST_PATH" AWS_ACCESS_KEY_ID="$_BACKGROUND_S3_KEY" AWS_SECRET_ACCESS_KEY="$_BACKGROUND_S3_SECRET" \ s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" cp "$FILE_PATH" "$DEST_PATH" > /dev/null 2>&1 fi @@ -61,9 +64,10 @@ start_sync_uploader() { local DEST_PATH="$2" local FILE_PATTERN="${3:-*}" echo "πŸ“‘ Starting sync uploader for directory: $WATCH_DIR, pattern: $FILE_PATTERN" - ( + ( inotifywait -m -e close_write,create --format '%w%f' "$WATCH_DIR" | while read -r NEW_FILE; do + echo "πŸ“‘ Detected new file for sync upload: $NEW_FILE" FILE_NAME=$(basename "$NEW_FILE") #shellcheck disable=SC2233 if [[ "$FILE_NAME" == $FILE_PATTERN ]]; then @@ -80,9 +84,11 @@ sync_directory_to_s3() { local DEST_PATH="$2" if [[ "$ATP_STORAGE_PROVIDER" == "aws" ]]; then + echo "πŸ“€ Syncing directory to AWS S3: $SOURCE_DIR -> $DEST_PATH" AWS_ACCESS_KEY_ID="$_BACKGROUND_S3_KEY" AWS_SECRET_ACCESS_KEY="$_BACKGROUND_S3_SECRET" \ s5cmd --no-verify-ssl sync "$SOURCE_DIR/" "$DEST_PATH" > /dev/null 2>&1 else + echo "πŸ“€ Syncing directory to MinIO/S3-compatible storage: $SOURCE_DIR -> $DEST_PATH" AWS_ACCESS_KEY_ID="$_BACKGROUND_S3_KEY" AWS_SECRET_ACCESS_KEY="$_BACKGROUND_S3_SECRET" \ s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$SOURCE_DIR/" "$DEST_PATH" > /dev/null 2>&1 fi From fed7170264fea294e4d6ef0d29b0e5fb6382a457 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Tue, 14 Apr 2026 11:59:13 +0500 Subject: [PATCH 67/83] feat: add env for one clc --- test-runner.sh | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index 6362bea..0f04f74 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -48,18 +48,13 @@ run_collection_body() { collection_dir="$1" collection_path="${TMP_DIR}/${collection_dir}" - COMMON_ENV_FILE="${TMP_DIR}/environments/${BRUNO_ENV_STR}.bru" - if [ ! -f "${COMMON_ENV_FILE}" ]; then - echo "❌ Common Bruno env file not found: ${COMMON_ENV_FILE}" - return 1 - fi if [ -n "$BRUNO_FOLDERS_STR" ]; then mapfile -t BRUNO_FOLDERS_ARRAY <<< "$BRUNO_FOLDERS_STR" else BRUNO_FOLDERS_ARRAY=() fi - + echo "➑️ Processing collection: $collection_path" if [ -d "$collection_path" ]; then @@ -71,7 +66,7 @@ run_collection_body() { echo "πŸš€ START collection=$collection_name pid=$$ time=$(date '+%H:%M:%S')" pushd "$collection_path" > /dev/null || return 1 - + RESOLVED_FOLDERS=() if [ ${#BRUNO_FOLDERS_ARRAY[@]} -gt 0 ]; then @@ -99,7 +94,7 @@ run_collection_body() { echo "β–Ά BRUNO RUN START collection=$collection_name pid=$$ mode=full time=$(date '+%H:%M:%S')" if ${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ - --env-file "${COMMON_ENV_FILE}" \ + --env "${BRUNO_ENV_STR}" \ ${BRUNO_ENV_VARS_CLI} \ --reporter-json "${bruno_report_path}" \ >"${raw_log_path}" 2>&1; then @@ -141,7 +136,7 @@ EOF echo "β–Ά BRUNO RUN START collection=$collection_name pid=$$ mode=folders time=$(date '+%H:%M:%S')" if ${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ - --env-file "${COMMON_ENV_FILE}" \ + --env "${BRUNO_ENV_STR}" \ ${BRUNO_ENV_VARS_CLI} \ "${RESOLVED_FOLDERS[@]}" \ --reporter-json "${bruno_report_path}" \ From 79b7c8a4d290cf206cdc6e76be91ef70edf85e6d Mon Sep 17 00:00:00 2001 From: saju1025 Date: Wed, 15 Apr 2026 11:44:21 +0500 Subject: [PATCH 68/83] feat: source check --- test-runner.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index 0f04f74..a4aae3b 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -163,7 +163,7 @@ EOF count=$(jq 'if type=="array" then (if (.[0]?|type)=="object" and (.[0]?|has("results")) then ([.[].results[]]|length) else length end) elif type=="object" and has("results") then (.results|length) else 0 end' "$bruno_report_path") echo "πŸ“Š $collection_name β†’ $count tests" printf "%s,%s\n" "$collection_name" "$count" >> "$TMP_DIR/tests_count.csv" - node /tools/bruno-to-allure.js \ + node /app/tools/bruno-to-allure.js \ "$bruno_report_path" \ "$PATH_TO_ALLURE_RESULTS" \ "$collection_name" @@ -228,7 +228,7 @@ run_bruno_from_test_params() { echo "πŸš€ Bruno execution with EnvGene " # shellcheck disable=SC1091 - source /tools/bru_tools.sh + source /app/tools/bru_tools.sh check_env_var "TEST_PARAMS" "" From 03b4699c34d716d4c0ea4ed5ad24805ddc2bc88a Mon Sep 17 00:00:00 2001 From: saju1025 Date: Wed, 15 Apr 2026 12:27:50 +0500 Subject: [PATCH 69/83] feat: add new logic patch in scripts --- test-runner.sh | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/test-runner.sh b/test-runner.sh index a4aae3b..d5ac31d 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -43,6 +43,50 @@ run_tests() { return "$TEST_EXIT_CODE" } +apply_project_patches() { + local patch_dir="$1" + local patch_root="$2" + local fail_on_error="${3:-true}" + + if [ ! -d "$patch_dir" ]; then + echo "ℹ️ No patch directory found: $patch_dir" + return 0 + fi + + if ! command -v patch >/dev/null 2>&1; then + echo "❌ 'patch' command is not installed" + [ "$fail_on_error" = "true" ] && return 1 || return 0 + fi + + shopt -s nullglob + local patches=("$patch_dir"/*.patch) + shopt -u nullglob + + if [ ${#patches[@]} -eq 0 ]; then + echo "ℹ️ No .patch files found in $patch_dir" + return 0 + fi + + echo "🩹 Applying patches from: $patch_dir" + echo "πŸ“ Patch root: $patch_root" + + local patch_file + for patch_file in "${patches[@]}"; do + echo "🩹 Applying patch: $(basename "$patch_file")" + + if patch --forward --batch -p1 -d "$patch_root" < "$patch_file"; then + echo "βœ… Patch applied: $(basename "$patch_file")" + else + echo "❌ Failed to apply patch: $(basename "$patch_file")" + if [ "$fail_on_error" = "true" ]; then + return 1 + fi + fi + done + + return 0 +} + run_collection_body() { collection_dir="$1" @@ -253,6 +297,11 @@ run_bruno_from_test_params() { cd "$TMP_DIR" || return 1 + if ! apply_project_patches "${TMP_DIR}/bruno-runner/patches" "/app" "true"; then + echo "❌ Failed to apply project patches" + return 1 + fi + PATH_TO_ATTACHMENTS_DIR="${TMP_DIR}/attachments" PATH_TO_ALLURE_RESULTS="${TMP_DIR}/allure-results" rm -rf "$PATH_TO_ATTACHMENTS_DIR" "$PATH_TO_ALLURE_RESULTS" "$TMP_DIR/allure-report" From cc98dbf4de4489c5ac2fb4315f3e3087fc733c14 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Wed, 15 Apr 2026 13:01:46 +0500 Subject: [PATCH 70/83] fix: dir patch --- test-runner.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-runner.sh b/test-runner.sh index d5ac31d..ad61d10 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -297,7 +297,7 @@ run_bruno_from_test_params() { cd "$TMP_DIR" || return 1 - if ! apply_project_patches "${TMP_DIR}/bruno-runner/patches" "/app" "true"; then + if ! apply_project_patches "${TMP_DIR}/bruno-runner/patches" "$TMP_DIR" "true"; then echo "❌ Failed to apply project patches" return 1 fi From ccd3359e46ba1a33955c314a906a86eb74148789 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Wed, 15 Apr 2026 15:25:54 +0500 Subject: [PATCH 71/83] fix :del patch func --- test-runner.sh | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index ad61d10..9a60849 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -43,49 +43,6 @@ run_tests() { return "$TEST_EXIT_CODE" } -apply_project_patches() { - local patch_dir="$1" - local patch_root="$2" - local fail_on_error="${3:-true}" - - if [ ! -d "$patch_dir" ]; then - echo "ℹ️ No patch directory found: $patch_dir" - return 0 - fi - - if ! command -v patch >/dev/null 2>&1; then - echo "❌ 'patch' command is not installed" - [ "$fail_on_error" = "true" ] && return 1 || return 0 - fi - - shopt -s nullglob - local patches=("$patch_dir"/*.patch) - shopt -u nullglob - - if [ ${#patches[@]} -eq 0 ]; then - echo "ℹ️ No .patch files found in $patch_dir" - return 0 - fi - - echo "🩹 Applying patches from: $patch_dir" - echo "πŸ“ Patch root: $patch_root" - - local patch_file - for patch_file in "${patches[@]}"; do - echo "🩹 Applying patch: $(basename "$patch_file")" - - if patch --forward --batch -p1 -d "$patch_root" < "$patch_file"; then - echo "βœ… Patch applied: $(basename "$patch_file")" - else - echo "❌ Failed to apply patch: $(basename "$patch_file")" - if [ "$fail_on_error" = "true" ]; then - return 1 - fi - fi - done - - return 0 -} run_collection_body() { @@ -297,10 +254,6 @@ run_bruno_from_test_params() { cd "$TMP_DIR" || return 1 - if ! apply_project_patches "${TMP_DIR}/bruno-runner/patches" "$TMP_DIR" "true"; then - echo "❌ Failed to apply project patches" - return 1 - fi PATH_TO_ATTACHMENTS_DIR="${TMP_DIR}/attachments" PATH_TO_ALLURE_RESULTS="${TMP_DIR}/allure-results" From 297983eecd210209f42afdba3cc05e3400a84c26 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Fri, 17 Apr 2026 11:15:49 +0500 Subject: [PATCH 72/83] feat: add auto killer clc --- test-runner.sh | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index 9a60849..2f95d47 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -94,7 +94,10 @@ run_collection_body() { echo "➑ Running full collection" echo "β–Ά BRUNO RUN START collection=$collection_name pid=$$ mode=full time=$(date '+%H:%M:%S')" - if ${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ + COLLECTION_TIMEOUT="${COLLECTION_TIMEOUT:-1800}" + + if timeout --signal=TERM --kill-after=30s "${COLLECTION_TIMEOUT}s" \ + ${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ --env "${BRUNO_ENV_STR}" \ ${BRUNO_ENV_VARS_CLI} \ --reporter-json "${bruno_report_path}" \ @@ -136,10 +139,12 @@ EOF echo "➑ Running folders: ${RESOLVED_FOLDERS[*]}" echo "β–Ά BRUNO RUN START collection=$collection_name pid=$$ mode=folders time=$(date '+%H:%M:%S')" - if ${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ + COLLECTION_TIMEOUT="${COLLECTION_TIMEOUT:-1800}" + + if timeout --signal=TERM --kill-after=30s "${COLLECTION_TIMEOUT}s" \ + ${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ --env "${BRUNO_ENV_STR}" \ ${BRUNO_ENV_VARS_CLI} \ - "${RESOLVED_FOLDERS[@]}" \ --reporter-json "${bruno_report_path}" \ >"${raw_log_path}" 2>&1; then echo "βœ… SUCCESS: $collection_name" @@ -236,16 +241,16 @@ run_bruno_from_test_params() { extract_bruno_env "$TEST_PARAMS" "BRUNO_ENV_STR" extract_bruno_collections "$TEST_PARAMS" "BRUNO_COLLECTIONS_ARRAY" if [ ${#BRUNO_COLLECTIONS_ARRAY[@]} -eq 0 ]; then - echo "⚠ No collections provided β€” discovering all collections automatically" + echo "⚠ No collections provided β€” discovering all Bruno collections automatically" mapfile -t BRUNO_COLLECTIONS_ARRAY < <( - find collections -mindepth 1 -maxdepth 1 -type d \ - ! -name ".git" \ - ! -name "node_modules" \ - | sort + find collections -mindepth 1 -maxdepth 1 -type f -name "collection.bru" \ + ! -path "*/.git/*" \ + ! -path "*/node_modules/*" \ + -printf '%h\n' | sort -u ) - echo "πŸ“¦ Discovered collections:" + echo "πŸ“¦ Discovered Bruno collections:" printf " - %s\n" "${BRUNO_COLLECTIONS_ARRAY[@]}" fi extract_bruno_env_vars "$TEST_PARAMS" "BRUNO_ENV_VARS_CLI" @@ -303,7 +308,7 @@ run_bruno_from_test_params() { export BRUNO_FOLDERS_STR - PARALLELISM=${PARALLELISM:-2} + PARALLELISM=${PARALLELISM:-4} echo "Collections to run:" printf "%s\n" "${BRUNO_COLLECTIONS_ARRAY[@]}" echo "Total collections: ${#BRUNO_COLLECTIONS_ARRAY[@]}" From e0d4849b46408fbc91274fef38275c0fc9c65f8a Mon Sep 17 00:00:00 2001 From: saju1025 Date: Fri, 17 Apr 2026 12:57:15 +0500 Subject: [PATCH 73/83] fix: map file --- test-runner.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-runner.sh b/test-runner.sh index 2f95d47..e77dac8 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -244,7 +244,7 @@ run_bruno_from_test_params() { echo "⚠ No collections provided β€” discovering all Bruno collections automatically" mapfile -t BRUNO_COLLECTIONS_ARRAY < <( - find collections -mindepth 1 -maxdepth 1 -type f -name "collection.bru" \ + find collections -mindepth 2 -maxdepth 2 -type f -name "collection.bru" \ ! -path "*/.git/*" \ ! -path "*/node_modules/*" \ -printf '%h\n' | sort -u From 9b3d948ec86c08997224faba84bc3fcf7bb74731 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Mon, 20 Apr 2026 18:13:52 +0500 Subject: [PATCH 74/83] feat: add full log --- test-runner.sh | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index e77dac8..3e5600a 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -94,19 +94,22 @@ run_collection_body() { echo "➑ Running full collection" echo "β–Ά BRUNO RUN START collection=$collection_name pid=$$ mode=full time=$(date '+%H:%M:%S')" - COLLECTION_TIMEOUT="${COLLECTION_TIMEOUT:-1800}" + COLLECTION_TIMEOUT="${COLLECTION_TIMEOUT:-3600}" if timeout --signal=TERM --kill-after=30s "${COLLECTION_TIMEOUT}s" \ ${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ --env "${BRUNO_ENV_STR}" \ ${BRUNO_ENV_VARS_CLI} \ --reporter-json "${bruno_report_path}" \ - >"${raw_log_path}" 2>&1; then + 2>&1 | tee "${raw_log_path}"; then echo "βœ… SUCCESS: $collection_name" else - rc=$? + rc=${PIPESTATUS[0]} echo "❌ FAILED: $collection_name rc=$rc" - TOTAL_FAILED=0 + echo "----- LAST 200 LINES: $collection_name -----" + tail -n 200 "${raw_log_path}" || true + echo "--------------------------------------------" + TOTAL_FAILED=1 fi echo "β—€ BRUNO RUN END collection=$collection_name pid=$$ time=$(date '+%H:%M:%S')" @@ -139,18 +142,21 @@ EOF echo "➑ Running folders: ${RESOLVED_FOLDERS[*]}" echo "β–Ά BRUNO RUN START collection=$collection_name pid=$$ mode=folders time=$(date '+%H:%M:%S')" - COLLECTION_TIMEOUT="${COLLECTION_TIMEOUT:-1800}" + COLLECTION_TIMEOUT="${COLLECTION_TIMEOUT:-3600}" if timeout --signal=TERM --kill-after=30s "${COLLECTION_TIMEOUT}s" \ ${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ --env "${BRUNO_ENV_STR}" \ ${BRUNO_ENV_VARS_CLI} \ --reporter-json "${bruno_report_path}" \ - >"${raw_log_path}" 2>&1; then + 2>&1 | tee "${raw_log_path}"; then echo "βœ… SUCCESS: $collection_name" else - rc=$? + rc=${PIPESTATUS[0]} echo "❌ FAILED: $collection_name rc=$rc" + echo "----- LAST 200 LINES: $collection_name -----" + tail -n 200 "${raw_log_path}" || true + echo "--------------------------------------------" TOTAL_FAILED=1 fi From 7eb5bd56ff5d599b6142dba17ffe5a038d954eab Mon Sep 17 00:00:00 2001 From: saju1025 Date: Wed, 22 Apr 2026 15:23:42 +0500 Subject: [PATCH 75/83] fix: tools and sh scripts --- test-runner.sh | 6 +- tools/bru_tools.sh | 241 +++++++++++++++++++++++++++++++++++++++ tools/bruno-to-allure.js | 210 ++++++++++++++++++++++++++++++++++ upload-monitor.sh | 178 +++++++++++++++-------------- 4 files changed, 546 insertions(+), 89 deletions(-) create mode 100644 tools/bru_tools.sh create mode 100644 tools/bruno-to-allure.js diff --git a/test-runner.sh b/test-runner.sh index 3e5600a..b1703e3 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -143,7 +143,7 @@ EOF echo "β–Ά BRUNO RUN START collection=$collection_name pid=$$ mode=folders time=$(date '+%H:%M:%S')" COLLECTION_TIMEOUT="${COLLECTION_TIMEOUT:-3600}" - + if timeout --signal=TERM --kill-after=30s "${COLLECTION_TIMEOUT}s" \ ${BRU_BIN}/bru.js run ${BRUNO_FLAGS_CLI} \ --env "${BRUNO_ENV_STR}" \ @@ -175,7 +175,7 @@ EOF count=$(jq 'if type=="array" then (if (.[0]?|type)=="object" and (.[0]?|has("results")) then ([.[].results[]]|length) else length end) elif type=="object" and has("results") then (.results|length) else 0 end' "$bruno_report_path") echo "πŸ“Š $collection_name β†’ $count tests" printf "%s,%s\n" "$collection_name" "$count" >> "$TMP_DIR/tests_count.csv" - node /app/tools/bruno-to-allure.js \ + node /app/scripts/bruno-to-allure.js \ "$bruno_report_path" \ "$PATH_TO_ALLURE_RESULTS" \ "$collection_name" @@ -240,7 +240,7 @@ run_bruno_from_test_params() { echo "πŸš€ Bruno execution with EnvGene " # shellcheck disable=SC1091 - source /app/tools/bru_tools.sh + source /app/scripts/bru_tools.sh check_env_var "TEST_PARAMS" "" diff --git a/tools/bru_tools.sh b/tools/bru_tools.sh new file mode 100644 index 0000000..3170e99 --- /dev/null +++ b/tools/bru_tools.sh @@ -0,0 +1,241 @@ +#!/usr/bin/env bash +# ============================================ +# check_env_var β€” ensure an env var is set or compute & export it. +# +# Usage: +# check_env_var VAR_NAME [COMPUTE_EXPR] +# +# Args: +# VAR_NAME Name of the environment variable to check. +# COMPUTE_EXPR (optional) Bash expression/command to compute the value if +# VAR_NAME is empty. Evaluated with `eval`. +# +# Behavior: +# - If VAR_NAME is unset/empty: +# * If COMPUTE_EXPR is provided: evaluates it, exports the result to +# VAR_NAME, and echoes "VAR_NAME = VALUE (Computed)". +# * If COMPUTE_EXPR is missing: prints an error to stderr and exits 1. +# - If VAR_NAME is already set: echoes "VAR_NAME = VALUE". +# ============================================ +check_env_var() { + local var_name="$1" + local compute_expr="$2" + local computed_value # Announcing in advance + + # Check if the variable exists and if it is not empty + if [[ -z "${!var_name:-}" ]]; then + if [[ -z "$compute_expr" ]]; then + echo "❗Error: Variable $var_name must be specified!" >&2 + exit 1 + else + # Calculate the value + if ! computed_value=$(eval "$compute_expr" 2>/dev/null); then + echo "❗Error calculating the value for $var_name" >&2 + exit 1 + fi + + # Export variable + declare -gx "$var_name"="$computed_value" + echo "${var_name} = ${computed_value} (Computed)" + fi + else + echo "${var_name} = ${!var_name}" + fi +} + +# ============================================ +# Extract Bruno environment file from TEST_PARAMS: section "env" +# and convert them to a string like "environments/test_environment.json" +# Parameters: +# $1 - JSON input string +# $2 - Name of the output variable to store the result (optional) +# ============================================ +extract_bruno_env() { + local json_input="$1" + local output_var_name="$2" + local result="" + + # Extract the path to the environment + result=$(echo "$json_input" | jq -r '.env') + echo "➑️ Extracted Bruno environment: $result" + + # Export the result to a variable with a specified name + eval "$output_var_name=\"$result\"" +} + +# ============================================ +# Extract Bruno collections from TEST_PARAMS: section "collections" +# and convert them to an array like:" +# "collections/system1/system1.postman_collection.json", +# "collections/system2/system2.postman_collection.json" +# Parameters: +# $1 - JSON input string +# $2 - Name of the output variable to store the result (optional) +# ============================================ +extract_bruno_collections() { + local json_input="$1" + local output_var_name="$2" + local result_array=() + + # Retrieve the array of collections and save it to a temporary array + readarray -t result_array < <(echo "$json_input" | jq -r '.collections[]?') + + # Export the array to a variable with a specified name + q='' + for x in "${result_array[@]}"; do + q+=$(printf ' %q' "$x") + done + eval "$output_var_name=(${q# })" + + # Log the result + local output_message="➑️ Extracted Bruno collections:" + for collection in "${result_array[@]}"; do + output_message+="\n - $collection" + done + echo -e "$output_message" +} + +# ============================================ +# Extract Bruno flags from TEST_PARAMS: section "flags" +# and convert them to a string like "--insecure --iteration-count 5" +# Parameters: +# $1 - JSON input string +# $2 - Name of the output variable to store the result (optional) +# ============================================ +extract_bruno_flags() { + local json_input="$1" + local output_var_name="$2" + local result="" + + # Extract the flags array from JSON and convert it to a string + result=$(echo "$json_input" | jq -r '.flags | join(" ")') + echo "➑️ Extracted Bruno flags: $result" + + # Export the result to a variable with a specified name + eval "$output_var_name=\"$result\"" +} + +# ============================================ +# Extract Bruno environment variables from TEST_PARAMS: section "env_vars" +# and convert them to a string like "--env-var key1=value1 --env-var key2=value2" +# Parameters: +# $1 - JSON input string +# $2 - Name of the output variable to store the result (optional) +# ============================================ +extract_bruno_env_vars() { + local json_input="$1" + local output_var_name="$2" + local result="" + + # Get the number of elements in env_vars + local count + count=$(jq '.env_vars | length' <<< "$json_input") + + # We go through the indices from 0 to count-1 + for ((i=0; i/dev/null 2>&1; then + echo "➑️ No folders defined in TEST_PARAMS" + eval "$output_var_name=()" + return + fi + + readarray -t result_array < <(echo "$json_input" | jq -r '.folders[]') + + q='' + for x in "${result_array[@]}"; do + q+=$(printf ' %q' "$x") + done + eval "$output_var_name=(${q# })" + + local output_message="➑️ Extracted Bruno folders:" + for folder in "${result_array[@]}"; do + output_message+="\n - $folder" + done + echo -e "$output_message" +} + +# Return: +# 0 β€” if LOCAL_RUN=true +# 1 β€” if LOCAL_RUN=false or value not set/empty +# 2 β€” if incorrect value (not true, not false) +local_run_enabled() { + + local val="${LOCAL_RUN:-}" + + if [ -z "$val" ]; then + return 1 + fi + + # reduce it to lowercase + val="$(printf '%s' "$val" | tr '[:upper:]' '[:lower:]')" + + case "$val" in + true) return 0 ;; + false) return 1 ;; + *) + printf '❌ Incorrect value LOCAL_RUN=%s (expected true/false)\n' "$LOCAL_RUN" >&2 + return 2 + ;; + esac +} + +# Local test execution module +local_run_tests() { + cd "$TMP_DIR" || return 1 + + # Create Allure results directory + echo "β–Ά Starting test execution..." + export NODE_PATH=/app/node_modules + + cp -r "$WORK_DIR/tools" "$TMP_DIR/tools" + + # Create Allure results directory + echo "πŸ“ Creating Allure results directory..." + mkdir -p "$TMP_DIR/allure-results" + + # Execute test suite + echo "πŸš€ Running test suite..." + chmod +x start_tests.sh + ./start_tests.sh || TEST_EXIT_CODE=$? + + TEST_EXIT_CODE=${TEST_EXIT_CODE:-0} + echo "ℹ️ Test script exited with code: $TEST_EXIT_CODE (but continuing...)" + + echo "βœ… Test execution completed" + + cd "$WORK_DIR" || return 1 +} diff --git a/tools/bruno-to-allure.js b/tools/bruno-to-allure.js new file mode 100644 index 0000000..0f5b43c --- /dev/null +++ b/tools/bruno-to-allure.js @@ -0,0 +1,210 @@ +#!/usr/bin/env node +/* global require, process, __dirname, console */ + +const fs = require("fs"); +const path = require("path"); +const { URL } = require("node:url"); +const { v4: uuidv4 } = require("uuid"); + +// args: brunoReportPath, allureResultsDir +const args = process.argv.slice(2); +const brunoReportPath = args[0]; +const allureResultsDir = args[1] || path.join(__dirname, "allure-results"); +const collectionName = args[2] || "unknown-collection"; + +// ensure dir +if (!fs.existsSync(allureResultsDir)) fs.mkdirSync(allureResultsDir, { recursive: true }); + +// split Bruno "path" into folder parts (preserve every level) +function splitPathParts(requestPath) { + if (!requestPath) return ["uncategorized"]; + return requestPath.replace(/\/+|\\+/g, "/").split("/").map(p => p.trim()).filter(Boolean); +} + +// Create steps: Request/Response + Assertion steps +function createSteps(test, id) { + const requestFilename = `${id}-request.json`; + const requestHeadersFilename = `${id}-request-headers.json`; + const responseFilename = `${id}-response.json`; + const responseHeadersFilename = `${id}-response-headers.json`; + + const requestHeaders = test.request?.headers || {}; + const requestBody = test.request?.data !== undefined + ? (typeof test.request.data === "string" ? test.request.data : JSON.stringify(test.request.data, null, 2)) + : "/* no request body */"; + + fs.writeFileSync(path.join(allureResultsDir, requestHeadersFilename), JSON.stringify(requestHeaders, null, 2)); + fs.writeFileSync(path.join(allureResultsDir, requestFilename), requestBody, "utf8"); + + const response = test.response || {}; + const responseHeaders = response.headers || {}; + const responseBody = response.data !== undefined + ? (typeof response.data === "string" ? response.data : JSON.stringify(response.data, null, 2)) + : "/* no response body */"; + + fs.writeFileSync(path.join(allureResultsDir, responseHeadersFilename), JSON.stringify(responseHeaders, null, 2)); + fs.writeFileSync(path.join(allureResultsDir, responseFilename), responseBody, "utf8"); + + const steps = []; + + // --- Assertions --- + const allAssertions = [ + ...(test.preRequestTestResults || []), + ...(test.testResults || []), + ...(test.postResponseTestResults || []) + ]; + + let assertionsFailed = false; + const failedAssertions = []; + + if (allAssertions.length > 0) { + for (const ar of allAssertions) { + const isFail = String(ar.status).toLowerCase() !== "pass"; + if (isFail) { + assertionsFailed = true; + failedAssertions.push(ar); + } + + steps.push({ + name: ar.description || "Assertion", + status: isFail ? "failed" : "passed", + stage: "finished", + statusDetails: isFail ? { + message: ar.description || "Assertion failed", + trace: ar.error || "No description" + }: undefined + }); + } + } + + // Request Headers step + steps.push({ + name: "Request Headers", + status: "passed", + stage: "finished", + attachments: [{ name: "Request Headers", source: requestHeadersFilename, type: "application/json" }], + parameters: Object.entries(requestHeaders).map(([k, v]) => ({ name: k, value: String(v) })) + }); + + // Request Body step + steps.push({ + name: "Request Body", + status: "passed", + stage: "finished", + attachments: [{ name: "Request Body", source: requestFilename, type: "application/json" }] + }); + + // Response Headers step + steps.push({ + name: "Response Headers", + status: "passed", + stage: "finished", + attachments: [{ name: "Response Headers", source: responseHeadersFilename, type: "application/json" }], + parameters: Object.entries(responseHeaders).map(([k, v]) => ({ name: k, value: String(v) })) + }); + + // Response Body step + steps.push({ + name: "Response Body", + status: assertionsFailed ? "failed" : "passed", + stage: "finished", + attachments: [{ name: "Response Body", source: responseFilename, type: "application/json" }] + }); + + return { steps, assertionsFailed, failedAssertions }; +} + +try { + const raw = fs.readFileSync(brunoReportPath, "utf8"); + const brunoReport = JSON.parse(raw); + let results = []; + + if (Array.isArray(brunoReport)) { + if (brunoReport.every(item => item && Array.isArray(item.results))) { + results = brunoReport.flatMap(item => item.results); + } else { + results = brunoReport; + } + } else if (brunoReport && Array.isArray(brunoReport.results)) { + results = brunoReport.results; + } else { + throw new Error("Invalid Bruno report format"); + } + + const children = []; + for (const test of results) { + const id = uuidv4(); + const timestamp = test.timestamp ? new Date(test.timestamp).getTime() : Date.now(); + const duration = test.response?.responseTime ?? test.duration ?? 0; + + const parts = splitPathParts(test.path); + + const parentSuite = "Backend (Bruno)"; + const suite = collectionName; + const subSuite = parts.length > 1 ? parts.slice(0, -1).join(" / ") : undefined; + const packageName = `${collectionName}.${parts.join(".")}`; + + const { steps, assertionsFailed, failedAssertions } = createSteps(test, id, timestamp, duration); + + const initialStatus = + test.status === "pass" ? "passed" : "failed"; + + const finalStatus = assertionsFailed ? "failed" : initialStatus; + + const allureResult = { + uuid: id, + historyId: uuidv4(), + name: test.name || `${test.request?.method || "GET"} ${test.request?.url || ""}`, + fullName: `${packageName}.${test.name || "test"}`, + status: finalStatus, + statusDetails: finalStatus === "failed" ? { + message: failedAssertions?.map(r => + `${r.description || "Test"}: ${r.error || ''}` + ).join("\n") || "Test failed", + trace: failedAssertions?.map(r => + `Status: ${r.status || "Failed"}\nDescription: ${r.description || "No description"}\nError: ${r.error || "No details"}\nActual: ${r.actual}\nExpected: ${r.expected}` + ).join("\n") || "No details" + } : undefined, + steps: steps, + parameters: [ + { name: "Method", value: test.request?.method || "GET" }, + { name: "URL", value: test.request?.url || "n/a" }, + { name: "Response Code", value: test.response?.status || "n/a" } + ], + start: timestamp, + stop: timestamp + duration, + labels: [ + { name: "parentSuite", value: parentSuite }, + { name: "suite", value: suite }, + ...(subSuite ? [{ name: "subSuite", value: subSuite }] : []), + { name: "package", value: packageName }, + { name: "host", value: (() => { try { return new URL(test.request?.url).host } catch { return "n/a"; } })() }, + { name: "framework", value: "bruno" }, + { name: "language", value: "javascript" } + ].filter(l => l.value !== undefined), + description: test.description || test.name || "No description provided", + descriptionHtml: test.description || test.name || "No description provided" + }; + + fs.writeFileSync(path.join(allureResultsDir, `${id}-result.json`), JSON.stringify(allureResult, null, 2)); + children.push(id); + } + + const container = { + uuid: uuidv4(), + children: children, + befores: [], + afters: [], + start: Date.now(), + stop: Date.now() + }; + fs.writeFileSync( + path.join(allureResultsDir, `${uuidv4()}-container.json`), + JSON.stringify(container, null, 2) + ); + console.log(`βœ… Successfully converted Bruno report to Allure format. Results saved in: ${allureResultsDir}`); +} catch (error) { + console.error(`❌ Error processing Bruno report: ${error.message}`); + process.exit(1); +} + diff --git a/upload-monitor.sh b/upload-monitor.sh index a582fdc..6a2a9ec 100644 --- a/upload-monitor.sh +++ b/upload-monitor.sh @@ -1,165 +1,165 @@ #!/bin/bash + # Event-based upload monitoring module start_upload_monitoring() { echo "πŸ“‘ Starting event-based upload monitoring..." - UPLOAD_MONITOR_PIDS=() + + # Prepare common S3 paths RESULTS_S3_PATH="s3://${ATP_STORAGE_BUCKET}/Result/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/" REPORTS_S3_PATH="s3://${ATP_STORAGE_BUCKET}/Report/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/" ATTACHMENTS_S3_PATH="${REPORTS_S3_PATH}attachments/" - mkdir -p "$TMP_DIR/allure-results" - mkdir -p "$TMP_DIR/attachments" + # Create attachments directory + mkdir -p $TMP_DIR/allure-results + mkdir -p $TMP_DIR/attachments + # Store credentials for background processes (local variables, not exported) _BACKGROUND_S3_KEY="$_LOCAL_S3_KEY" _BACKGROUND_S3_SECRET="$_LOCAL_S3_SECRET" + # Choose upload method based on environment variable if [[ "${UPLOAD_METHOD:-cp}" == "sync" ]]; then - start_sync_uploader "$TMP_DIR/allure-results" "${RESULTS_S3_PATH}allure-results/" "*result.json" - start_sync_uploader "$TMP_DIR/attachments" "$ATTACHMENTS_S3_PATH" + echo "πŸ”„ Using sync-based upload monitoring (inotifywait + sync)" + start_sync_uploader "$TMP_DIR/allure-results" "${RESULTS_S3_PATH}allure-results/" "*result.json" & + start_sync_uploader "$TMP_DIR/attachments" "$ATTACHMENTS_S3_PATH" & else - start_inotify_uploader "$TMP_DIR/allure-results" "${RESULTS_S3_PATH}allure-results/" "*result.json" - start_inotify_uploader "$TMP_DIR/attachments" "$ATTACHMENTS_S3_PATH" + echo "πŸ“ Using file-based upload monitoring (inotifywait + cp)" + start_inotify_uploader "$TMP_DIR/allure-results" "${RESULTS_S3_PATH}allure-results/" "*result.json" & + start_inotify_uploader "$TMP_DIR/attachments" "$ATTACHMENTS_S3_PATH" & fi echo "βœ… Upload monitoring started" } +# Inotify uploader function start_inotify_uploader() { - local WATCH_DIR="$1" - local DEST_PATH="$2" - local FILE_PATTERN="${3:-*}" - echo "πŸ“‘ Starting inotify uploader for directory: $WATCH_DIR, pattern: $FILE_PATTERN" - - ( - inotifywait -m -e close_write,create --format '%w%f' "$WATCH_DIR" | - while read -r NEW_FILE; do - FILE_NAME=$(basename "$NEW_FILE") - echo "πŸ“‘ Detected new file for upload: $NEW_FILE" - if [[ "$FILE_NAME" == $FILE_PATTERN ]]; then - upload_file_to_s3 "$NEW_FILE" "$DEST_PATH" - fi - done - ) /dev/null 2>&1 & - - UPLOAD_MONITOR_PIDS+=("$!") + WATCH_DIR="$1" + DEST_PATH="$2" + FILE_PATTERN="${3:-*}" # Optional filename filter (e.g. *result.json) + + echo "πŸ“‘ Starting inotify uploader for $WATCH_DIR => $DEST_PATH (filter: $FILE_PATTERN)" + + # Pass credentials as environment variables only for this process + inotifywait -m -e close_write,create --format '%w%f' "$WATCH_DIR" | while read NEW_FILE; do + FILE_NAME=$(basename "$NEW_FILE") + if [[ "$FILE_NAME" == $FILE_PATTERN ]]; then + echo "πŸ†• Matching file: $FILE_NAME" + upload_file_to_s3 "$NEW_FILE" "$DEST_PATH" + else + echo "⚠️ Ignored file: $FILE_NAME" + fi + done & + + # Store the background process PID + INOTIFY_PID=$! + echo "πŸ“‘ Inotify process started with PID: $INOTIFY_PID" } +# Upload file to S3/MinIO upload_file_to_s3() { local FILE_PATH="$1" local DEST_PATH="$2" + # Use background credentials for upload if [[ "$ATP_STORAGE_PROVIDER" == "aws" ]]; then - echo "πŸ“€ Uploading file to AWS S3: $FILE_PATH -> $DEST_PATH" - AWS_ACCESS_KEY_ID="$_BACKGROUND_S3_KEY" AWS_SECRET_ACCESS_KEY="$_BACKGROUND_S3_SECRET" \ - s5cmd --no-verify-ssl cp "$FILE_PATH" "$DEST_PATH" > /dev/null 2>&1 - else - echo "πŸ“€ Uploading file to MinIO/S3-compatible storage: $FILE_PATH -> $DEST_PATH" - AWS_ACCESS_KEY_ID="$_BACKGROUND_S3_KEY" AWS_SECRET_ACCESS_KEY="$_BACKGROUND_S3_SECRET" \ - s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" cp "$FILE_PATH" "$DEST_PATH" > /dev/null 2>&1 + AWS_ACCESS_KEY_ID="$_BACKGROUND_S3_KEY" AWS_SECRET_ACCESS_KEY="$_BACKGROUND_S3_SECRET" s5cmd --no-verify-ssl cp "$FILE_PATH" "$DEST_PATH" > /dev/null 2>&1 + elif [[ "$ATP_STORAGE_PROVIDER" == "minio" || "$ATP_STORAGE_PROVIDER" == "s3" ]]; then + AWS_ACCESS_KEY_ID="$_BACKGROUND_S3_KEY" AWS_SECRET_ACCESS_KEY="$_BACKGROUND_S3_SECRET" s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" cp "$FILE_PATH" "$DEST_PATH" > /dev/null 2>&1 fi } +# Sync-based uploader function (triggered by inotifywait) start_sync_uploader() { - local WATCH_DIR="$1" - local DEST_PATH="$2" - local FILE_PATTERN="${3:-*}" - echo "πŸ“‘ Starting sync uploader for directory: $WATCH_DIR, pattern: $FILE_PATTERN" - ( - inotifywait -m -e close_write,create --format '%w%f' "$WATCH_DIR" | - while read -r NEW_FILE; do - echo "πŸ“‘ Detected new file for sync upload: $NEW_FILE" - FILE_NAME=$(basename "$NEW_FILE") - #shellcheck disable=SC2233 - if [[ "$FILE_NAME" == $FILE_PATTERN ]]; then - sync_directory_to_s3 "$WATCH_DIR" "$DEST_PATH" - fi - done - ) /dev/null 2>&1 & - - UPLOAD_MONITOR_PIDS+=("$!") + WATCH_DIR="$1" + DEST_PATH="$2" + FILE_PATTERN="${3:-*}" # Optional filename filter + + echo "πŸ”„ Starting sync uploader for $WATCH_DIR => $DEST_PATH (filter: $FILE_PATTERN)" + + # Pass credentials as environment variables only for this process + inotifywait -m -e close_write,create --format '%w%f' "$WATCH_DIR" | while read NEW_FILE; do + FILE_NAME=$(basename "$NEW_FILE") + if [[ "$FILE_NAME" == $FILE_PATTERN ]]; then + echo "πŸ†• Matching file: $FILE_NAME - triggering sync" + sync_directory_to_s3 "$WATCH_DIR" "$DEST_PATH" + #else + # echo "⚠️ Ignored file: $FILE_NAME" + fi + done & + + # Store the background process PID + SYNC_PID=$! + echo "πŸ”„ Sync process started with PID: $SYNC_PID" } +# Sync directory to S3/MinIO sync_directory_to_s3() { local SOURCE_DIR="$1" local DEST_PATH="$2" + # Use background credentials for sync if [[ "$ATP_STORAGE_PROVIDER" == "aws" ]]; then - echo "πŸ“€ Syncing directory to AWS S3: $SOURCE_DIR -> $DEST_PATH" - AWS_ACCESS_KEY_ID="$_BACKGROUND_S3_KEY" AWS_SECRET_ACCESS_KEY="$_BACKGROUND_S3_SECRET" \ - s5cmd --no-verify-ssl sync "$SOURCE_DIR/" "$DEST_PATH" > /dev/null 2>&1 - else - echo "πŸ“€ Syncing directory to MinIO/S3-compatible storage: $SOURCE_DIR -> $DEST_PATH" - AWS_ACCESS_KEY_ID="$_BACKGROUND_S3_KEY" AWS_SECRET_ACCESS_KEY="$_BACKGROUND_S3_SECRET" \ - s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$SOURCE_DIR/" "$DEST_PATH" > /dev/null 2>&1 + AWS_ACCESS_KEY_ID="$_BACKGROUND_S3_KEY" AWS_SECRET_ACCESS_KEY="$_BACKGROUND_S3_SECRET" s5cmd --no-verify-ssl sync "$SOURCE_DIR/" "$DEST_PATH" > /dev/null 2>&1 + elif [[ "$ATP_STORAGE_PROVIDER" == "minio" || "$ATP_STORAGE_PROVIDER" == "s3" ]]; then + AWS_ACCESS_KEY_ID="$_BACKGROUND_S3_KEY" AWS_SECRET_ACCESS_KEY="$_BACKGROUND_S3_SECRET" s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$SOURCE_DIR/" "$DEST_PATH" > /dev/null 2>&1 fi } - +# Finalize upload after tests finalize_upload() { echo "πŸ”„ Finalizing upload operations..." - + + # Prepare common S3 paths RESULTS_S3_PATH="s3://${ATP_STORAGE_BUCKET}/Result/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/" REPORTS_S3_PATH="s3://${ATP_STORAGE_BUCKET}/Report/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/" ATTACHMENTS_S3_PATH="${REPORTS_S3_PATH}attachments/" + # Restore credentials for final operations restore_aws_credentials + # Final sync to ensure all files are captured if [[ "$ATP_STORAGE_PROVIDER" == "aws" ]]; then - echo "πŸ“€ Performing final sync to AWS S3..." - echo " Source: $TMP_DIR/allure-results/ -> Destination: ${RESULTS_S3_PATH}allure-results/" - echo " Source: $TMP_DIR/attachments/ -> Destination: $ATTACHMENTS_S3_PATH" - echo " Source: $TMP_DIR/allure-report/ -> Destination: ${REPORTS_S3_PATH}allure-report/" - echo " Source: $TMP_DIR/scripts/email-notification-generated/ -> Destination: ${RESULTS_S3_PATH}email-notification-generated/" s5cmd --no-verify-ssl sync "$TMP_DIR/allure-results/" "${RESULTS_S3_PATH}allure-results/" s5cmd --no-verify-ssl sync "$TMP_DIR/attachments/" "$ATTACHMENTS_S3_PATH" + s5cmd --no-verify-ssl sync "$TMP_DIR/scripts/email-notification-generated/" "${RESULTS_S3_PATH}email-notification-generated/" if [ -d "$TMP_DIR/allure-report" ]; then - echo "πŸ“€ Uploading Allure HTML report..." s5cmd --no-verify-ssl sync "$TMP_DIR/allure-report/" "${REPORTS_S3_PATH}allure-report/" - else - echo "ℹ️ allure-report directory not found β€” skipping HTML upload" fi - s5cmd --no-verify-ssl sync "$TMP_DIR/scripts/email-notification-generated/" "${RESULTS_S3_PATH}email-notification-generated/" - else - echo "πŸ“€ Performing final sync to MinIO/S3-compatible storage..." - echo " Source: $TMP_DIR/allure-results/ -> Destination: ${RESULTS_S3_PATH}allure-results/" - echo " Source: $TMP_DIR/attachments/ -> Destination: $ATTACHMENTS_S3_PATH" - echo " Source: $TMP_DIR/allure-report/ -> Destination: ${REPORTS_S3_PATH}allure-report/" - echo " Source: $TMP_DIR/scripts/email-notification-generated/ -> Destination: ${RESULTS_S3_PATH}email-notification-generated/" + elif [[ "$ATP_STORAGE_PROVIDER" == "minio" || "$ATP_STORAGE_PROVIDER" == "s3" ]]; then s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/allure-results/" "${RESULTS_S3_PATH}allure-results/" s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/attachments/" "$ATTACHMENTS_S3_PATH" + s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/scripts/email-notification-generated/" "${RESULTS_S3_PATH}email-notification-generated/" if [ -d "$TMP_DIR/allure-report" ]; then - echo "πŸ“€ Uploading Allure HTML report..." - s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" \ - sync "$TMP_DIR/allure-report/" "${REPORTS_S3_PATH}allure-report/" - else - echo "ℹ️ allure-report directory not found β€” skipping HTML upload" + s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/allure-report/" "${REPORTS_S3_PATH}allure-report/" fi - s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/scripts/email-notification-generated/" "${RESULTS_S3_PATH}email-notification-generated/" fi - echo "${ENABLE_JIRA_INTEGRATION:-false}" > "$TMP_DIR/allure-results.uploaded" - + # Upload marker file + echo "${ENABLE_JIRA_INTEGRATION:-false}" > $TMP_DIR/allure-results.uploaded if [[ "$ATP_STORAGE_PROVIDER" == "aws" ]]; then - echo "πŸ“€ Uploading marker file to AWS S3: ${RESULTS_S3_PATH}allure-results.uploaded" s5cmd --no-verify-ssl cp "$TMP_DIR/allure-results.uploaded" "${RESULTS_S3_PATH}allure-results.uploaded" - else - echo "πŸ“€ Uploading marker file to MinIO/S3-compatible storage: ${RESULTS_S3_PATH}allure-results.uploaded" + elif [[ "$ATP_STORAGE_PROVIDER" == "minio" || "$ATP_STORAGE_PROVIDER" == "s3" ]]; then s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" cp "$TMP_DIR/allure-results.uploaded" "${RESULTS_S3_PATH}allure-results.uploaded" fi - echo "βœ… Final sync completed, marker file uploaded" + + # Generate result URLs generate_result_urls + + # Final cleanup final_cleanup echo "" echo "Results are available at: ${RESULTS_URL}" echo "Reports are available at: ${REPORTS_URL}" echo "Report view is available at: ${ATP_REPORT_VIEW_UI_URL}/${REPORTS_FOLDER_PATH}index.html" + echo "βœ… Upload finalization completed" } +# Generate URLs for results generate_result_urls() { if [[ "$ATP_STORAGE_PROVIDER" == "aws" ]]; then - RESULTS_URL="${ATP_STORAGE_BUCKET}.${ATP_STORAGE_SERVER_UI_URL}/Result/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/allure-results/" + RESULT_URL="${ATP_STORAGE_BUCKET}.${ATP_STORAGE_SERVER_UI_URL}/Result/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/allure-results/" elif [[ "$ATP_STORAGE_PROVIDER" == "minio" || "$ATP_STORAGE_PROVIDER" == "s3" ]]; then # Generate base64-encoded URLs for MinIO UI RESULTS_FOLDER_PATH="Result/${ENVIRONMENT_NAME}/${CURRENT_DATE}/${CURRENT_TIME}/allure-results/" @@ -172,23 +172,29 @@ generate_result_urls() { fi } +# Clear sensitive environment variables clear_sensitive_vars() { + echo "πŸ” Clearing sensitive environment variables..." unset AWS_ACCESS_KEY_ID unset AWS_SECRET_ACCESS_KEY unset ATP_STORAGE_USERNAME unset ATP_STORAGE_PASSWORD } +# Restore AWS credentials for final operations restore_aws_credentials() { + echo "πŸ”‘ Restoring AWS credentials for final operations..." export AWS_ACCESS_KEY_ID="$_LOCAL_S3_KEY" export AWS_SECRET_ACCESS_KEY="$_LOCAL_S3_SECRET" } +# Final cleanup of all credentials final_cleanup() { + echo "🧹 Final cleanup of all credentials..." unset AWS_ACCESS_KEY_ID unset AWS_SECRET_ACCESS_KEY unset _LOCAL_S3_KEY unset _LOCAL_S3_SECRET unset _BACKGROUND_S3_KEY unset _BACKGROUND_S3_SECRET -} \ No newline at end of file +} \ No newline at end of file From f17086ee294dc8a9829659632dc7c539d8ae179b Mon Sep 17 00:00:00 2001 From: saju1025 Date: Wed, 22 Apr 2026 18:02:13 +0500 Subject: [PATCH 76/83] fix: source --- email-notification/generate-email-notification-file.sh | 2 +- test-runner.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/email-notification/generate-email-notification-file.sh b/email-notification/generate-email-notification-file.sh index 3eddb17..350fc30 100644 --- a/email-notification/generate-email-notification-file.sh +++ b/email-notification/generate-email-notification-file.sh @@ -207,4 +207,4 @@ generate_email_notification_file() { # Return the message content # echo "$message_content" -} +} \ No newline at end of file diff --git a/test-runner.sh b/test-runner.sh index b1703e3..bd4e2ef 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -175,7 +175,7 @@ EOF count=$(jq 'if type=="array" then (if (.[0]?|type)=="object" and (.[0]?|has("results")) then ([.[].results[]]|length) else length end) elif type=="object" and has("results") then (.results|length) else 0 end' "$bruno_report_path") echo "πŸ“Š $collection_name β†’ $count tests" printf "%s,%s\n" "$collection_name" "$count" >> "$TMP_DIR/tests_count.csv" - node /app/scripts/bruno-to-allure.js \ + node /scripts/bruno-to-allure.js \ "$bruno_report_path" \ "$PATH_TO_ALLURE_RESULTS" \ "$collection_name" @@ -240,7 +240,7 @@ run_bruno_from_test_params() { echo "πŸš€ Bruno execution with EnvGene " # shellcheck disable=SC1091 - source /app/scripts/bru_tools.sh + source /scripts/bru_tools.sh check_env_var "TEST_PARAMS" "" From dd16509f1958e1f781c0fe73158e36c853467582 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Wed, 22 Apr 2026 18:26:39 +0500 Subject: [PATCH 77/83] fix: source v2 --- test-runner.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index bd4e2ef..24b4d83 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -175,7 +175,7 @@ EOF count=$(jq 'if type=="array" then (if (.[0]?|type)=="object" and (.[0]?|has("results")) then ([.[].results[]]|length) else length end) elif type=="object" and has("results") then (.results|length) else 0 end' "$bruno_report_path") echo "πŸ“Š $collection_name β†’ $count tests" printf "%s,%s\n" "$collection_name" "$count" >> "$TMP_DIR/tests_count.csv" - node /scripts/bruno-to-allure.js \ + node /scripts/tools/bruno-to-allure.js \ "$bruno_report_path" \ "$PATH_TO_ALLURE_RESULTS" \ "$collection_name" @@ -240,7 +240,7 @@ run_bruno_from_test_params() { echo "πŸš€ Bruno execution with EnvGene " # shellcheck disable=SC1091 - source /scripts/bru_tools.sh + source /scripts/tools/bru_tools.sh check_env_var "TEST_PARAMS" "" From 2ac84ae314b9e241e444feec05a111dac51a2bf3 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Wed, 22 Apr 2026 19:00:33 +0500 Subject: [PATCH 78/83] fix: pid procces --- test-runner.sh | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index 24b4d83..e029a7a 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -327,19 +327,38 @@ export BRUNO_FOLDERS_STR echo "βœ… PARALLEL PHASE START time=$(date '+%H:%M:%S')" running_jobs=0 + active_collection_pids=() + + wait_for_collection_slot() { + while true; do + for idx in "${!active_collection_pids[@]}"; do + local pid="${active_collection_pids[$idx]}" + + if ! kill -0 "$pid" 2>/dev/null; then + wait "$pid" || true + unset 'active_collection_pids[idx]' + active_collection_pids=("${active_collection_pids[@]}") + return 0 + fi + done + + sleep 1 + done + } for collection in "${BRUNO_COLLECTIONS_ARRAY[@]}"; do bash -c 'run_collection_body "$1"' _ "$collection" & + active_collection_pids+=("$!") running_jobs=$((running_jobs + 1)) if [ "$running_jobs" -ge "$PARALLELISM" ]; then - wait -n || true + wait_for_collection_slot running_jobs=$((running_jobs - 1)) fi done while [ "$running_jobs" -gt 0 ]; do - wait -n || true + wait_for_collection_slot running_jobs=$((running_jobs - 1)) done @@ -370,4 +389,4 @@ export BRUNO_FOLDERS_STR echo "-----------------------------------------" return 0 -} \ No newline at end of file +} From a451e2f540cb198f407b197bc1df3daff58dce5d Mon Sep 17 00:00:00 2001 From: saju1025 Date: Thu, 23 Apr 2026 11:48:41 +0500 Subject: [PATCH 79/83] fix: uuid problems --- tools/bruno-to-allure.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tools/bruno-to-allure.js b/tools/bruno-to-allure.js index 0f5b43c..ff80c32 100644 --- a/tools/bruno-to-allure.js +++ b/tools/bruno-to-allure.js @@ -3,10 +3,9 @@ const fs = require("fs"); const path = require("path"); +const { randomUUID } = require("node:crypto"); const { URL } = require("node:url"); -const { v4: uuidv4 } = require("uuid"); -// args: brunoReportPath, allureResultsDir const args = process.argv.slice(2); const brunoReportPath = args[0]; const allureResultsDir = args[1] || path.join(__dirname, "allure-results"); @@ -133,7 +132,7 @@ try { const children = []; for (const test of results) { - const id = uuidv4(); + const id = randomUUID(); const timestamp = test.timestamp ? new Date(test.timestamp).getTime() : Date.now(); const duration = test.response?.responseTime ?? test.duration ?? 0; @@ -153,7 +152,7 @@ try { const allureResult = { uuid: id, - historyId: uuidv4(), + historyId: randomUUID(), name: test.name || `${test.request?.method || "GET"} ${test.request?.url || ""}`, fullName: `${packageName}.${test.name || "test"}`, status: finalStatus, @@ -191,7 +190,7 @@ try { } const container = { - uuid: uuidv4(), + uuid: randomUUID(), children: children, befores: [], afters: [], @@ -199,7 +198,7 @@ try { stop: Date.now() }; fs.writeFileSync( - path.join(allureResultsDir, `${uuidv4()}-container.json`), + path.join(allureResultsDir, `${randomUUID()}-container.json`), JSON.stringify(container, null, 2) ); console.log(`βœ… Successfully converted Bruno report to Allure format. Results saved in: ${allureResultsDir}`); From ab5f757c9c31a7a207eeeb4274c093774f35d77c Mon Sep 17 00:00:00 2001 From: saju1025 Date: Thu, 23 Apr 2026 13:17:58 +0500 Subject: [PATCH 80/83] fix: folders logic --- test-runner.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/test-runner.sh b/test-runner.sh index e029a7a..27324b0 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -149,6 +149,7 @@ EOF --env "${BRUNO_ENV_STR}" \ ${BRUNO_ENV_VARS_CLI} \ --reporter-json "${bruno_report_path}" \ + "${RESOLVED_FOLDERS[@]}" \ 2>&1 | tee "${raw_log_path}"; then echo "βœ… SUCCESS: $collection_name" else From c02ff854c0f02f63fa0a2ca17e245feb3d71b782 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Thu, 23 Apr 2026 15:22:18 +0500 Subject: [PATCH 81/83] fix: upload.sh check delete & --- upload-monitor.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/upload-monitor.sh b/upload-monitor.sh index 6a2a9ec..67d9169 100644 --- a/upload-monitor.sh +++ b/upload-monitor.sh @@ -20,12 +20,12 @@ start_upload_monitoring() { # Choose upload method based on environment variable if [[ "${UPLOAD_METHOD:-cp}" == "sync" ]]; then echo "πŸ”„ Using sync-based upload monitoring (inotifywait + sync)" - start_sync_uploader "$TMP_DIR/allure-results" "${RESULTS_S3_PATH}allure-results/" "*result.json" & - start_sync_uploader "$TMP_DIR/attachments" "$ATTACHMENTS_S3_PATH" & + start_sync_uploader "$TMP_DIR/allure-results" "${RESULTS_S3_PATH}allure-results/" "*result.json" + start_sync_uploader "$TMP_DIR/attachments" "$ATTACHMENTS_S3_PATH" else echo "πŸ“ Using file-based upload monitoring (inotifywait + cp)" - start_inotify_uploader "$TMP_DIR/allure-results" "${RESULTS_S3_PATH}allure-results/" "*result.json" & - start_inotify_uploader "$TMP_DIR/attachments" "$ATTACHMENTS_S3_PATH" & + start_inotify_uploader "$TMP_DIR/allure-results" "${RESULTS_S3_PATH}allure-results/" "*result.json" + start_inotify_uploader "$TMP_DIR/attachments" "$ATTACHMENTS_S3_PATH" fi echo "βœ… Upload monitoring started" From 78da16dd07da92b28111f73682ec6978b9d09072 Mon Sep 17 00:00:00 2001 From: saju1025 Date: Thu, 23 Apr 2026 17:18:37 +0500 Subject: [PATCH 82/83] fix: & --- upload-monitor.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/upload-monitor.sh b/upload-monitor.sh index 67d9169..6a2a9ec 100644 --- a/upload-monitor.sh +++ b/upload-monitor.sh @@ -20,12 +20,12 @@ start_upload_monitoring() { # Choose upload method based on environment variable if [[ "${UPLOAD_METHOD:-cp}" == "sync" ]]; then echo "πŸ”„ Using sync-based upload monitoring (inotifywait + sync)" - start_sync_uploader "$TMP_DIR/allure-results" "${RESULTS_S3_PATH}allure-results/" "*result.json" - start_sync_uploader "$TMP_DIR/attachments" "$ATTACHMENTS_S3_PATH" + start_sync_uploader "$TMP_DIR/allure-results" "${RESULTS_S3_PATH}allure-results/" "*result.json" & + start_sync_uploader "$TMP_DIR/attachments" "$ATTACHMENTS_S3_PATH" & else echo "πŸ“ Using file-based upload monitoring (inotifywait + cp)" - start_inotify_uploader "$TMP_DIR/allure-results" "${RESULTS_S3_PATH}allure-results/" "*result.json" - start_inotify_uploader "$TMP_DIR/attachments" "$ATTACHMENTS_S3_PATH" + start_inotify_uploader "$TMP_DIR/allure-results" "${RESULTS_S3_PATH}allure-results/" "*result.json" & + start_inotify_uploader "$TMP_DIR/attachments" "$ATTACHMENTS_S3_PATH" & fi echo "βœ… Upload monitoring started" From cd6eb06f91b2a01f6e95263b2cacedc40a05c2ae Mon Sep 17 00:00:00 2001 From: saju1025 Date: Fri, 24 Apr 2026 11:29:59 +0500 Subject: [PATCH 83/83] fix: delete generate allure res --- test-runner.sh | 21 ++------------------- upload-monitor.sh | 6 ------ 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/test-runner.sh b/test-runner.sh index 27324b0..3427419 100644 --- a/test-runner.sh +++ b/test-runner.sh @@ -269,7 +269,7 @@ run_bruno_from_test_params() { PATH_TO_ATTACHMENTS_DIR="${TMP_DIR}/attachments" PATH_TO_ALLURE_RESULTS="${TMP_DIR}/allure-results" - rm -rf "$PATH_TO_ATTACHMENTS_DIR" "$PATH_TO_ALLURE_RESULTS" "$TMP_DIR/allure-report" + rm -rf "$PATH_TO_ATTACHMENTS_DIR" "$PATH_TO_ALLURE_RESULTS" mkdir -p "$PATH_TO_ATTACHMENTS_DIR" mkdir -p "$PATH_TO_ALLURE_RESULTS" : > "$TMP_DIR/tests_count.csv" @@ -367,24 +367,7 @@ export BRUNO_FOLDERS_STR echo "βœ… PARALLEL PHASE END time=$(date '+%H:%M:%S') took=$((parallel_end_ts-parallel_start_ts))s" - echo "πŸ“Š Generating Allure HTML report..." - if npx allure --version >/dev/null 2>&1; then - if npx allure generate "$PATH_TO_ALLURE_RESULTS" -o "$TMP_DIR/allure-report" --clean; then - if [ -f "$TMP_DIR/allure-report/index.html" ]; then - echo "βœ… Allure report generated: $TMP_DIR/allure-report (index.html present)" - else - echo "⚠️ Allure report directory created but index.html missing" - ls -la "$TMP_DIR/allure-report" || true - fi - else - echo "⚠️ Allure report generation failed (will continue, results will still be uploaded)" - fi - else - echo "⚠️ Allure CLI not found in PATH, skipping HTML report generation" - fi - - # echo " DEBUG ALLURE RESULTS " - # ls -la "$PATH_TO_ALLURE_RESULTS" + echo "==== TEST COUNT BY COLLECTION ====" sort "$TMP_DIR/tests_count.csv" echo "-----------------------------------------" diff --git a/upload-monitor.sh b/upload-monitor.sh index 6a2a9ec..edd1444 100644 --- a/upload-monitor.sh +++ b/upload-monitor.sh @@ -122,16 +122,10 @@ finalize_upload() { s5cmd --no-verify-ssl sync "$TMP_DIR/allure-results/" "${RESULTS_S3_PATH}allure-results/" s5cmd --no-verify-ssl sync "$TMP_DIR/attachments/" "$ATTACHMENTS_S3_PATH" s5cmd --no-verify-ssl sync "$TMP_DIR/scripts/email-notification-generated/" "${RESULTS_S3_PATH}email-notification-generated/" - if [ -d "$TMP_DIR/allure-report" ]; then - s5cmd --no-verify-ssl sync "$TMP_DIR/allure-report/" "${REPORTS_S3_PATH}allure-report/" - fi elif [[ "$ATP_STORAGE_PROVIDER" == "minio" || "$ATP_STORAGE_PROVIDER" == "s3" ]]; then s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/allure-results/" "${RESULTS_S3_PATH}allure-results/" s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/attachments/" "$ATTACHMENTS_S3_PATH" s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/scripts/email-notification-generated/" "${RESULTS_S3_PATH}email-notification-generated/" - if [ -d "$TMP_DIR/allure-report" ]; then - s5cmd --no-verify-ssl --endpoint-url "$ATP_STORAGE_SERVER_URL" sync "$TMP_DIR/allure-report/" "${REPORTS_S3_PATH}allure-report/" - fi fi # Upload marker file