forked from kubeshop/tracetest
-
Notifications
You must be signed in to change notification settings - Fork 5
/
run.sh
executable file
·160 lines (128 loc) · 2.64 KB
/
run.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#!/bin/bash
set -e
export TAG=${TAG:-dev}
opts="-f docker-compose.yaml -f examples/docker-compose.demo.yaml"
# use nats version of docker-compose if NATS is set to true
if [ "$NATS" == "true" ]; then
opts="-f docker-compose.nats.yaml -f examples/docker-compose.demo.yaml"
fi
help_message() {
echo "usage: ./run.sh [cypress|tracetests|up|stop|build|down|tracetest-logs|logs|ps|restart]"
}
restart() {
docker compose $opts kill tracetest
docker compose $opts up -d tracetest
docker compose $opts restart otel-collector
}
logs() {
docker compose $opts logs -f
}
tracetest-logs() {
docker compose $opts logs -f tracetest
}
ps() {
docker compose $opts ps
}
down() {
docker compose $opts kill
docker compose $opts down
}
build() {
make build-docker
# the previous commands builds the cli binary for linux (because its the os in docker)
# if the script is run on another os, like macos, we need to rebuild for the binary to match the os
make dist/tracetest
}
up() {
docker compose $opts up -d --remove-orphans
}
stop() {
docker compose $opts stop
}
cypress-ci() {
echo "Running cypress"
export CYPRESS_BASE_URL=http://localhost:11633
export POKEMON_HTTP_ENDPOINT=http://demo-api:8081
cd web
npm run cy:ci
}
cypress() {
echo "Running cypress"
export CYPRESS_BASE_URL=http://localhost:11633
export POKEMON_HTTP_ENDPOINT=http://demo-api:8081
cd web
npm run cy:run
}
tracetests() {
echo "Running tracetests"
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
export TRACETEST_CLI=${SCRIPT_DIR}/dist/tracetest
export TARGET_URL=http://localhost:11633
export TRACETEST_ENDPOINT=localhost:11633
export DEMO_APP_URL=http://demo-api:8081
export DEMO_APP_GRPC_URL=demo-rpc:8082
cd testing/server-tracetesting
./run.bash
}
CMD=()
while [[ $# -gt 0 ]]; do
case $1 in
cypress)
CMD+=("cypress")
shift
;;
cypress-ci)
CMD+=("cypress-ci")
shift
;;
tracetests)
CMD+=("tracetests")
shift
;;
up)
CMD+=("up")
shift
;;
stop)
CMD+=("stop")
shift
;;
build)
CMD+=("build")
shift
;;
down)
CMD+=("down")
shift
;;
tracetest-logs)
CMD+=("tracetest-logs")
shift
;;
logs)
CMD+=("logs")
shift
;;
ps)
CMD+=("ps")
shift
;;
restart)
CMD+=("restart")
shift
;;
*)
echo "Unknown option $1"
help_message
exit 1
;;
esac
done
if [ ${#CMD[@]} -eq 0 ]; then
echo "Missing command"
help_message
exit 1
fi
for cmd in "${CMD[@]}"; do
$cmd
done