From b1bb9f3ca3ca1ba71fd7ac513dd4d9313e709940 Mon Sep 17 00:00:00 2001 From: Jeroen Ooms Date: Mon, 6 Jan 2025 14:04:23 +0100 Subject: [PATCH] Make parallel unit test more robust (#623) --- R/test.R | 2 +- tests/testthat/test-multi-req.R | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/R/test.R b/R/test.R index 9f973db1..7622338e 100644 --- a/R/test.R +++ b/R/test.R @@ -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() diff --git a/tests/testthat/test-multi-req.R b/tests/testthat/test-multi-req.R index 9b637ec8..1650e026 100644 --- a/tests/testthat/test-multi-req.R +++ b/tests/testthat/test-multi-req.R @@ -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),