forked from ONSdigital/address-index-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunGatlingBulk.sh
executable file
·69 lines (58 loc) · 2.16 KB
/
runGatlingBulk.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
#! /bin/bash
###### General bash settings to allow easier debugging of this script#####
# Uncomment this to debug script
# set -x
set -e # Fail fast if an error is encountered
set -o pipefail # Look at all commands in a pipeline to detect failure, not just the last
set -o functrace # Allow tracing of function calls
set -E # Allow ERR signal to always be fired
##########################################################################
####### Error Handling ################
failure() {
local lineno=$1
local msg=$2
echo "Failed at $lineno: $msg"
}
trap 'failure ${LINENO} "$BASH_COMMAND"' ERR
##########################################################################
############################# Arg parsing ############################################################
usage() { echo "$0 usage:" && grep " .)\ #" $0; exit 0; }
rps=10
url="http://localhost:9001"
payload="ai-api-bulk-local.json"
options=':p:c:u:r:h'
while getopts $options option
do
case $option in
r) # Specify concurrent users
rps=${OPTARG}
;;
p) # Payload name
payload=${OPTARG}
;;
u) # Specify Base URL
url=${OPTARG}
;;
c) # Specify configFileName
configFileName=${OPTARG}
;; #configname
h ) usage; exit;;
\? ) echo "Unknown option: -$OPTARG" >&2; exit 1;;
: ) echo "Missing option argument for -$OPTARG" >&2; exit 1;;
* ) echo "Unimplemented option: -$OPTARG" >&2; exit 1;;
esac
done
shift $((OPTIND - 1))
if [ "x" = "x$configFileName" ]; then
echo "configFileName must be specified"
exit
fi
echo "Setting rps to $rps"
echo "Setting url to $url"
echo "Setting payload to $payload"
echo "Setting configFileName to $configFileName"
#########################################################################################
echo "Beginning Gatling tests"
JAVA_OPTS="-DCONCURRENT_USERS=${rps} -DPAYLOAD_NAME=${payload} -DBASE_URL=${url} -DCONFIG_NAME=${configFileName}" \
sbt "project address-index-server" "gatling-it:testOnly uk.gov.ons.gatling.simulations.RegistersSimulationClosedModel" \
"gatling-it:lastReport"