@@ -218,20 +218,37 @@ wait_for_oidc_endpoint_docker() {
218
218
calculate_rabbitmq_url () {
219
219
echo " ${RABBITMQ_SCHEME:- http} ://$1 ${PUBLIC_RABBITMQ_PATH:- $RABBITMQ_PATH } "
220
220
}
221
-
221
+ calculate_forward_proxy_url () {
222
+ PROXIED_URL=$1
223
+ PROXY_HOSTNAME=$2
224
+ PROXY_PORT=$3
225
+ SCHEME=$( echo " $PROXIED_URL " | cut -d: -f1)
226
+ PATH=$( echo " $PROXIED_URL " | cut -d/ -f4-)
227
+ echo " $SCHEME ://$PROXY_HOSTNAME :$PROXY_PORT /$PATH "
228
+ }
222
229
wait_for_url () {
223
230
BASE_URL=$1
224
231
if [[ $BASE_URL == * " localhost" ** ]]; then
225
- wait_for_url_local $BASE_URL
232
+ wait_for_url_local $@
226
233
else
227
- wait_for_url_docker $BASE_URL
234
+ wait_for_url_docker $@
228
235
fi
229
236
}
230
237
wait_for_url_local () {
231
238
url=$1
239
+ proxy=${2:- none}
240
+ proxy_user=${3:- none}
241
+ proxy_pass=$4
242
+ curl_args=" -L -f -v"
232
243
max_retry=10
233
244
counter=0
234
- until (curl -L -f -v $url > /dev/null 2>&1 )
245
+ if [[ " $proxy " != " none" && " $proxy " != " " ]]; then
246
+ curl_args=" --proxy ${proxy} ${curl_args} "
247
+ fi
248
+ if [[ " $proxy_user " != " none" && " $proxy_user " != " " ]]; then
249
+ curl_args=" --proxy-user ${proxy_user} :${proxy_pass} ${curl_args} "
250
+ fi
251
+ until (curl $curl_args $url > /dev/null 2>&1 )
235
252
do
236
253
print " Waiting for $url to start (local)"
237
254
sleep 5
@@ -242,9 +259,19 @@ wait_for_url_local() {
242
259
}
243
260
wait_for_url_docker () {
244
261
url=$1
262
+ proxy=${2:- none}
263
+ proxy_user=${3:- none}
264
+ proxy_pass=$4
245
265
max_retry=10
246
266
counter=0
247
- until (docker run --net ${DOCKER_NETWORK} --rm curlimages/curl:7.85.0 -L -f -v $url > /dev/null 2>&1 )
267
+ curl_args=" -L -f -v"
268
+ if [[ " $proxy " != " none" && " $proxy " != " " ]]; then
269
+ curl_args=" --proxy ${proxy} ${curl_args} "
270
+ fi
271
+ if [[ " $proxy_user " != " none" && " $proxy_user " != " " ]]; then
272
+ curl_args=" --proxy-user ${proxy_user} :${proxy_pass} ${curl_args} "
273
+ fi
274
+ until (docker run --net ${DOCKER_NETWORK} --rm curlimages/curl:7.85.0 $curl_args $url > /dev/null 2>&1 )
248
275
do
249
276
print " Waiting for $url to start (docker)"
250
277
sleep 5
@@ -377,7 +404,8 @@ profiles_with_local_or_docker() {
377
404
generate_env_file () {
378
405
begin " Generating env file ..."
379
406
mkdir -p $CONF_DIR
380
- ${BIN_DIR} /gen-env-file $TEST_CONFIG_DIR $ENV_FILE
407
+ ${BIN_DIR} /gen-env-file $TEST_CONFIG_DIR ${ENV_FILE} .tmp
408
+ grep -v ' ^#' ${ENV_FILE} .tmp > $ENV_FILE
381
409
source $ENV_FILE
382
410
end " Finished generating env file."
383
411
}
@@ -560,7 +588,7 @@ run_on_docker_with() {
560
588
build_mocha_image
561
589
start_selenium
562
590
563
- trap teardown_components EXIT
591
+ trap " teardown_components" EXIT
564
592
565
593
start_components
566
594
test
@@ -641,7 +669,6 @@ start_components() {
641
669
$start
642
670
done
643
671
}
644
-
645
672
teardown_components () {
646
673
skip_rabbitmq=${1:- false}
647
674
0 commit comments