@@ -68,12 +68,12 @@ export GOOGLE_CLIENT_SECRETS=$(pwd)/testing/client-secrets.json
68
68
export DATALABELING_ENDPOINT=" test-datalabeling.sandbox.googleapis.com:443"
69
69
70
70
# Run Cloud SQL proxy (background process exit when script does)
71
- wget --quiet https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 \
72
- -O ${HOME} /cloud_sql_proxy && chmod +x ${HOME} /cloud_sql_proxy
73
- ${HOME} /cloud_sql_proxy -instances=" ${MYSQL_INSTANCE} " =tcp:3306 & >> \
74
- ${HOME} /cloud_sql_proxy.log &
75
- ${HOME} /cloud_sql_proxy -instances=" ${POSTGRES_INSTANCE} " =tcp:5432 & >> \
71
+ sudo wget --quiet https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 \
72
+ -O /bin/cloud_sql_proxy && sudo chmod +x /bin/cloud_sql_proxy
73
+ cloud_sql_proxy -instances=" ${MYSQL_INSTANCE} " =tcp:3306 & >> \
76
74
${HOME} /cloud_sql_proxy.log &
75
+ cloud_sql_proxy -instances=" ${POSTGRES_INSTANCE} " =tcp:5432 & >> \
76
+ ${HOME} /cloud_sql_proxy-postgres.log &
77
77
echo -e " \nCloud SQL proxy started."
78
78
79
79
echo -e " \n******************** TESTING PROJECTS ********************"
@@ -102,25 +102,36 @@ for file in **/requirements.txt; do
102
102
103
103
# First we look up the environment variable `RUN_TESTS_DIRS`. If
104
104
# the value is set, we'll iterate through the colon separated
105
- # directory list.
105
+ # directory list. If the target directory is not under any
106
+ # directory in the list, we skip this directory.
107
+ # This environment variables are primarily for
108
+ # `scripts/run_tests_local.sh`.
109
+ #
110
+ # The value must be a colon separated list of relative paths from
111
+ # the project root.
112
+ #
113
+ # Example:
114
+ # cdn:appengine/flexible
115
+ # run tests for `cdn` and `appengine/flexible` directories.
116
+ # logging/cloud-client
117
+ # only run tests for `logging/cloud-client` directory.
118
+ #
106
119
if [[ -n " ${RUN_TESTS_DIRS:- } " ]]; then
107
- IFS=" :"
108
- read -ra run_tests_dirs <<< " ${RUN_TESTS_DIRS}"
109
120
match=0
110
- for d in " ${run_tests_dirs[@]} " ; do
121
+ for d in $( echo " ${RUN_TESTS_DIRS} " | tr " : " " \n " ) ; do
111
122
# If the current dir starts with one of the
112
123
# RUN_TESTS_DIRS, we should run the tests.
113
124
if [[ " ${file} " = " ${d} " * ]]; then
114
125
match=1
115
126
break
116
127
fi
117
128
done
118
- IFS=" "
119
129
if [[ $match -eq 0 ]]; then
120
130
continue
121
131
fi
132
+ fi
122
133
# If $DIFF_FROM is set, use it to check for changes in this directory.
123
- elif [[ -n " ${DIFF_FROM:- } " ]] && [[ " ${test_all} " == " false" ]]; then
134
+ if [[ -n " ${DIFF_FROM:- } " ]] && [[ " ${test_all} " == " false" ]]; then
124
135
git diff --quiet " $DIFF_FROM " .
125
136
CHANGED=$?
126
137
if [[ " $CHANGED " -eq 0 ]]; then
0 commit comments