forked from spiffe/spire-tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·34 lines (25 loc) · 809 Bytes
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#/bin/bash
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
bb=$(tput bold) || true
nn=$(tput sgr0) || true
red=$(tput setaf 1) || true
green=$(tput setaf 2) || true
clean-env() {
echo "${bb}Cleaning up...${nn}"
bash "${DIR}"/scripts/clean-env.sh > /dev/null
}
trap clean-env EXIT
echo "${bb}Preparing environment...${nm}"
clean-env
# Creates Envoy JWT scenario
bash "${DIR}"/scripts/set-env.sh
echo "${bb}Running test...${nm}"
# If balance is part of the response, then the request was accepted by the backend and token was valid.
BALANCE_LINE="Your current balance is 10.95"
if curl -s $(minikube service frontend --url) | grep -qe "$BALANCE_LINE"; then
echo "${green}Success${nn}"
exit 0
fi
echo "${red}Failed! Request did not make it through the proxies.${nn}"
exit 1