Skip to content

Commit

Permalink
Make parallel unit test more robust (#623)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen authored Jan 6, 2025
1 parent e6f425e commit b1bb9f3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion R/test.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ example_url <- function() {
env_cache(the, "test_app",
webfakes::new_app_process(
app,
opts = webfakes::server_opts(num_threads = 2)
opts = webfakes::server_opts(num_threads = 6, enable_keep_alive = TRUE)
)
)
the$test_app$url()
Expand Down
8 changes: 2 additions & 6 deletions tests/testthat/test-multi-req.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,9 @@ test_that("correctly prepares request", {
})

test_that("requests happen in parallel", {
# GHA MacOS builder seems to be very slow
skip_if(
isTRUE(as.logical(Sys.getenv("CI", "false"))) &&
Sys.info()[["sysname"]] == "Darwin"
)

# test works best if webfakes has ample threads and keepalive
reqs <- list2(
request_test("/delay/:secs", secs = 0),
request_test("/delay/:secs", secs = 0.25),
request_test("/delay/:secs", secs = 0.25),
request_test("/delay/:secs", secs = 0.25),
Expand Down

0 comments on commit b1bb9f3

Please sign in to comment.