Skip to content

Commit

Permalink
add testing code for shinycannon and shinyloadtest
Browse files Browse the repository at this point in the history
  • Loading branch information
rpodcast committed Sep 2, 2023
1 parent 7f849ca commit eb1d8f6
Showing 1 changed file with 79 additions and 1 deletion.
80 changes: 79 additions & 1 deletion R/test_dependencies.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,82 @@ task <- controller$pop()
task$result[[1]]

# test basic shinyloadtest ----
shinyloadtest::record_session('https://rsc.training.rstudio.com/content/4d9124a0-158b-4bd9-9b65-07b877db0906')
library(shinyloadtest)
library(sys)


# define paths and constants
app_link <- "https://rsc.training.rstudio.com/bricktest/"
recording_file <- "R/recording.log"

shinyloadtest::record_session(
app_link,
output_file = "R/recording.log",
connect_api_key = Sys.getenv("RSCONNECT_KEY")
)

# use the exec_wait function from sys
shinycannon_path <- "utils/shinycannon-1.1.3-dd43f6b.jar"

# baseline run
exec_wait(
cmd = "java",
args = c(
"-jar",
shinycannon_path,
recording_file,
app_link,
"--workers",
1,
"--loaded-duration-minutes",
3,
"--output-dir",
"R/run1",
"--overwrite-output"
)
)

# comparison run (3 workers)
exec_wait(
cmd = "java",
args = c(
"-jar",
shinycannon_path,
recording_file,
app_link,
"--workers",
3,
"--loaded-duration-minutes",
3,
"--output-dir",
"R/run3",
"--overwrite-output"
)
)

# comparison run (5 workers)
exec_wait(
cmd = "java",
args = c(
"-jar",
shinycannon_path,
recording_file,
app_link,
"--workers",
5,
"--loaded-duration-minutes",
3,
"--output-dir",
"R/run5",
"--overwrite-output"
)
)

# analyze runs
df <- load_runs("Run 1" = "R/run1", "Run 3" = "R/run3", "Run 5" = "R/run5")

shinyloadtest_report(df, "R/report1.html")

# run following command in terminal
# java -jar utils/shinycannon-1.1.3-dd43f6b.jar -h
# java -jar utils/shinycannon-1.1.3-dd43f6b.jar R/recording.log https://rsc.training.rstudio.com/bricktest/ --workers 1 --loaded-duration-minutes 5 --output-dir R/run1 --overwrite-output

0 comments on commit eb1d8f6

Please sign in to comment.