-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
57 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,38 @@ | ||
#!/usr/bin/env -S scala-cli | ||
//> using dep com.lihaoyi::os-lib:0.10.2 | ||
|
||
// download Gatling Highcharts Bundle | ||
// curl -O https://repo1.maven.org/maven2/io/gatling/highcharts/gatling-charts-highcharts-bundle/3.10.5/gatling-charts-highcharts-bundle-3.10.5-bundle.zip | ||
println("Downloading Gatling 3.10.5 to directory ./gatling") | ||
println() | ||
|
||
val url = | ||
"https://repo1.maven.org/maven2/io/gatling/highcharts/gatling-charts-highcharts-bundle/3.10.5/gatling-charts-highcharts-bundle-3.10.5-bundle.zip" | ||
os.proc("curl", "-O", url).call() | ||
|
||
// unzip, cleanup and rename folder | ||
// unzip gatling-charts-highcharts-bundle-3.10.5-bundle.zip | ||
// rm gatling-charts-highcharts-bundle-3.10.5-bundle.zip | ||
// mv gatling-charts-highcharts-bundle-3.10.5 gatling | ||
os.proc("unzip", "gatling-charts-highcharts-bundle-3.10.5-bundle.zip").call() | ||
os.proc("rm", "gatling-charts-highcharts-bundle-3.10.5-bundle.zip").call() | ||
os.proc("mv", "gatling-charts-highcharts-bundle-3.10.5", "gatling").call() | ||
|
||
// echo "installed gatling 3.10.5 to directory ./gatling" | ||
println() | ||
println("Installed gatling 3.10.5 to directory ./gatling") | ||
println() | ||
|
||
// There is a simulation (written in Java) included by default. Remove that. | ||
// rm -rf ./gatling/user-files/simulations/* | ||
// echo "removed included-by-default Java simulations in ./gatling/user-files/simulations" | ||
val simDir = "./gatling/user-files/simulations" | ||
os.proc("rm", "-rf", simDir + "/computerdatabase").call() | ||
println("Removed included-by-default Java simulations in: " + simDir) | ||
println() | ||
|
||
// Place our simulation there. | ||
// cp src/main/scala/ch05/examples/loadSimulation.scala ./gatling/user-files/simulations/ | ||
// echo "copied ch05 load simulation into ./gatling/user-files/simulations/" | ||
// echo "now start the http server in another Terminal, and then run the simulation with:" | ||
// echo "./runGatling.sh" | ||
os.proc( | ||
"cp", | ||
"src/main/scala/ch05/examples/loadSimulation.scala", | ||
"./gatling/user-files/simulations/" | ||
).call() | ||
println("Copied ch05 load simulation into ./gatling/user-files/simulations/") | ||
println() | ||
|
||
println("Now start the Http server in another Terminal,") | ||
println("and then run the simulation with:") | ||
println("./runGatling.sc") |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,34 @@ | ||
#!/usr/bin/env -S scala-cli | ||
//> using dep com.lihaoyi::os-lib:0.10.2 | ||
|
||
// set environment variables | ||
// export GATLING_URL=http://localhost:8080 | ||
// export GATLING_USERS=1000 | ||
// export GATLING_REQUESTS=50000 | ||
// export GATLING_RAMP_TIME=0 | ||
// echo "Finished setting up environment variables for Gatling simulation." | ||
val gatlingEnv = Map( | ||
"GATLING_URL" -> "http://localhost:8080", | ||
"GATLING_USERS" -> "1000", | ||
"GATLING_REQUESTS" -> "50000", | ||
"GATLING_RAMP_TIME" -> "0" | ||
) | ||
println("Finished setting up environment variables for Gatling simulation.") | ||
println() | ||
|
||
// interactively compile and run the simulation | ||
// echo "Now running the Gatling binary:" | ||
// ./gatling/bin/gatling.sh | ||
println("Now running the Gatling binary:") | ||
println() | ||
|
||
val sub = os | ||
.proc("sh", os.pwd / "gatling" / "bin" / "gatling.sh") | ||
.spawn( | ||
env = gatlingEnv, | ||
stdout = os.ProcessOutput.Readlines(println) // show script's output. | ||
) | ||
|
||
// Simulate the interactivity of the script here: | ||
sub.waitFor(2000L) // wait for Gatling script to start and give us a prompt | ||
println(">>>>> Choosing option [1] to run locally!") // show input | ||
sub.stdin.writeLine("1") // run simulation locally | ||
sub.stdin.flush() // send input | ||
sub.waitFor(8000L) // wait for Gatling to check for updates | ||
println(">>>>> Providing optional name: testSim") // show input | ||
sub.stdin.writeLine("testSim") // give optional simulation name | ||
sub.stdin.flush() // send input | ||
sub.waitFor() // wait for simulation to fully run and finish. |
This file was deleted.
Oops, something went wrong.