Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP/DNM - example for tsv file usage #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions accounts.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
user pass
team1 pass1
team2 pass2
7 changes: 4 additions & 3 deletions simulations/domjudge/ContestSimulation.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ class ContestSimulation extends Simulation {
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"))
// var feeder = Iterator.from(0).map(i => Map("user" -> f"gatling$i%05d"))
var feeder = tsv("accounts.tsv").eager.random

// 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.
Expand All @@ -33,8 +34,8 @@ class ContestSimulation extends Simulation {
.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)
exec(User.register(session => session("user").as[String], session => session("pass").as[String]))
.exec(User.login(session => session("user").as[String], session => session("pass").as[String])).pause(2)
}
.exitHereIfFailed

Expand Down