From 49854f0732340d650c786fa74fd860bcea641a71 Mon Sep 17 00:00:00 2001 From: Keith Johnson Date: Mon, 7 Nov 2022 22:26:26 -0500 Subject: [PATCH 1/2] Update gatling --- rungatling.sh | 6 +- seeding/accounts.json | 303 +++++++++++++++++++ seeding/groups.json | 3 + seeding/organizations.json | 3 + seeding/seed.sh | 31 ++ seeding/teams.json | 252 +++++++++++++++ simulations/domjudge/AdminSetup.scala | 35 --- simulations/domjudge/Common.scala | 155 ---------- simulations/domjudge/ContestSimulation.scala | 112 ------- 9 files changed, 595 insertions(+), 305 deletions(-) create mode 100644 seeding/accounts.json create mode 100644 seeding/groups.json create mode 100644 seeding/organizations.json create mode 100644 seeding/seed.sh create mode 100644 seeding/teams.json delete mode 100644 simulations/domjudge/AdminSetup.scala delete mode 100644 simulations/domjudge/Common.scala delete mode 100644 simulations/domjudge/ContestSimulation.scala diff --git a/rungatling.sh b/rungatling.sh index 2ed2f14..cf62b00 100755 --- a/rungatling.sh +++ b/rungatling.sh @@ -1,11 +1,11 @@ #!/bin/bash DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # Download gatling bundle from here, extract it -# https://repo1.maven.org/maven2/io/gatling/highcharts/gatling-charts-highcharts-bundle/3.4.1/gatling-charts-highcharts-bundle-3.4.1-bundle.zip -GATLING=$DIR/gatling-charts-highcharts-bundle-3.4.1/bin/gatling.sh +# https://repo1.maven.org/maven2/io/gatling/highcharts/gatling-charts-highcharts-bundle/3.8.4/gatling-charts-highcharts-bundle-3.8.4-bundle.zip +GATLING=$DIR/gatling-charts-highcharts-bundle-3.8.4/bin/gatling.sh URL=${1:-http://localhost/domjudge} echo "Running gatling against: $URL" export JAVA_OPTS="-Dbaseurl=$URL" -$GATLING --results-folder $PWD/reports --simulations-folder $PWD/simulations --resources-folder $PWD/bodies --simulation domjudge.ContestSimulation +$GATLING --run-mode local --results-folder $PWD/reports --simulations-folder $PWD/simulations --resources-folder $PWD/bodies --run-description "domjudge" --simulation domjudge.ContestSimulation diff --git a/seeding/accounts.json b/seeding/accounts.json new file mode 100644 index 0000000..39f2d7f --- /dev/null +++ b/seeding/accounts.json @@ -0,0 +1,303 @@ +[ + {"id":"gatling0001","username":"gatling0001","type":"team","team_id":"0001","password":"secret"}, + {"id":"gatling0002","username":"gatling0002","type":"team","team_id":"0002","password":"secret"}, + {"id":"gatling0003","username":"gatling0003","type":"team","team_id":"0003","password":"secret"}, + {"id":"gatling0004","username":"gatling0004","type":"team","team_id":"0004","password":"secret"}, + {"id":"gatling0005","username":"gatling0005","type":"team","team_id":"0005","password":"secret"}, + {"id":"gatling0006","username":"gatling0006","type":"team","team_id":"0006","password":"secret"}, + {"id":"gatling0007","username":"gatling0007","type":"team","team_id":"0007","password":"secret"}, + {"id":"gatling0008","username":"gatling0008","type":"team","team_id":"0008","password":"secret"}, + {"id":"gatling0009","username":"gatling0009","type":"team","team_id":"0009","password":"secret"}, + {"id":"gatling0010","username":"gatling0010","type":"team","team_id":"0010","password":"secret"}, + {"id":"gatling0011","username":"gatling0011","type":"team","team_id":"0011","password":"secret"}, + {"id":"gatling0012","username":"gatling0012","type":"team","team_id":"0012","password":"secret"}, + {"id":"gatling0013","username":"gatling0013","type":"team","team_id":"0013","password":"secret"}, + {"id":"gatling0014","username":"gatling0014","type":"team","team_id":"0014","password":"secret"}, + {"id":"gatling0015","username":"gatling0015","type":"team","team_id":"0015","password":"secret"}, + {"id":"gatling0016","username":"gatling0016","type":"team","team_id":"0016","password":"secret"}, + {"id":"gatling0017","username":"gatling0017","type":"team","team_id":"0017","password":"secret"}, + {"id":"gatling0018","username":"gatling0018","type":"team","team_id":"0018","password":"secret"}, + {"id":"gatling0019","username":"gatling0019","type":"team","team_id":"0019","password":"secret"}, + {"id":"gatling0020","username":"gatling0020","type":"team","team_id":"0020","password":"secret"}, + {"id":"gatling0021","username":"gatling0021","type":"team","team_id":"0021","password":"secret"}, + {"id":"gatling0022","username":"gatling0022","type":"team","team_id":"0022","password":"secret"}, + {"id":"gatling0023","username":"gatling0023","type":"team","team_id":"0023","password":"secret"}, + {"id":"gatling0024","username":"gatling0024","type":"team","team_id":"0024","password":"secret"}, + {"id":"gatling0025","username":"gatling0025","type":"team","team_id":"0025","password":"secret"}, + {"id":"gatling0026","username":"gatling0026","type":"team","team_id":"0026","password":"secret"}, + {"id":"gatling0027","username":"gatling0027","type":"team","team_id":"0027","password":"secret"}, + {"id":"gatling0028","username":"gatling0028","type":"team","team_id":"0028","password":"secret"}, + {"id":"gatling0029","username":"gatling0029","type":"team","team_id":"0029","password":"secret"}, + {"id":"gatling0030","username":"gatling0030","type":"team","team_id":"0030","password":"secret"}, + {"id":"gatling0031","username":"gatling0031","type":"team","team_id":"0031","password":"secret"}, + {"id":"gatling0032","username":"gatling0032","type":"team","team_id":"0032","password":"secret"}, + {"id":"gatling0033","username":"gatling0033","type":"team","team_id":"0033","password":"secret"}, + {"id":"gatling0034","username":"gatling0034","type":"team","team_id":"0034","password":"secret"}, + {"id":"gatling0035","username":"gatling0035","type":"team","team_id":"0035","password":"secret"}, + {"id":"gatling0036","username":"gatling0036","type":"team","team_id":"0036","password":"secret"}, + {"id":"gatling0037","username":"gatling0037","type":"team","team_id":"0037","password":"secret"}, + {"id":"gatling0038","username":"gatling0038","type":"team","team_id":"0038","password":"secret"}, + {"id":"gatling0039","username":"gatling0039","type":"team","team_id":"0039","password":"secret"}, + {"id":"gatling0040","username":"gatling0040","type":"team","team_id":"0040","password":"secret"}, + {"id":"gatling0041","username":"gatling0041","type":"team","team_id":"0041","password":"secret"}, + {"id":"gatling0042","username":"gatling0042","type":"team","team_id":"0042","password":"secret"}, + {"id":"gatling0043","username":"gatling0043","type":"team","team_id":"0043","password":"secret"}, + {"id":"gatling0044","username":"gatling0044","type":"team","team_id":"0044","password":"secret"}, + {"id":"gatling0045","username":"gatling0045","type":"team","team_id":"0045","password":"secret"}, + {"id":"gatling0046","username":"gatling0046","type":"team","team_id":"0046","password":"secret"}, + {"id":"gatling0047","username":"gatling0047","type":"team","team_id":"0047","password":"secret"}, + {"id":"gatling0048","username":"gatling0048","type":"team","team_id":"0048","password":"secret"}, + {"id":"gatling0049","username":"gatling0049","type":"team","team_id":"0049","password":"secret"}, + {"id":"gatling0050","username":"gatling0050","type":"team","team_id":"0050","password":"secret"}, + {"id":"gatling0051","username":"gatling0051","type":"team","team_id":"0051","password":"secret"}, + {"id":"gatling0052","username":"gatling0052","type":"team","team_id":"0052","password":"secret"}, + {"id":"gatling0053","username":"gatling0053","type":"team","team_id":"0053","password":"secret"}, + {"id":"gatling0054","username":"gatling0054","type":"team","team_id":"0054","password":"secret"}, + {"id":"gatling0055","username":"gatling0055","type":"team","team_id":"0055","password":"secret"}, + {"id":"gatling0056","username":"gatling0056","type":"team","team_id":"0056","password":"secret"}, + {"id":"gatling0057","username":"gatling0057","type":"team","team_id":"0057","password":"secret"}, + {"id":"gatling0058","username":"gatling0058","type":"team","team_id":"0058","password":"secret"}, + {"id":"gatling0059","username":"gatling0059","type":"team","team_id":"0059","password":"secret"}, + {"id":"gatling0060","username":"gatling0060","type":"team","team_id":"0060","password":"secret"}, + {"id":"gatling0061","username":"gatling0061","type":"team","team_id":"0061","password":"secret"}, + {"id":"gatling0062","username":"gatling0062","type":"team","team_id":"0062","password":"secret"}, + {"id":"gatling0063","username":"gatling0063","type":"team","team_id":"0063","password":"secret"}, + {"id":"gatling0064","username":"gatling0064","type":"team","team_id":"0064","password":"secret"}, + {"id":"gatling0065","username":"gatling0065","type":"team","team_id":"0065","password":"secret"}, + {"id":"gatling0066","username":"gatling0066","type":"team","team_id":"0066","password":"secret"}, + {"id":"gatling0067","username":"gatling0067","type":"team","team_id":"0067","password":"secret"}, + {"id":"gatling0068","username":"gatling0068","type":"team","team_id":"0068","password":"secret"}, + {"id":"gatling0069","username":"gatling0069","type":"team","team_id":"0069","password":"secret"}, + {"id":"gatling0070","username":"gatling0070","type":"team","team_id":"0070","password":"secret"}, + {"id":"gatling0071","username":"gatling0071","type":"team","team_id":"0071","password":"secret"}, + {"id":"gatling0072","username":"gatling0072","type":"team","team_id":"0072","password":"secret"}, + {"id":"gatling0073","username":"gatling0073","type":"team","team_id":"0073","password":"secret"}, + {"id":"gatling0074","username":"gatling0074","type":"team","team_id":"0074","password":"secret"}, + {"id":"gatling0075","username":"gatling0075","type":"team","team_id":"0075","password":"secret"}, + {"id":"gatling0076","username":"gatling0076","type":"team","team_id":"0076","password":"secret"}, + {"id":"gatling0077","username":"gatling0077","type":"team","team_id":"0077","password":"secret"}, + {"id":"gatling0078","username":"gatling0078","type":"team","team_id":"0078","password":"secret"}, + {"id":"gatling0079","username":"gatling0079","type":"team","team_id":"0079","password":"secret"}, + {"id":"gatling0080","username":"gatling0080","type":"team","team_id":"0080","password":"secret"}, + {"id":"gatling0081","username":"gatling0081","type":"team","team_id":"0081","password":"secret"}, + {"id":"gatling0082","username":"gatling0082","type":"team","team_id":"0082","password":"secret"}, + {"id":"gatling0083","username":"gatling0083","type":"team","team_id":"0083","password":"secret"}, + {"id":"gatling0084","username":"gatling0084","type":"team","team_id":"0084","password":"secret"}, + {"id":"gatling0085","username":"gatling0085","type":"team","team_id":"0085","password":"secret"}, + {"id":"gatling0086","username":"gatling0086","type":"team","team_id":"0086","password":"secret"}, + {"id":"gatling0087","username":"gatling0087","type":"team","team_id":"0087","password":"secret"}, + {"id":"gatling0088","username":"gatling0088","type":"team","team_id":"0088","password":"secret"}, + {"id":"gatling0089","username":"gatling0089","type":"team","team_id":"0089","password":"secret"}, + {"id":"gatling0090","username":"gatling0090","type":"team","team_id":"0090","password":"secret"}, + {"id":"gatling0091","username":"gatling0091","type":"team","team_id":"0091","password":"secret"}, + {"id":"gatling0092","username":"gatling0092","type":"team","team_id":"0092","password":"secret"}, + {"id":"gatling0093","username":"gatling0093","type":"team","team_id":"0093","password":"secret"}, + {"id":"gatling0094","username":"gatling0094","type":"team","team_id":"0094","password":"secret"}, + {"id":"gatling0095","username":"gatling0095","type":"team","team_id":"0095","password":"secret"}, + {"id":"gatling0096","username":"gatling0096","type":"team","team_id":"0096","password":"secret"}, + {"id":"gatling0097","username":"gatling0097","type":"team","team_id":"0097","password":"secret"}, + {"id":"gatling0098","username":"gatling0098","type":"team","team_id":"0098","password":"secret"}, + {"id":"gatling0099","username":"gatling0099","type":"team","team_id":"0099","password":"secret"}, + {"id":"gatling0100","username":"gatling0100","type":"team","team_id":"0100","password":"secret"}, + {"id":"gatling0101","username":"gatling0101","type":"team","team_id":"0101","password":"secret"}, + {"id":"gatling0102","username":"gatling0102","type":"team","team_id":"0102","password":"secret"}, + {"id":"gatling0103","username":"gatling0103","type":"team","team_id":"0103","password":"secret"}, + {"id":"gatling0104","username":"gatling0104","type":"team","team_id":"0104","password":"secret"}, + {"id":"gatling0105","username":"gatling0105","type":"team","team_id":"0105","password":"secret"}, + {"id":"gatling0106","username":"gatling0106","type":"team","team_id":"0106","password":"secret"}, + {"id":"gatling0107","username":"gatling0107","type":"team","team_id":"0107","password":"secret"}, + {"id":"gatling0108","username":"gatling0108","type":"team","team_id":"0108","password":"secret"}, + {"id":"gatling0109","username":"gatling0109","type":"team","team_id":"0109","password":"secret"}, + {"id":"gatling0110","username":"gatling0110","type":"team","team_id":"0110","password":"secret"}, + {"id":"gatling0111","username":"gatling0111","type":"team","team_id":"0111","password":"secret"}, + {"id":"gatling0112","username":"gatling0112","type":"team","team_id":"0112","password":"secret"}, + {"id":"gatling0113","username":"gatling0113","type":"team","team_id":"0113","password":"secret"}, + {"id":"gatling0114","username":"gatling0114","type":"team","team_id":"0114","password":"secret"}, + {"id":"gatling0115","username":"gatling0115","type":"team","team_id":"0115","password":"secret"}, + {"id":"gatling0116","username":"gatling0116","type":"team","team_id":"0116","password":"secret"}, + {"id":"gatling0117","username":"gatling0117","type":"team","team_id":"0117","password":"secret"}, + {"id":"gatling0118","username":"gatling0118","type":"team","team_id":"0118","password":"secret"}, + {"id":"gatling0119","username":"gatling0119","type":"team","team_id":"0119","password":"secret"}, + {"id":"gatling0120","username":"gatling0120","type":"team","team_id":"0120","password":"secret"}, + {"id":"gatling0121","username":"gatling0121","type":"team","team_id":"0121","password":"secret"}, + {"id":"gatling0122","username":"gatling0122","type":"team","team_id":"0122","password":"secret"}, + {"id":"gatling0123","username":"gatling0123","type":"team","team_id":"0123","password":"secret"}, + {"id":"gatling0124","username":"gatling0124","type":"team","team_id":"0124","password":"secret"}, + {"id":"gatling0125","username":"gatling0125","type":"team","team_id":"0125","password":"secret"}, + {"id":"gatling0126","username":"gatling0126","type":"team","team_id":"0126","password":"secret"}, + {"id":"gatling0127","username":"gatling0127","type":"team","team_id":"0127","password":"secret"}, + {"id":"gatling0128","username":"gatling0128","type":"team","team_id":"0128","password":"secret"}, + {"id":"gatling0129","username":"gatling0129","type":"team","team_id":"0129","password":"secret"}, + {"id":"gatling0130","username":"gatling0130","type":"team","team_id":"0130","password":"secret"}, + {"id":"gatling0131","username":"gatling0131","type":"team","team_id":"0131","password":"secret"}, + {"id":"gatling0132","username":"gatling0132","type":"team","team_id":"0132","password":"secret"}, + {"id":"gatling0133","username":"gatling0133","type":"team","team_id":"0133","password":"secret"}, + {"id":"gatling0134","username":"gatling0134","type":"team","team_id":"0134","password":"secret"}, + {"id":"gatling0135","username":"gatling0135","type":"team","team_id":"0135","password":"secret"}, + {"id":"gatling0136","username":"gatling0136","type":"team","team_id":"0136","password":"secret"}, + {"id":"gatling0137","username":"gatling0137","type":"team","team_id":"0137","password":"secret"}, + {"id":"gatling0138","username":"gatling0138","type":"team","team_id":"0138","password":"secret"}, + {"id":"gatling0139","username":"gatling0139","type":"team","team_id":"0139","password":"secret"}, + {"id":"gatling0140","username":"gatling0140","type":"team","team_id":"0140","password":"secret"}, + {"id":"gatling0141","username":"gatling0141","type":"team","team_id":"0141","password":"secret"}, + {"id":"gatling0142","username":"gatling0142","type":"team","team_id":"0142","password":"secret"}, + {"id":"gatling0143","username":"gatling0143","type":"team","team_id":"0143","password":"secret"}, + {"id":"gatling0144","username":"gatling0144","type":"team","team_id":"0144","password":"secret"}, + {"id":"gatling0145","username":"gatling0145","type":"team","team_id":"0145","password":"secret"}, + {"id":"gatling0146","username":"gatling0146","type":"team","team_id":"0146","password":"secret"}, + {"id":"gatling0147","username":"gatling0147","type":"team","team_id":"0147","password":"secret"}, + {"id":"gatling0148","username":"gatling0148","type":"team","team_id":"0148","password":"secret"}, + {"id":"gatling0149","username":"gatling0149","type":"team","team_id":"0149","password":"secret"}, + {"id":"gatling0150","username":"gatling0150","type":"team","team_id":"0150","password":"secret"}, + {"id":"gatling0151","username":"gatling0151","type":"team","team_id":"0151","password":"secret"}, + {"id":"gatling0152","username":"gatling0152","type":"team","team_id":"0152","password":"secret"}, + {"id":"gatling0153","username":"gatling0153","type":"team","team_id":"0153","password":"secret"}, + {"id":"gatling0154","username":"gatling0154","type":"team","team_id":"0154","password":"secret"}, + {"id":"gatling0155","username":"gatling0155","type":"team","team_id":"0155","password":"secret"}, + {"id":"gatling0156","username":"gatling0156","type":"team","team_id":"0156","password":"secret"}, + {"id":"gatling0157","username":"gatling0157","type":"team","team_id":"0157","password":"secret"}, + {"id":"gatling0158","username":"gatling0158","type":"team","team_id":"0158","password":"secret"}, + {"id":"gatling0159","username":"gatling0159","type":"team","team_id":"0159","password":"secret"}, + {"id":"gatling0160","username":"gatling0160","type":"team","team_id":"0160","password":"secret"}, + {"id":"gatling0161","username":"gatling0161","type":"team","team_id":"0161","password":"secret"}, + {"id":"gatling0162","username":"gatling0162","type":"team","team_id":"0162","password":"secret"}, + {"id":"gatling0163","username":"gatling0163","type":"team","team_id":"0163","password":"secret"}, + {"id":"gatling0164","username":"gatling0164","type":"team","team_id":"0164","password":"secret"}, + {"id":"gatling0165","username":"gatling0165","type":"team","team_id":"0165","password":"secret"}, + {"id":"gatling0166","username":"gatling0166","type":"team","team_id":"0166","password":"secret"}, + {"id":"gatling0167","username":"gatling0167","type":"team","team_id":"0167","password":"secret"}, + {"id":"gatling0168","username":"gatling0168","type":"team","team_id":"0168","password":"secret"}, + {"id":"gatling0169","username":"gatling0169","type":"team","team_id":"0169","password":"secret"}, + {"id":"gatling0170","username":"gatling0170","type":"team","team_id":"0170","password":"secret"}, + {"id":"gatling0171","username":"gatling0171","type":"team","team_id":"0171","password":"secret"}, + {"id":"gatling0172","username":"gatling0172","type":"team","team_id":"0172","password":"secret"}, + {"id":"gatling0173","username":"gatling0173","type":"team","team_id":"0173","password":"secret"}, + {"id":"gatling0174","username":"gatling0174","type":"team","team_id":"0174","password":"secret"}, + {"id":"gatling0175","username":"gatling0175","type":"team","team_id":"0175","password":"secret"}, + {"id":"gatling0176","username":"gatling0176","type":"team","team_id":"0176","password":"secret"}, + {"id":"gatling0177","username":"gatling0177","type":"team","team_id":"0177","password":"secret"}, + {"id":"gatling0178","username":"gatling0178","type":"team","team_id":"0178","password":"secret"}, + {"id":"gatling0179","username":"gatling0179","type":"team","team_id":"0179","password":"secret"}, + {"id":"gatling0180","username":"gatling0180","type":"team","team_id":"0180","password":"secret"}, + {"id":"gatling0181","username":"gatling0181","type":"team","team_id":"0181","password":"secret"}, + {"id":"gatling0182","username":"gatling0182","type":"team","team_id":"0182","password":"secret"}, + {"id":"gatling0183","username":"gatling0183","type":"team","team_id":"0183","password":"secret"}, + {"id":"gatling0184","username":"gatling0184","type":"team","team_id":"0184","password":"secret"}, + {"id":"gatling0185","username":"gatling0185","type":"team","team_id":"0185","password":"secret"}, + {"id":"gatling0186","username":"gatling0186","type":"team","team_id":"0186","password":"secret"}, + {"id":"gatling0187","username":"gatling0187","type":"team","team_id":"0187","password":"secret"}, + {"id":"gatling0188","username":"gatling0188","type":"team","team_id":"0188","password":"secret"}, + {"id":"gatling0189","username":"gatling0189","type":"team","team_id":"0189","password":"secret"}, + {"id":"gatling0190","username":"gatling0190","type":"team","team_id":"0190","password":"secret"}, + {"id":"gatling0191","username":"gatling0191","type":"team","team_id":"0191","password":"secret"}, + {"id":"gatling0192","username":"gatling0192","type":"team","team_id":"0192","password":"secret"}, + {"id":"gatling0193","username":"gatling0193","type":"team","team_id":"0193","password":"secret"}, + {"id":"gatling0194","username":"gatling0194","type":"team","team_id":"0194","password":"secret"}, + {"id":"gatling0195","username":"gatling0195","type":"team","team_id":"0195","password":"secret"}, + {"id":"gatling0196","username":"gatling0196","type":"team","team_id":"0196","password":"secret"}, + {"id":"gatling0197","username":"gatling0197","type":"team","team_id":"0197","password":"secret"}, + {"id":"gatling0198","username":"gatling0198","type":"team","team_id":"0198","password":"secret"}, + {"id":"gatling0199","username":"gatling0199","type":"team","team_id":"0199","password":"secret"}, + {"id":"gatling0200","username":"gatling0200","type":"team","team_id":"0200","password":"secret"}, + {"id":"gatling0201","username":"gatling0201","type":"team","team_id":"0201","password":"secret"}, + {"id":"gatling0202","username":"gatling0202","type":"team","team_id":"0202","password":"secret"}, + {"id":"gatling0203","username":"gatling0203","type":"team","team_id":"0203","password":"secret"}, + {"id":"gatling0204","username":"gatling0204","type":"team","team_id":"0204","password":"secret"}, + {"id":"gatling0205","username":"gatling0205","type":"team","team_id":"0205","password":"secret"}, + {"id":"gatling0206","username":"gatling0206","type":"team","team_id":"0206","password":"secret"}, + {"id":"gatling0207","username":"gatling0207","type":"team","team_id":"0207","password":"secret"}, + {"id":"gatling0208","username":"gatling0208","type":"team","team_id":"0208","password":"secret"}, + {"id":"gatling0209","username":"gatling0209","type":"team","team_id":"0209","password":"secret"}, + {"id":"gatling0210","username":"gatling0210","type":"team","team_id":"0210","password":"secret"}, + {"id":"gatling0211","username":"gatling0211","type":"team","team_id":"0211","password":"secret"}, + {"id":"gatling0212","username":"gatling0212","type":"team","team_id":"0212","password":"secret"}, + {"id":"gatling0213","username":"gatling0213","type":"team","team_id":"0213","password":"secret"}, + {"id":"gatling0214","username":"gatling0214","type":"team","team_id":"0214","password":"secret"}, + {"id":"gatling0215","username":"gatling0215","type":"team","team_id":"0215","password":"secret"}, + {"id":"gatling0216","username":"gatling0216","type":"team","team_id":"0216","password":"secret"}, + {"id":"gatling0217","username":"gatling0217","type":"team","team_id":"0217","password":"secret"}, + {"id":"gatling0218","username":"gatling0218","type":"team","team_id":"0218","password":"secret"}, + {"id":"gatling0219","username":"gatling0219","type":"team","team_id":"0219","password":"secret"}, + {"id":"gatling0220","username":"gatling0220","type":"team","team_id":"0220","password":"secret"}, + {"id":"gatling0221","username":"gatling0221","type":"team","team_id":"0221","password":"secret"}, + {"id":"gatling0222","username":"gatling0222","type":"team","team_id":"0222","password":"secret"}, + {"id":"gatling0223","username":"gatling0223","type":"team","team_id":"0223","password":"secret"}, + {"id":"gatling0224","username":"gatling0224","type":"team","team_id":"0224","password":"secret"}, + {"id":"gatling0225","username":"gatling0225","type":"team","team_id":"0225","password":"secret"}, + {"id":"gatling0226","username":"gatling0226","type":"team","team_id":"0226","password":"secret"}, + {"id":"gatling0227","username":"gatling0227","type":"team","team_id":"0227","password":"secret"}, + {"id":"gatling0228","username":"gatling0228","type":"team","team_id":"0228","password":"secret"}, + {"id":"gatling0229","username":"gatling0229","type":"team","team_id":"0229","password":"secret"}, + {"id":"gatling0230","username":"gatling0230","type":"team","team_id":"0230","password":"secret"}, + {"id":"gatling0231","username":"gatling0231","type":"team","team_id":"0231","password":"secret"}, + {"id":"gatling0232","username":"gatling0232","type":"team","team_id":"0232","password":"secret"}, + {"id":"gatling0233","username":"gatling0233","type":"team","team_id":"0233","password":"secret"}, + {"id":"gatling0234","username":"gatling0234","type":"team","team_id":"0234","password":"secret"}, + {"id":"gatling0235","username":"gatling0235","type":"team","team_id":"0235","password":"secret"}, + {"id":"gatling0236","username":"gatling0236","type":"team","team_id":"0236","password":"secret"}, + {"id":"gatling0237","username":"gatling0237","type":"team","team_id":"0237","password":"secret"}, + {"id":"gatling0238","username":"gatling0238","type":"team","team_id":"0238","password":"secret"}, + {"id":"gatling0239","username":"gatling0239","type":"team","team_id":"0239","password":"secret"}, + {"id":"gatling0240","username":"gatling0240","type":"team","team_id":"0240","password":"secret"}, + {"id":"gatling0241","username":"gatling0241","type":"team","team_id":"0241","password":"secret"}, + {"id":"gatling0242","username":"gatling0242","type":"team","team_id":"0242","password":"secret"}, + {"id":"gatling0243","username":"gatling0243","type":"team","team_id":"0243","password":"secret"}, + {"id":"gatling0244","username":"gatling0244","type":"team","team_id":"0244","password":"secret"}, + {"id":"gatling0245","username":"gatling0245","type":"team","team_id":"0245","password":"secret"}, + {"id":"gatling0246","username":"gatling0246","type":"team","team_id":"0246","password":"secret"}, + {"id":"gatling0247","username":"gatling0247","type":"team","team_id":"0247","password":"secret"}, + {"id":"gatling0248","username":"gatling0248","type":"team","team_id":"0248","password":"secret"}, + {"id":"gatling0249","username":"gatling0249","type":"team","team_id":"0249","password":"secret"}, + {"id":"gatling0250","username":"gatling0250","type":"team","team_id":"0250","password":"secret"}, + + {"id":"gatlingjury1000","username":"gatlingjury1000","type":"judge","team_id":"1000","password":"secret"}, + {"id":"gatlingjury1001","username":"gatlingjury1001","type":"judge","team_id":"1001","password":"secret"}, + {"id":"gatlingjury1002","username":"gatlingjury1002","type":"judge","team_id":"1002","password":"secret"}, + {"id":"gatlingjury1003","username":"gatlingjury1003","type":"judge","team_id":"1003","password":"secret"}, + {"id":"gatlingjury1004","username":"gatlingjury1004","type":"judge","team_id":"1004","password":"secret"}, + {"id":"gatlingjury1005","username":"gatlingjury1005","type":"judge","team_id":"1005","password":"secret"}, + {"id":"gatlingjury1006","username":"gatlingjury1006","type":"judge","team_id":"1006","password":"secret"}, + {"id":"gatlingjury1007","username":"gatlingjury1007","type":"judge","team_id":"1007","password":"secret"}, + {"id":"gatlingjury1008","username":"gatlingjury1008","type":"judge","team_id":"1008","password":"secret"}, + {"id":"gatlingjury1009","username":"gatlingjury1009","type":"judge","team_id":"1009","password":"secret"}, + {"id":"gatlingjury1010","username":"gatlingjury1010","type":"judge","team_id":"1010","password":"secret"}, + {"id":"gatlingjury1011","username":"gatlingjury1011","type":"judge","team_id":"1011","password":"secret"}, + {"id":"gatlingjury1012","username":"gatlingjury1012","type":"judge","team_id":"1012","password":"secret"}, + {"id":"gatlingjury1013","username":"gatlingjury1013","type":"judge","team_id":"1013","password":"secret"}, + {"id":"gatlingjury1014","username":"gatlingjury1014","type":"judge","team_id":"1014","password":"secret"}, + {"id":"gatlingjury1015","username":"gatlingjury1015","type":"judge","team_id":"1015","password":"secret"}, + {"id":"gatlingjury1016","username":"gatlingjury1016","type":"judge","team_id":"1016","password":"secret"}, + {"id":"gatlingjury1017","username":"gatlingjury1017","type":"judge","team_id":"1017","password":"secret"}, + {"id":"gatlingjury1018","username":"gatlingjury1018","type":"judge","team_id":"1018","password":"secret"}, + {"id":"gatlingjury1019","username":"gatlingjury1019","type":"judge","team_id":"1019","password":"secret"}, + {"id":"gatlingjury1020","username":"gatlingjury1020","type":"judge","team_id":"1020","password":"secret"}, + {"id":"gatlingjury1021","username":"gatlingjury1021","type":"judge","team_id":"1021","password":"secret"}, + {"id":"gatlingjury1022","username":"gatlingjury1022","type":"judge","team_id":"1022","password":"secret"}, + {"id":"gatlingjury1023","username":"gatlingjury1023","type":"judge","team_id":"1023","password":"secret"}, + {"id":"gatlingjury1024","username":"gatlingjury1024","type":"judge","team_id":"1024","password":"secret"}, + {"id":"gatlingjury1025","username":"gatlingjury1025","type":"judge","team_id":"1025","password":"secret"}, + {"id":"gatlingjury1026","username":"gatlingjury1026","type":"judge","team_id":"1026","password":"secret"}, + {"id":"gatlingjury1027","username":"gatlingjury1027","type":"judge","team_id":"1027","password":"secret"}, + {"id":"gatlingjury1028","username":"gatlingjury1028","type":"judge","team_id":"1028","password":"secret"}, + {"id":"gatlingjury1029","username":"gatlingjury1029","type":"judge","team_id":"1029","password":"secret"}, + {"id":"gatlingjury1030","username":"gatlingjury1030","type":"judge","team_id":"1030","password":"secret"}, + {"id":"gatlingjury1031","username":"gatlingjury1031","type":"judge","team_id":"1031","password":"secret"}, + {"id":"gatlingjury1032","username":"gatlingjury1032","type":"judge","team_id":"1032","password":"secret"}, + {"id":"gatlingjury1033","username":"gatlingjury1033","type":"judge","team_id":"1033","password":"secret"}, + {"id":"gatlingjury1034","username":"gatlingjury1034","type":"judge","team_id":"1034","password":"secret"}, + {"id":"gatlingjury1035","username":"gatlingjury1035","type":"judge","team_id":"1035","password":"secret"}, + {"id":"gatlingjury1036","username":"gatlingjury1036","type":"judge","team_id":"1036","password":"secret"}, + {"id":"gatlingjury1037","username":"gatlingjury1037","type":"judge","team_id":"1037","password":"secret"}, + {"id":"gatlingjury1038","username":"gatlingjury1038","type":"judge","team_id":"1038","password":"secret"}, + {"id":"gatlingjury1039","username":"gatlingjury1039","type":"judge","team_id":"1039","password":"secret"}, + {"id":"gatlingjury1040","username":"gatlingjury1040","type":"judge","team_id":"1040","password":"secret"}, + {"id":"gatlingjury1041","username":"gatlingjury1041","type":"judge","team_id":"1041","password":"secret"}, + {"id":"gatlingjury1042","username":"gatlingjury1042","type":"judge","team_id":"1042","password":"secret"}, + {"id":"gatlingjury1043","username":"gatlingjury1043","type":"judge","team_id":"1043","password":"secret"}, + {"id":"gatlingjury1044","username":"gatlingjury1044","type":"judge","team_id":"1044","password":"secret"}, + {"id":"gatlingjury1045","username":"gatlingjury1045","type":"judge","team_id":"1045","password":"secret"}, + {"id":"gatlingjury1046","username":"gatlingjury1046","type":"judge","team_id":"1046","password":"secret"}, + {"id":"gatlingjury1047","username":"gatlingjury1047","type":"judge","team_id":"1047","password":"secret"}, + {"id":"gatlingjury1048","username":"gatlingjury1048","type":"judge","team_id":"1048","password":"secret"}, + {"id":"gatlingjury1049","username":"gatlingjury1049","type":"judge","team_id":"1049","password":"secret"} +] diff --git a/seeding/groups.json b/seeding/groups.json new file mode 100644 index 0000000..62b957f --- /dev/null +++ b/seeding/groups.json @@ -0,0 +1,3 @@ +[ + {"id":"4242","name":"Gatling Accounts"} +] diff --git a/seeding/organizations.json b/seeding/organizations.json new file mode 100644 index 0000000..e313e53 --- /dev/null +++ b/seeding/organizations.json @@ -0,0 +1,3 @@ +[ + {"id":"4242","name":"Gatling Organization","formal_name":"Gatling Organization to associate"} +] diff --git a/seeding/seed.sh b/seeding/seed.sh new file mode 100644 index 0000000..120db37 --- /dev/null +++ b/seeding/seed.sh @@ -0,0 +1,31 @@ +USERNAME=admin +PASSWORD=real_secret_password +DJ_URL=http://localhost/domjudges + +# Set data source to "config data external" so that importing things works properly +# http -a "$USERNAME":"$PASSWORD" -f PUT $DJ_URL/api/v4/config data_source=1 + +# Import a gatling organization(affiliation) and group(category) +http -a "$USERNAME":"$PASSWORD" -f POST $DJ_URL/api/v4/users/organizations json@seeding/organizations.json +http -a "$USERNAME":"$PASSWORD" -f POST $DJ_URL/api/v4/users/groups json@seeding/groups.json + +# Load some accounts/teams +http -a "$USERNAME":"$PASSWORD" -f POST $DJ_URL/api/v4/users/accounts json@seeding/accounts.json +http -a "$USERNAME":"$PASSWORD" -f POST $DJ_URL/api/v4/users/teams json@seeding/teams.json + + +# The accounts/teams just need to be part of some contest, with a hello world problem. The specific name/etc is not important. +# Create the gatling contest, starting now and running for 9999 hours (It will be public, since there's no exposed api to make it private :sadface:) +cat > seeding/contest.json <"1"))) - .exec(Jury.create_contest("gatling","Gatling Test Contest")) - .exec(Jury.enable_language("c#", "csharp", List("csharp","cs") )) - .exec(Jury.enable_language("Ada", "adb", List("adb","ads") )) - .exec(Jury.enable_language("Fortran", "f95", List("f95", "f90") )) - .exec(Jury.enable_language("Haskell", "hs", List("hs", "lhs") )) - .exec(Jury.enable_language("Lua", "lua", List("lua") )) - .exec(Jury.enable_language("Pascal", "pas", List("pas", "p") )) - .exec(Jury.enable_language("Python2", "py2", List("py2", "py") )) - .exec(Jury.enable_language("Python3", "py3", List("py3") )) - .exec(Jury.enable_language("Ruby", "rb", List("rb") )) - .exec(Jury.enable_language("Scala", "scala", List("scala") )) - .exec(Jury.enable_language("Kotlin", "kt", List("kt") )) - .exec(Jury.upload_problem("hello-testcase.zip")) - -setUp(scn.inject(atOnceUsers(1))).protocols(httpProtocol) -} diff --git a/simulations/domjudge/Common.scala b/simulations/domjudge/Common.scala deleted file mode 100644 index 100220b..0000000 --- a/simulations/domjudge/Common.scala +++ /dev/null @@ -1,155 +0,0 @@ -package domjudge - -import io.gatling.core.structure.ChainBuilder -import io.gatling.core.session.Expression -import io.gatling.core.Predef._ -import io.gatling.http.Predef._ - -import java.util.Calendar -import java.text.SimpleDateFormat - - -// Call this like one of the following: -// exec(User.login(session => session("user").as[String])) -// exec(User.login("username")) -// Password is optional, can be passed in the same way however: -// exec(User.login(session => session("user").as[String]), session => session("pass").as[String])) -// exec(User.login("username", "password")) -object User { - def login(user: Expression[String], pass: Expression[String] = null): ChainBuilder = { - val realpass = pass match { case a:Expression[String] => a; case _ => user } - - return exec( - http("Login page get csrf") - .get("/login") - .check( - regex("""""") - .find - .saveAs("csrftoken") - )) - .exec(http("Login Request") - .post("/login") - .formParam("_username", session => user(session)) - .formParam("_password", session => realpass(session)) - .formParam("_csrf_token", "${csrftoken}") - ) - } - - def register(user: Expression[String], pass: Expression[String] = null): ChainBuilder = { - val realpass = pass match { case a:Expression[String] => a; case _ => user } - - return exec( - http("Registration page get csrf") - .get("/register") - .check( - regex(""" user(session)) - .formParam("user_registration[name]", session => user(session)) // todo make this say "Gatling ###" - .formParam("user_registration[teamName]", session => user(session)) - .formParam("user_registration[plainPassword][first]", session => realpass(session)) - .formParam("user_registration[plainPassword][second]", session => realpass(session)) - .formParam("user_registration[existingAffiliation]", "1") - .formParam("user_registration[_token]", "${csrftoken}") - ) - } -} - -object Team { - def _submit(langid: String, filename: String) = - exec( - http("Get submit solution form") - .get("/team/submit") - .check( - regex("""hello""") - .saveAs("problem_id") - )) - .exec(http("Submit Solution ${langid}") - .post("/team/submit") - .formParam("submit_problem[_token]","${csrftoken}") - .formParam("submit_problem[problem]","${problem_id}") - .formParam("submit_problem[language]", langid) - .formUpload("submit_problem[code][]", filename) - .formParam("submit", "")) - def _submit_with_entrypoint(langid: String, filename: String, entry_point: String) = - exec( - http("Get submit solution form") - .get("/team/submit") - .check( - regex("""hello""") - .saveAs("problem_id") - )) - .exec(http("Submit Solution ${langid}") - .post("/team/submit") - .formParam("submit_problem[_token]","${csrftoken}") - .formParam("submit_problem[problem]","${problem_id}") - .formParam("submit_problem[language]", langid) - .formParam("submit_problem[entry_point]", entry_point) - .formUpload("submit_problem[code][]", filename) - .formParam("submit", "")) - - val submit_java = exec(_submit("java", "test-hello.java")) - val submit_c = exec(_submit("c", "test-hello.c")) - val submit_hs = exec(_submit("hs", "test-hello.hs")) - val submit_lua = exec(_submit("lua", "test-hello.lua")) - val submit_js = exec(_submit("js", "test-hello.js")) - val submit_csharp = exec(_submit("csharp", "test-hello.cs")) - val submit_py2 = exec(_submit("py2", "test-hello.py2")) - val submit_py3 = exec(_submit("py3", "test-hello.py3")) - val submit_nonewline = exec(_submit("c", "test-output-nonewline.c")) - val submit_kt = exec(_submit_with_entrypoint("kt", "test-hello.kt", "Test_helloKt")) - def requestclarification() = - exec( - http("Get request clarification form") - .get("/team/clarifications/add") - .check( - regex("""General""").find.saveAs("clarification_subject") - )) - .exec(http("Request Clarification") - .post("/team/clarifications/add") - .formParam("team_clarification[recipient]", "dummy") - .formParam("team_clarification[subject]", "${clarification_subject}") - .formParam("team_clarification[message]", "${user} needs help") - .formParam("team_clarification[_token]", "${csrftoken}") - .formParam("submit", "") - ) - - val teampage = exec(http("Team Page").get("/team/") - .check( - regex("""(?s).*""").find.saveAs("team_id") - )) - val teamdetails = exec(http("Team Details").get("/team/team/${team_id}")) - val teamscoreboard = exec(http("Team Scoreboard").get("/team/scoreboard")) -} - -object Spectator { - def getscoreboard = exec(http("Public Scoreboard Request") - .get("/public/")) - // A spectator will check the scoreboard every 30 seconds for a set number of minutes - def monitor_scoreboard(minutes: Int) = repeat(minutes*2, "n") { - exec(getscoreboard).pause(30) - } -} - -object Jury { - - // TODO: add jury members browsing around/answering clarifications/etc - // def view_submissions = ... - -} diff --git a/simulations/domjudge/ContestSimulation.scala b/simulations/domjudge/ContestSimulation.scala deleted file mode 100644 index d69cb95..0000000 --- a/simulations/domjudge/ContestSimulation.scala +++ /dev/null @@ -1,112 +0,0 @@ -package domjudge -import scala.concurrent.duration._ - -import io.gatling.core.Predef._ -import io.gatling.http.Predef._ -import io.gatling.jdbc.Predef._ -import scala.util.Random - -import User._ -import Team._ -import Spectator._ - -class ContestSimulation extends Simulation { - // Configure the base url, and other global options related to all requests - val httpProtocol = http - .baseUrl(System.getProperty("baseurl")) - // This makes it load dependent resources: things like images, javascript, css, etc - .inferHtmlResources() - - // Scenario that just grabs the public scoreboard every 30 seconds, some number of times - // This will run for 10 minutes per "user". The scoreboard page autorefreshes every 30s, - // so this is a good approximation of their activity. - val spectatorScenario = scenario("PublicScoreboards").exec(Spectator.monitor_scoreboard(10)) - - // Generate an infinite number of users, starting from gatling000000 - var feeder = Iterator.from(0).map(i => Map("user" -> f"gatling$i%05d")) - - // This scenario pretends to be a team. It takes around 3 minutes, and makes ~250 requests(including dependent resources) - // It tries to be similar to what a team might do, load the team page, submit clarifications, submit problems, load the scoreboard, etc. - val teamScenario = scenario("TeamExample") - .feed(feeder) - // Load the public scoreboard, then register/login - .exec(Spectator.getscoreboard).pause(1) - // Try a few times to get us registered/logged in, if it fails the user is done - .tryMax(5) { - exec(User.register(session => session("user").as[String])) - .exec(User.login(session => session("user").as[String])).pause(2) - } - .exitHereIfFailed - - // Make a submission, view team information, check scoreboard - .exec(Team.teampage).pause(5) - .exec(Team.submit_java).pause(10) - .exec(Team.teamscoreboard).pause(10) - - // Do some more team like stuff - .exec(Team.teamdetails).pause(5) - .exec(Team.teampage).pause(7) - .exec(Team.teamscoreboard).pause(9) - .exec(Team.teampage).pause(3) - - // Submit a clarification and then "check" it - .exec(Team.requestclarification).pause(6) - .exec(Team.teampage).pause(12) - - // Make some submissions, and check the team page periodically - .exec(Team.teampage).pause(3) - .exec(Team.teamscoreboard).pause(3) - .exec(Team.submit_c).pause(15) - .exec(Team.teampage).pause(6) - .exec(Team.teampage).pause(14) - .exec(Team.submit_py2).pause(8) - .exec(Team.submit_hs).pause(5) - .exec(Team.submit_kt).pause(5) - .exec(Team.teampage).pause(3) - .exec(Team.teampage).pause(4) - .exec(Team.teamscoreboard).pause(8) - .exec(Team.teampage).pause(2) - .exec(Team.submit_nonewline).pause(11) - .exec(Team.teampage).pause(16) - .exec(Team.teampage).pause(5) - - setUp(teamScenario.inject( - atOnceUsers(1) // start with 1 users - // atOnceUsers(100) // start with 100 users - //constantUsersPerSec(5) during (30 seconds) randomized // gets to ~150 users in 30seconds - // constantUsersPerSec(18) during (60 seconds) randomized // gets to ~1000(ish) users in 60seconds - //rampUsers(500) over (60 seconds) - - // Use with the throttle commands below - //constantUsersPerSec(30) during (45 seconds) // 1350 users? - ), spectatorScenario.inject(atOnceUsers(1))) - /*.throttle( - jumpToRps(20).holdFor(2 minutes) - )*/ - .maxDuration(6 minutes) - .throttle( - // reachRps(1) in (30 seconds), - // reachRps(5) in (30 seconds), - // reachRps(10) in (30 seconds), - // reachRps(25) in (30 seconds), - reachRps(50) in (30 seconds), - holdFor(1 minute), - reachRps(100) in (30 seconds), - // holdFor(1 minute), - // reachRps(150) in (30 seconds), - // holdFor(1 minute), - // reachRps(200) in (30 seconds), - // holdFor(2 minutes) - // reachRps(250) in (30 seconds), - // holdFor(1 minute), - // reachRps(300) in (30 seconds), - // holdFor(1 minute), - // reachRps(400) in (30 seconds), - // holdFor(1 minute), - // reachRps(500) in (30 seconds), - // holdFor(5 minutes) - ) - .protocols(httpProtocol) - .pauses(uniformPausesPlusOrMinusPercentage(25)) // adjust pauses by 25percent either way - -} From 08bcd616c57decc2810c004dda91163e299f8646 Mon Sep 17 00:00:00 2001 From: Keith Johnson Date: Mon, 7 Nov 2022 22:28:43 -0500 Subject: [PATCH 2/2] Add contest simulation (in java!) --- simulations/ContestSimulation.java | 192 +++++++++++++++++++++++++++++ 1 file changed, 192 insertions(+) create mode 100644 simulations/ContestSimulation.java diff --git a/simulations/ContestSimulation.java b/simulations/ContestSimulation.java new file mode 100644 index 0000000..08deb93 --- /dev/null +++ b/simulations/ContestSimulation.java @@ -0,0 +1,192 @@ +package domjudge; + +import io.gatling.javaapi.core.*; +import io.gatling.javaapi.http.*; +import java.time.Duration; +import java.io.*; +import java.util.*; +import java.util.stream.Stream; +import java.util.function.*; +import java.util.concurrent.atomic.AtomicInteger; + +import static io.gatling.javaapi.core.CoreDsl.*; +import static io.gatling.javaapi.http.HttpDsl.*; + + +public class ContestSimulation extends Simulation { + // A fixed password (see seeding/accounts.json) + String PASSWORD="secret"; + + // How many "actions" a team will take (actions are things like submitting, requesting clarification, viewing a scoreboard) + int NUM_TEAM_ACTIONS = 5; + + // Maximum amount of time the scenario can run + int MAX_MINUTES = 5; + + private ChainBuilder login() { + return exec( + http("Login page get csrf") + .get("/login") + .check( + css("input[name='_csrf_token']", "value") + .find() + .saveAs("csrftoken") + )) + .exec(http("Login Request") + .post("/login") + .formParam("_username", "#{user}") + .formParam("_password", PASSWORD) + .formParam("_csrf_token", "#{csrftoken}") + ); + } + + private ChainBuilder submit(String langid, String filename) { + return exec( + http("Get submit form csrf from team page") + .get("/team/submit") + .check( + css("input[id='submit_problem__token']", "value").find() + .saveAs("csrftoken"), + regex("