From acb30929674eb83f1c52fa955f20d36a5fd01c45 Mon Sep 17 00:00:00 2001 From: Nitin Garg Date: Wed, 12 Feb 2025 11:52:51 +0000 Subject: [PATCH] fix for correctly passing --zonal flag in individual test package runs --- tools/integration_tests/run_e2e_tests.sh | 42 ++++++++++++++---------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/tools/integration_tests/run_e2e_tests.sh b/tools/integration_tests/run_e2e_tests.sh index 370f1d18eb..6050b0a7f2 100755 --- a/tools/integration_tests/run_e2e_tests.sh +++ b/tools/integration_tests/run_e2e_tests.sh @@ -39,18 +39,18 @@ if [ $# -ge 5 ] ; then RUN_TESTS_WITH_PRESUBMIT_FLAG=$5 fi -# 6th parameter is set to enable/disable run for zonal bucket. -RUN_TESTS_WITH_ZONAL_BUCKET=false -if [[ $# -ge 6 ]] ; then - if [[ "$6" == "true" ]]; then - RUN_TESTS_WITH_ZONAL_BUCKET=true - elif [[ "$6" != "false" ]]; then - echo "Error: Invalid value for 6th argument: "$6" . Expected: true or false." - exit 1 - fi -fi +# # 6th parameter is set to enable/disable run for zonal bucket. +# RUN_TESTS_WITH_ZONAL_BUCKET=false +# if [[ $# -ge 6 ]] ; then + # if [[ "$6" == "true" ]]; then + # RUN_TESTS_WITH_ZONAL_BUCKET=true + # elif [[ "$6" != "false" ]]; then + # echo "Error: Invalid value for 6th argument: "$6" . Expected: true or false." + # exit 1 + # fi +# fi -if ${RUN_TESTS_WITH_ZONAL_BUCKET}; then +# if ${RUN_TESTS_WITH_ZONAL_BUCKET}; then if [[ ${BUCKET_LOCATION} != "us-central1" && ${BUCKET_LOCATION} != "us-west4" ]]; then >&2 echo "Zonal buckets are not supported in the passed region (BUCKET_LOCATION): ${BUCKET_LOCATION}. Supported regions: us-central1, us-west4" exit 1 @@ -60,7 +60,7 @@ if ${RUN_TESTS_WITH_ZONAL_BUCKET}; then else BUCKET_LOCATION="us-central1" fi -fi +# fi if [ "$#" -lt 3 ] then @@ -226,6 +226,10 @@ function run_non_parallel_tests() { local exit_code=0 local -n test_array=$1 local bucket_name_non_parallel=$2 + local zonal=false + if [[ $#>=3 && "$3"="true" ]]; then + zonal=true + fi for test_dir_np in "${test_array[@]}" do @@ -236,7 +240,7 @@ function run_non_parallel_tests() { echo $log_file >> $TEST_LOGS_FILE # Executing integration tests - GODEBUG=asyncpreemptoff=1 go test $test_path_non_parallel -p 1 $GO_TEST_SHORT_FLAG $PRESUBMIT_RUN_FLAG --zonal=${RUN_TESTS_WITH_ZONAL_BUCKET} --integrationTest -v --testbucket=$bucket_name_non_parallel --testInstalledPackage=$RUN_E2E_TESTS_ON_PACKAGE -timeout $INTEGRATION_TEST_TIMEOUT > "$log_file" 2>&1 + GODEBUG=asyncpreemptoff=1 go test $test_path_non_parallel -p 1 $GO_TEST_SHORT_FLAG $PRESUBMIT_RUN_FLAG --zonal=${zonal} --integrationTest -v --testbucket=$bucket_name_non_parallel --testInstalledPackage=$RUN_E2E_TESTS_ON_PACKAGE -timeout $INTEGRATION_TEST_TIMEOUT > "$log_file" 2>&1 exit_code_non_parallel=$? if [ $exit_code_non_parallel != 0 ]; then exit_code=$exit_code_non_parallel @@ -250,6 +254,10 @@ function run_parallel_tests() { local exit_code=0 local -n test_array=$1 local bucket_name_parallel=$2 + local zonal=false + if [[ $#>=3 && "$3"="true" ]]; then + zonal=true + fi local benchmark_flags="" declare -A pids @@ -267,7 +275,7 @@ function run_parallel_tests() { local log_file="/tmp/${test_dir_p}_${bucket_name_parallel}.log" echo $log_file >> $TEST_LOGS_FILE # Executing integration tests - GODEBUG=asyncpreemptoff=1 go test $test_path_parallel $GO_TEST_SHORT_FLAG $PRESUBMIT_RUN_FLAG --zonal=${RUN_TESTS_WITH_ZONAL_BUCKET} $benchmark_flags -p 1 --integrationTest -v --testbucket=$bucket_name_parallel --testInstalledPackage=$RUN_E2E_TESTS_ON_PACKAGE -timeout $INTEGRATION_TEST_TIMEOUT > "$log_file" 2>&1 & + GODEBUG=asyncpreemptoff=1 go test $test_path_parallel $GO_TEST_SHORT_FLAG $PRESUBMIT_RUN_FLAG --zonal=${zonal} $benchmark_flags -p 1 --integrationTest -v --testbucket=$bucket_name_parallel --testInstalledPackage=$RUN_E2E_TESTS_ON_PACKAGE -timeout $INTEGRATION_TEST_TIMEOUT > "$log_file" 2>&1 & pid=$! # Store the PID of the background process pids[${test_dir_p}]=${pid} # Optionally add the PID to an array for later done @@ -371,9 +379,9 @@ function run_e2e_tests_for_zonal_bucket(){ echo "Zonal Bucket Created for non-parallel tests: "$zonal_bucket_name_non_parallel_group echo "Running tests for ZONAL bucket" - run_parallel_tests TEST_DIR_PARALLEL_FOR_ZB "$zonal_bucket_name_parallel_group" & + run_parallel_tests TEST_DIR_PARALLEL_FOR_ZB "$zonal_bucket_name_parallel_group" true & parallel_tests_zonal_group_pid=$! - run_non_parallel_tests TEST_DIR_NON_PARALLEL_FOR_ZB "$zonal_bucket_name_non_parallel_group" & + run_non_parallel_tests TEST_DIR_NON_PARALLEL_FOR_ZB "$zonal_bucket_name_non_parallel_group" true & non_parallel_tests_zonal_group_pid=$! echo "Waiting for some time for experiment ..." @@ -400,7 +408,7 @@ function run_e2e_tests_for_tpc() { gcloud storage rm -r gs://gcsfuse-e2e-tests-tpc/** # Run Operations e2e tests in TPC to validate all the functionality. - GODEBUG=asyncpreemptoff=1 go test ./tools/integration_tests/operations/... --testOnTPCEndPoint=$RUN_TEST_ON_TPC_ENDPOINT $GO_TEST_SHORT_FLAG $PRESUBMIT_RUN_FLAG --zonal=${RUN_TESTS_WITH_ZONAL_BUCKET} -p 1 --integrationTest -v --testbucket=gcsfuse-e2e-tests-tpc --testInstalledPackage=$RUN_E2E_TESTS_ON_PACKAGE -timeout $INTEGRATION_TEST_TIMEOUT + GODEBUG=asyncpreemptoff=1 go test ./tools/integration_tests/operations/... --testOnTPCEndPoint=$RUN_TEST_ON_TPC_ENDPOINT $GO_TEST_SHORT_FLAG $PRESUBMIT_RUN_FLAG --zonal=false -p 1 --integrationTest -v --testbucket=gcsfuse-e2e-tests-tpc --testInstalledPackage=$RUN_E2E_TESTS_ON_PACKAGE -timeout $INTEGRATION_TEST_TIMEOUT exit_code=$? set -e