Skip to content

Commit

Permalink
CQ-4355928 ui-tests-cypress: setup proxy environment variables (#1190)
Browse files Browse the repository at this point in the history
  • Loading branch information
nortoneo committed May 13, 2024
1 parent 798a251 commit c9692ee
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/archetype/ui.tests.cypress/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ RUN apt -qqy update \
# Generic dependencies
&& apt -qqy --no-install-recommends install \
python \
curl \
build-essential
# <<< End EAAS Convention \

Expand Down
23 changes: 23 additions & 0 deletions src/main/archetype/ui.tests.cypress/test-module/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,28 @@ echo 'checking Xvfb'
ps aux | grep Xvfb
# disable color output when running Cypress
export NO_COLOR=1

# setup proxy environment variables
if [ -n "${PROXY_HOST:-}" ]; then
if [ -n "${PROXY_HTTPS_PORT:-}" ]; then
export HTTP_PROXY="https://${PROXY_HOST}:${PROXY_HTTPS_PORT}"
elif [ -n "${PROXY_HTTP_PORT:-}" ]; then
export HTTP_PROXY="http://${PROXY_HOST}:${PROXY_HTTP_PORT}"
fi
if [ -n "${PROXY_CA_PATH:-}" ]; then
export NODE_EXTRA_CA_CERTS=${PROXY_CA_PATH}
fi
if [ -n "${PROXY_OBSERVABILITY_PORT:-}" ] && [ -n "${HTTP_PROXY:-}" ]; then
echo "Waiting for proxy"
curl --silent --retry ${PROXY_RETRY_ATTEMPTS:-3} --retry-connrefused --retry-delay ${PROXY_RETRY_DELAY:-10} \
--proxy ${HTTP_PROXY} --proxy-cacert ${PROXY_CA_PATH:-""} \
${PROXY_HOST}:${PROXY_OBSERVABILITY_PORT}
if [ $? -ne 0 ]; then
echo "Proxy is not ready"
exit 1
fi
fi
fi

# execute tests
npm test

0 comments on commit c9692ee

Please sign in to comment.