-
Notifications
You must be signed in to change notification settings - Fork 69
/
run.bash
executable file
路58 lines (43 loc) 路 1.36 KB
/
run.bash
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#/bin/bash
set -e
export TAG=${TAG:-"latest"}
export TEST_ENV=${TEST_ENV:-"local"}
if [ $TEST_ENV = "local" ]; then
export TRACETEST_ENDPOINT="localhost:11633"
export TRACETEST_CLI_COMMAND=$TRACETEST_CLI
else
export TRACETEST_ENDPOINT="host.docker.internal:11633"
export TRACETEST_CLI_COMMAND="docker run --volume $PWD/tests:/app/tests --entrypoint tracetest --add-host=host.docker.internal:host-gateway kubeshop/tracetest:$TAG"
fi
echo "Preparing to run CLI tests..."
echo ""
echo "Environment variables considered on this run:"
echo "TAG: $TAG"
echo "TEST_ENV: $TEST_ENV"
echo "TRACETEST_ENDPOINT: $TRACETEST_ENDPOINT"
echo "TRACETEST_CLI_COMMAND: $TRACETEST_CLI_COMMAND"
echo ""
echo "Setting up tracetest CLI configuration..."
cat << EOF > tests/config.yml
scheme: http
endpoint: $TRACETEST_ENDPOINT
analyticsEnabled: false
EOF
echo "tracetest CLI set up."
echo ""
echo "Setting up test helpers..."
run_cli_command() {
args=$1
$TRACETEST_CLI_COMMAND --config ./tests/config.yml $args
return $?
}
echo "Test helpers set."
echo ""
echo "Starting tests..."
EXIT_STATUS=0
run_cli_command '--help' || EXIT_STATUS=$?
run_cli_command 'version' || EXIT_STATUS=$?
run_cli_command 'test run --definition ./tests/simple-test.yaml --wait-for-result' || EXIT_STATUS=$?
echo ""
echo "Tests done! Exit code: $EXIT_STATUS"
exit $EXIT_STATUS