-
Notifications
You must be signed in to change notification settings - Fork 149
/
malleus.sh
executable file
·242 lines (206 loc) · 9.34 KB
/
malleus.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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
#!/bin/sh
if [ -n "$DEBUG" ]; then
set -x
fi
usage() {
echo "Usage: $0 [--conferences=MALLEUS_CONFERENCES] [--participants=MALLEUS_PARTICIPANTS] [--senders=MALLEUS_SENDERS] [--audio-senders=MALLEUS_AUDIO_SENDERS] [--senders-per-tab=MALLEUS_SENDERS_PER_TAB] [--receivers-per-tab=MALLEUS_RECEIVERS_PER_NODE] [--sender-tabs-per-browser=MALLEUS_SENDER_TABS_PER_BROWSER] [--receiver-tabs-per-browser=MALLEUS_RECEIVER_TABS_PER_BROWSER] [--senders-per-node=MALLEUS_SENDERS_PER_NODE] [--receivers-per-node=MALLEUS_RECEIVERS_PER_NODE] [--duration=MALLEUS_DURATION (s)] [--join-delay=MALLEUS_JOIN_DELAY (ms)] [--room-name-prefix=MALLEUS_ROOM_NAME_PREFIX] [--hub-url=MALLEUS_HUB_URL] [--instance-url=MALLEUS_INSTANCE_URL] [--regions=MALLEUS_REGIONS] [--use-node-types] [--use-load-test] [--use-lite-mode] [--max-disrupted-bridges-pct=MALLEUS_MAX_DISRUPTED_BRIDGES_PCT] [--extra-sender-params=EXTRA_SENDER_PARAMS] [--extra-receiver-params=EXTRA_RECEIVER_PARAMS] [--debug] [--switch-speakers] [--use-stage-view] [--headless] [--save-logs]" >&2
exit 1
}
set_defaults() {
if [ -z "$MALLEUS_ALLOW_INSECURE_CERTS" ]; then
MALLEUS_ALLOW_INSECURE_CERTS=false
fi
if [ -z "$MALLEUS_CONFERENCES" ]; then
MALLEUS_CONFERENCES=1
fi
if [ -z "$MALLEUS_PARTICIPANTS" ]; then
MALLEUS_PARTICIPANTS=3
fi
if [ -z "$MALLEUS_SENDERS" ]; then
MALLEUS_SENDERS=$MALLEUS_PARTICIPANTS
fi
if [ -z "$MALLEUS_AUDIO_SENDERS" ]; then
MALLEUS_AUDIO_SENDERS=$MALLEUS_PARTICIPANTS
fi
if [ -z "$MALLEUS_SENDER_TABS_PER_BROWSER" ]; then
MALLEUS_SENDER_TABS_PER_BROWSER=1
fi
if [ -z "$MALLEUS_RECEIVER_TABS_PER_BROWSER" ]; then
MALLEUS_RECEIVER_TABS_PER_BROWSER=1
fi
if [ -z "$MALLEUS_SENDERS_PER_TAB" ]; then
MALLEUS_SENDERS_PER_TAB=1
fi
if [ -z "$MALLEUS_RECEIVERS_PER_TAB" ]; then
MALLEUS_RECEIVERS_PER_TAB=1
fi
if [ -z "$MALLEUS_SENDERS_PER_NODE" ]; then
MALLEUS_SENDERS_PER_NODE=1
fi
if [ -z "$MALLEUS_RECEIVERS_PER_NODE" ]; then
MALLEUS_RECEIVERS_PER_NODE=1
fi
if [ -z "$MALLEUS_DURATION" ]; then
MALLEUS_DURATION=60
fi
if [ -z "$MALLEUS_JOIN_DELAY" ]; then
MALLEUS_JOIN_DELAY=0
fi
if [ -z "$MALLEUS_ROOM_NAME_PREFIX" ]; then
MALLEUS_ROOM_NAME_PREFIX='loadtest'
fi
if [ -z "$MALLEUS_HUB_URL" ]; then
MALLEUS_HUB_URL='http://localhost:4444/wd/hub'
fi
if [ -z "$MALLEUS_INSTANCE_URL" ]; then
MALLEUS_INSTANCE_URL='https://meet.jit.si'
fi
if [ -z "$MALLEUS_USE_NODE_TYPES" ]; then
MALLEUS_USE_NODE_TYPES=false
fi
if [ -z "$MALLEUS_USE_LOAD_TEST" ]; then
MALLEUS_USE_LOAD_TEST=false
fi
if [ -z "$MALLEUS_USE_LITE_MODE" ]; then
MALLEUS_USE_LITE_MODE=false
fi
if [ -z "$MALLEUS_MAX_DISRUPTED_BRIDGES_PCT" ]; then
MALLEUS_MAX_DISRUPTED_BRIDGES_PCT=0
fi
if [ -z "$MALLEUS_SWITCH_SPEAKERS" ]; then
MALLEUS_SWITCH_SPEAKERS=false
fi
if [ -z "$MALLEUS_USE_STAGE_VIEW" ]; then
MALLEUS_USE_STAGE_VIEW=false
fi
if [ -z "$MALLEUS_SET_SAVELOGS" ]; then
MALLEUS_SET_SAVELOGS=false
fi
# Null is a fine default for MALLEUS_EXTRA_SENDER_PARAMS, MALLEUS_EXTRA_RECEIVER_PARAMS and MALLEUS_JWT
}
case $1 in
"")
# no args provided, falling back to environment variables and default values
set_defaults
;;
--*)
# new arg parsing code that includes default values for the different options.
for arg in "$@"; do
optname=`echo $arg | cut -d= -f1`
optvalue=`echo $arg | cut -s -d= -f2-`
case $optname in
--conferences) MALLEUS_CONFERENCES=$optvalue;;
--allow-insecure-certs) MALLEUS_ALLOW_INSECURE_CERTS=$optvalue;;
--participants) MALLEUS_PARTICIPANTS=$optvalue;;
--senders) MALLEUS_SENDERS=$optvalue;;
--audio-senders) MALLEUS_AUDIO_SENDERS=$optvalue;;
--sender-tabs-per-browser) MALLEUS_SENDER_TABS_PER_BROWSER=$optvalue;;
--receiver-tabs-per-browser) MALLEUS_RECEIVER_TABS_PER_BROWSER=$optvalue;;
--senders-per-tab) MALLEUS_SENDERS_PER_TAB=$optvalue;;
--receivers-per-tab) MALLEUS_RECEIVERS_PER_TAB=$optvalue;;
--senders-per-node) MALLEUS_SENDERS_PER_NODE=$optvalue; MALLEUS_USE_NODE_TYPES=true;;
--receivers-per-node) MALLEUS_RECEIVERS_PER_NODE=$optvalue; MALLEUS_USE_NODE_TYPES=true;;
--duration) MALLEUS_DURATION=$optvalue;;
--join-delay) MALLEUS_JOIN_DELAY=$optvalue;;
--room-name-prefix) MALLEUS_ROOM_NAME_PREFIX=$optvalue;;
--hub-url) MALLEUS_HUB_URL=$optvalue;;
--instance-url) MALLEUS_INSTANCE_URL=$optvalue;;
--regions) MALLEUS_REGIONS=$optvalue;;
--use-node-types) if [ -n "$optvalue" ]; then MALLEUS_USE_NODE_TYPES=$optvalue; else MALLEUS_USE_NODE_TYPES=true; fi;;
--use-load-test) if [ -n "$optvalue" ]; then MALLEUS_USE_LOAD_TEST=$optvalue; else MALLEUS_USE_LOAD_TEST=true; fi;;
--use-lite-mode) if [ -n "$optvalue" ]; then MALLEUS_USE_LITE_MODE=$optvalue; else MALLEUS_USE_LITE_MODE=true; fi;;
--switch-speakers) if [ -n "$optvalue" ]; then MALLEUS_SWITCH_SPEAKERS=$optvalue; else MALLEUS_SWITCH_SPEAKERS=true; fi;;
--use-stage-view) if [ -n "$optvalue" ]; then MALLEUS_USE_STAGE_VIEW=$optvalue; else MALLEUS_USE_STAGE_VIEW=true; fi;;
--headless) if [ -n "$optvalue" ]; then MALLEUS_USE_HEADLESS=$optvalue; else MALLEUS_USE_HEADLESS=true; fi;;
--save-logs) if [ -n "$optvalue" ]; then MALLEUS_SET_SAVELOGS=$optvalue; else MALLEUS_SET_SAVELOGS=true; fi;;
--extra-sender-params) MALLEUS_EXTRA_SENDER_PARAMS=$optvalue;;
--extra-receiver-params) MALLEUS_EXTRA_RECEIVER_PARAMS=$optvalue;;
--max-disrupted-bridges-pct) MALLEUS_MAX_DISRUPTED_BRIDGES_PCT=$optvalue;;
--debug) set -x;;
--jwt) MALLEUS_JWT=$optvalue;;
*)
usage
;;
esac
done
set_defaults
;;
*)
# backwords compatible arg parsing so as to not break existing scripts that
# use malleus.
# Runs a test with:
# $1 conferences, with
# $2 participants each, with
# $3 of them sending video and the rest having video muted.
# $4 seconds the participants will stay in the conference.
# $5 will be the conference room name prefix.
# $6 will be the selenium grid address (for example http://grid.example.com:4444/wd/hub)
if [ $# != 6 ]; then
usage
fi
MALLEUS_CONFERENCES=$1
MALLEUS_PARTICIPANTS=$2
MALLEUS_SENDERS=$3
MALLEUS_DURATION=$4
MALLEUS_ROOM_NAME_PREFIX=$5
MALLEUS_HUB_URL=$6
MALLEUS_INSTANCE_URL='https://meet.jit.si'
set_defaults
;;
esac
if [ "$MALLEUS_SENDERS_PER_TAB" -gt 1 -o "$MALLEUS_RECEIVERS_PER_TAB" -gt 1 ] && [ "$MALLEUS_USE_LOAD_TEST" != "true" ]; then
echo "Senders-per-tab and/or receivers-per-tab parameters require load-test"
exit 1
fi
# This names nodes as being a "malleusSender" or "malleusReceiver" (using the Selenium Grid
# "applicationName" parameter). This lets us run multiple browsers on a Selenium Grid endpoint,
# scaled for the number of browsers the endpoint can handle performing the requested action.
if [ "$MALLEUS_USE_NODE_TYPES" = "true" ]
then
"$(dirname $0)"/mutatenodes.sh --hub-url="$MALLEUS_HUB_URL" --num-senders="$MALLEUS_SENDERS" \
--send-node-max-sessions="$MALLEUS_SENDERS_PER_NODE" --recv-node-max-sessions="$MALLEUS_RECEIVERS_PER_NODE"
err=$?
if [ $err -ne 0 ]
then
echo "Not running malleus: mutatenodes.sh failed with status $err"
exit $err
fi
fi
if [ -z "$MALLEUS_TESTS_TO_RUN" ]; then
MALLEUS_TESTS_TO_RUN=MalleusJitsificus
fi
mvn \
-Dthreadcount=1 \
-Dorg.jitsi.malleus.conferences=$MALLEUS_CONFERENCES \
-Dorg.jitsi.malleus.max_disrupted_bridges_pct=$MALLEUS_MAX_DISRUPTED_BRIDGES_PCT \
-Dorg.jitsi.malleus.participants=$MALLEUS_PARTICIPANTS \
-Dorg.jitsi.malleus.senders=$MALLEUS_SENDERS \
-Dorg.jitsi.malleus.audio_senders=$MALLEUS_AUDIO_SENDERS \
-Dorg.jitsi.malleus.duration=$MALLEUS_DURATION \
-Dorg.jitsi.malleus.join_delay=$MALLEUS_JOIN_DELAY \
-Dorg.jitsi.malleus.room_name_prefix=$MALLEUS_ROOM_NAME_PREFIX \
-Dorg.jitsi.malleus.regions=$MALLEUS_REGIONS \
-Dorg.jitsi.malleus.use_node_types=$MALLEUS_USE_NODE_TYPES \
-Dorg.jitsi.malleus.sender_tabs_per_browser=$MALLEUS_SENDER_TABS_PER_BROWSER \
-Dorg.jitsi.malleus.receiver_tabs_per_browser=$MALLEUS_RECEIVER_TABS_PER_BROWSER \
-Dorg.jitsi.malleus.senders_per_tab=$MALLEUS_SENDERS_PER_TAB \
-Dorg.jitsi.malleus.receivers_per_tab=$MALLEUS_RECEIVERS_PER_TAB \
-Dorg.jitsi.meet.test.util.blip_script=$MALLEUS_BLIP_SCRIPT \
-Dorg.jitsi.malleus.use_load_test=$MALLEUS_USE_LOAD_TEST \
-Dorg.jitsi.malleus.use_lite_mode=$MALLEUS_USE_LITE_MODE \
-Dorg.jitsi.malleus.switch_speakers=$MALLEUS_SWITCH_SPEAKERS \
-Dorg.jitsi.malleus.use_stage_view=$MALLEUS_USE_STAGE_VIEW \
-Dorg.jitsi.malleus.enable.headless=$MALLEUS_USE_HEADLESS \
-Dorg.jitsi.malleus.set.saveLogs=$MALLEUS_SET_SAVELOGS \
-Dorg.jitsi.malleus.extra_sender_params=$MALLEUS_EXTRA_SENDER_PARAMS \
-Dorg.jitsi.malleus.extra_receiver_params=$MALLEUS_EXTRA_RECEIVER_PARAMS \
-Dremote.address=$MALLEUS_HUB_URL \
-DallowInsecureCerts=$MALLEUS_ALLOW_INSECURE_CERTS \
-Djitsi-meet.tests.toRun=$MALLEUS_TESTS_TO_RUN \
-Dorg.jitsi.token=$MALLEUS_JWT \
-Dwdm.gitHubTokenName=jitsi-jenkins \
-Dremote.resource.path=/usr/share/jitsi-meet-torture \
-Djitsi-meet.instance.url=$MALLEUS_INSTANCE_URL \
-Djitsi-meet.isRemote=true \
-Dchrome.disable.nosanbox=true \
test