File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -64,6 +64,10 @@ run_package_test() {
6464 local gcloud_config_dir=$( mktemp -d -t " gcloud-config-${package_name} -XXXXXX" )
6565 local CLOUDSDK_CONFIG=" ${gcloud_config_dir} "
6666
67+ # 🪤 TRAP: Ensure cleanup of THIS specific temp dir on exit of this subshell
68+ trap ' rm -rf "$gcloud_config_dir"' EXIT
69+
70+
6771 echo " ------------------------------------------------------------"
6872 echo " Configuring environment for: ${package_name} "
6973 echo " ------------------------------------------------------------"
@@ -101,8 +105,10 @@ run_package_test() {
101105 export PROJECT_ID GOOGLE_APPLICATION_CREDENTIALS NOX_FILE NOX_SESSION CLOUDSDK_CONFIG
102106 export GOOGLE_CLOUD_PROJECT=" ${PROJECT_ID} "
103107
104- gcloud auth activate-service-account --key-file=" $GOOGLE_APPLICATION_CREDENTIALS "
105- gcloud config set project " $PROJECT_ID "
108+ # 🛡️ Explicit check: Fail early if auth fails
109+ gcloud auth activate-service-account --key-file=" $GOOGLE_APPLICATION_CREDENTIALS " || return 1
110+ export CLOUDSDK_CORE_PROJECT=" ${PROJECT_ID} "
111+
106112
107113 # Run the actual test
108114 pushd " ${package_path} " > /dev/null
@@ -112,7 +118,6 @@ run_package_test() {
112118 set -e
113119 popd > /dev/null
114120
115- rm -rf " ${gcloud_config_dir} "
116121 return $res
117122}
118123
You can’t perform that action at this time.
0 commit comments