diff --git a/.github/workflows/r-cmd-check.yml b/.github/workflows/r-cmd-check.yml index 14883cc..0ac9afa 100644 --- a/.github/workflows/r-cmd-check.yml +++ b/.github/workflows/r-cmd-check.yml @@ -57,3 +57,5 @@ jobs: limit-access-to-actor: true - uses: r-lib/actions/check-r-package@v2 + with: + args: 'c("--no-manual")' # "--as-cran" prevents to start external processes diff --git a/tests/testthat/test-Rush.R b/tests/testthat/test-Rush.R index 650d188..f136f05 100644 --- a/tests/testthat/test-Rush.R +++ b/tests/testthat/test-Rush.R @@ -1,8 +1,7 @@ # start workers with processx -------------------------------------------------- test_that("constructing a rush controller works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = Rush$new(network_id = "test-rush", config = config) @@ -13,8 +12,7 @@ test_that("constructing a rush controller works", { }) test_that("workers are started", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = Rush$new(network_id = "test-rush", config = config) @@ -41,8 +39,7 @@ test_that("workers are started", { }) test_that("workers are started with a heartbeat", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = Rush$new(network_id = "test-rush", config = config) @@ -58,8 +55,7 @@ test_that("workers are started with a heartbeat", { }) test_that("additional workers are started", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = Rush$new(network_id = "test-rush", config = config) @@ -85,8 +81,7 @@ test_that("additional workers are started", { }) test_that("packages are available on the worker", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = Rush$new(network_id = "test-rush", config = config) @@ -104,8 +99,7 @@ test_that("packages are available on the worker", { }) test_that("globals are available on the worker", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = Rush$new(network_id = "test-rush", config = config) @@ -125,8 +119,7 @@ test_that("globals are available on the worker", { }) test_that("named globals are available on the worker", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = Rush$new(network_id = "test-rush", config = config) @@ -148,8 +141,7 @@ test_that("named globals are available on the worker", { # start workers with script ---------------------------------------------------- test_that("worker can be started with script", { - skip_on_cran() - skip_on_ci() + skip_if(TRUE) set.seed(1) # make log messages reproducible @@ -171,8 +163,7 @@ test_that("worker can be started with script", { }) test_that("a remote worker is started", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() fun = function(x1, x2, ...) list(y = x1 + x2) @@ -188,8 +179,7 @@ test_that("a remote worker is started", { # stop workers ----------------------------------------------------------------- test_that("a worker is terminated", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = Rush$new(network_id = "test-rush", config = config) @@ -219,8 +209,7 @@ test_that("a worker is terminated", { }) test_that("a local worker is killed", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = Rush$new(network_id = "test-rush", config = config) @@ -250,8 +239,7 @@ test_that("a local worker is killed", { }) test_that("a remote worker is killed via the heartbeat", { - skip_on_cran() - skip_on_ci() + skip_on_os("windows") config = start_flush_redis() @@ -286,8 +274,7 @@ test_that("a remote worker is killed via the heartbeat", { # low level read and write ----------------------------------------------------- test_that("reading and writing a hash works with flatten", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = RushWorker$new(network_id = "test-rush", config = config, host = "local") @@ -314,8 +301,7 @@ test_that("reading and writing a hash works with flatten", { }) test_that("reading and writing a hash works without flatten", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = Rush$new(network_id = "test-rush", config = config) @@ -342,8 +328,7 @@ test_that("reading and writing a hash works without flatten", { }) test_that("reading and writing hashes works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = RushWorker$new(network_id = "test-rush", config = config, host = "local") @@ -382,8 +367,7 @@ test_that("reading and writing hashes works", { }) test_that("writing hashes to specific keys works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = RushWorker$new(network_id = "test-rush", config = config, host = "local") @@ -405,8 +389,7 @@ test_that("writing hashes to specific keys works", { test_that("writing list columns works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = RushWorker$new(network_id = "test-rush", config = config, host = "local") @@ -437,8 +420,7 @@ test_that("writing list columns works", { # task evaluation -------------------------------------------------------------- test_that("evaluating a task works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = Rush$new(network_id = "test-rush", config = config) @@ -476,8 +458,7 @@ test_that("evaluating a task works", { }) test_that("evaluating tasks works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = Rush$new(network_id = "test-rush", config = config) @@ -515,8 +496,7 @@ test_that("evaluating tasks works", { }) test_that("caching results works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = Rush$new(network_id = "test-rush", config = config) @@ -553,8 +533,7 @@ test_that("caching results works", { # segfault detection ----------------------------------------------------------- test_that("a segfault on a local worker is detected", { - skip_on_cran() - skip_on_ci() + skip_if(TRUE) # does not work in testthat on environment config = start_flush_redis() @@ -575,8 +554,7 @@ test_that("a segfault on a local worker is detected", { }) test_that("a segfault on a worker is detected via the heartbeat", { - skip_on_cran() - skip_on_ci() + skip_if(TRUE) # does not work in testthat on environment config = start_flush_redis() @@ -601,8 +579,7 @@ test_that("a segfault on a worker is detected via the heartbeat", { # fault detection -------------------------------------------------------------- test_that("a simple error is catched", { - skip_on_cran() - skip_on_ci() + skip_if(TRUE) # does not work in testthat on environment config = start_flush_redis() @@ -649,8 +626,7 @@ test_that("a simple error is catched", { }) test_that("a lost task is detected", { - skip_on_cran() - skip_on_ci() + skip_if(TRUE) # does not work in testthat on environment config = start_flush_redis() @@ -697,8 +673,7 @@ test_that("a lost task is detected", { }) test_that("a lost task is detected when waiting", { - skip_on_cran() - skip_on_ci() + skip_if(TRUE) # does not work in testthat on environment config = start_flush_redis() @@ -744,8 +719,7 @@ test_that("a lost task is detected when waiting", { # restart workers -------------------------------------------------------------- test_that("restarting a worker works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = Rush$new(network_id = "test-rush", config = config) @@ -766,8 +740,7 @@ test_that("restarting a worker works", { }) test_that("restarting a worker kills the worker", { - skip_on_cran() - skip_on_ci() + skip_on_windows() config = start_flush_redis() @@ -789,8 +762,7 @@ test_that("restarting a worker kills the worker", { # receiving results ------------------------------------------------------------ test_that("blocking on new results works", { - skip_on_cran() - skip_on_ci() + skip_if(TRUE) # does not work in testthat on environment config = start_flush_redis() @@ -811,8 +783,7 @@ test_that("blocking on new results works", { }) test_that("wait for tasks works when a task gets lost", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = Rush$new(network_id = "test-rush", config = config) @@ -834,8 +805,7 @@ test_that("wait for tasks works when a task gets lost", { # misc-------------------------------------------------------------------------- test_that("saving lgr logs works", { - skip_on_cran() - skip_on_ci() + skip_if(TRUE) # does not work in testthat on environment config = start_flush_redis() @@ -866,8 +836,7 @@ test_that("saving lgr logs works", { }) test_that("snapshot option works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = Rush$new(network_id = "test-rush", config = config) @@ -886,8 +855,7 @@ test_that("snapshot option works", { }) test_that("terminating workers on idle works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = Rush$new(network_id = "test-rush", config = config) @@ -905,8 +873,7 @@ test_that("terminating workers on idle works", { }) test_that("constants works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = Rush$new(network_id = "test-rush", config = config) @@ -925,8 +892,7 @@ test_that("constants works", { # rush network without controller ---------------------------------------------- test_that("network without controller works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = Rush$new(network_id = "test-rush", config = config) @@ -961,8 +927,7 @@ test_that("network without controller works", { # seed ------------------------------------------------------------------------- test_that("seeds are generated from regular rng seed", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = Rush$new(network_id = "test-rush", config = config, seed = 123) @@ -977,8 +942,7 @@ test_that("seeds are generated from regular rng seed", { }) test_that("seed are generated from L'Ecuyer-CMRG seed", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = Rush$new(network_id = "test-rush", config = config, seed = c(10407L, 1801422725L, -2057975723L, 1156894209L, 1595475487L, 210384600L, -1655729657L)) @@ -993,8 +957,7 @@ test_that("seed are generated from L'Ecuyer-CMRG seed", { }) test_that("seed is set correctly on two workers", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = Rush$new(network_id = "test-rush", config = config, seed = 123) @@ -1019,8 +982,7 @@ test_that("seed is set correctly on two workers", { # log -------------------------------------------------------------------------- test_that("printing logs with redis appender works", { - skip_on_cran() - skip_on_ci() + skip_if(TRUE) # does not work in testthat on environment config = start_flush_redis() @@ -1050,8 +1012,7 @@ test_that("printing logs with redis appender works", { }) test_that("redis info works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = Rush$new(network_id = "test-rush", config = config) @@ -1061,8 +1022,7 @@ test_that("redis info works", { # large objects ---------------------------------------------------------------- test_that("evaluating a task works", { - skip_on_cran() - skip_on_ci() + skip_if(TRUE) # takes too long config = start_flush_redis() diff --git a/tests/testthat/test-RushWorker.R b/tests/testthat/test-RushWorker.R index 926d03f..92afa8f 100644 --- a/tests/testthat/test-RushWorker.R +++ b/tests/testthat/test-RushWorker.R @@ -1,6 +1,5 @@ test_that("constructing a rush worker works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = RushWorker$new(network_id = "test-rush", config = config, host = "local") @@ -23,8 +22,7 @@ test_that("constructing a rush worker works", { }) test_that("active bindings work after construction", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = RushWorker$new(network_id = "test-rush", config = config, host = "local") @@ -48,8 +46,7 @@ test_that("active bindings work after construction", { }) test_that("a worker is registered", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = RushWorker$new(network_id = "test-rush", config = config, host = "local") @@ -69,8 +66,7 @@ test_that("a worker is registered", { }) test_that("a worker is terminated", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = RushWorker$new(network_id = "test-rush", config = config, host = "local") @@ -84,8 +80,7 @@ test_that("a worker is terminated", { }) test_that("a heartbeat is started", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = RushWorker$new(network_id = "test-rush", config = config, host = "local", heartbeat_period = 3) @@ -98,8 +93,7 @@ test_that("a heartbeat is started", { }) test_that("pushing a task to the queue works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = RushWorker$new(network_id = "test-rush", config = config, host = "local") @@ -138,8 +132,7 @@ test_that("pushing a task to the queue works", { }) test_that("pushing a task with extras to the queue works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = RushWorker$new(network_id = "test-rush", config = config, host = "local") @@ -181,8 +174,7 @@ test_that("pushing a task with extras to the queue works", { }) test_that("pushing tasks to the queue works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = RushWorker$new(network_id = "test-rush", config = config, host = "local") @@ -222,8 +214,7 @@ test_that("pushing tasks to the queue works", { }) test_that("pushing tasks with extras to the queue works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = RushWorker$new(network_id = "test-rush", config = config, host = "local") @@ -266,8 +257,7 @@ test_that("pushing tasks with extras to the queue works", { }) test_that("popping a task from the queue works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = RushWorker$new(network_id = "test-rush", config = config, host = "local") @@ -309,8 +299,7 @@ test_that("popping a task from the queue works", { }) test_that("popping a task with seed, max_retries and timeout works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = RushWorker$new(network_id = "test-rush", config = config, host = "local") @@ -358,8 +347,7 @@ test_that("popping a task with seed, max_retries and timeout works", { }) test_that("pushing a finished task works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = RushWorker$new(network_id = "test-rush", config = config, host = "local") @@ -400,8 +388,7 @@ test_that("pushing a finished task works", { }) test_that("pushing a failed tasks works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = RushWorker$new(network_id = "test-rush", config = config, host = "local") @@ -442,8 +429,7 @@ test_that("pushing a failed tasks works", { }) test_that("retry a failed task works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = RushWorker$new(network_id = "test-rush", config = config, host = "local") @@ -469,8 +455,7 @@ test_that("retry a failed task works", { }) test_that("retry a failed task works and setting a new seed works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = RushWorker$new(network_id = "test-rush", config = config, host = "local") @@ -495,8 +480,7 @@ test_that("retry a failed task works and setting a new seed works", { }) test_that("retry a failed task works with a maximum of retries", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = RushWorker$new(network_id = "test-rush", config = config, host = "local") @@ -539,8 +523,7 @@ test_that("retry a failed task works with a maximum of retries", { }) test_that("retry failed tasks works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = RushWorker$new(network_id = "test-rush", config = config, host = "local") @@ -568,8 +551,7 @@ test_that("retry failed tasks works", { }) test_that("moving and fetching tasks works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = RushWorker$new(network_id = "test-rush", config = config, host = "local") @@ -644,8 +626,7 @@ test_that("moving and fetching tasks works", { }) test_that("fetching as list works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = RushWorker$new(network_id = "test-rush", config = config, host = "local") @@ -701,8 +682,7 @@ test_that("fetching as list works", { }) test_that("fetch task with states works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = RushWorker$new(network_id = "test-rush", config = config, host = "local", seed = 123) @@ -759,8 +739,7 @@ test_that("fetch task with states works", { }) test_that("latest results are fetched", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = RushWorker$new(network_id = "test-rush", config = config, host = "local") @@ -802,8 +781,7 @@ test_that("latest results are fetched", { }) test_that("priority queues work", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = Rush$new(network_id = "test-rush", config = config) @@ -856,8 +834,7 @@ test_that("priority queues work", { }) test_that("redirecting to shared queue works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = Rush$new(network_id = "test-rush", config = config) @@ -887,8 +864,7 @@ test_that("redirecting to shared queue works", { }) test_that("mixing priority queue and shared queue works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = Rush$new(network_id = "test-rush", config = config) @@ -909,8 +885,7 @@ test_that("mixing priority queue and shared queue works", { }) test_that("saving logs with redis appender works", { - skip_on_cran() - skip_on_ci() + appenders = lgr::get_logger("root")$appenders on.exit({ @@ -944,8 +919,7 @@ test_that("saving logs with redis appender works", { }) test_that("settings the buffer size in redis appender works", { - skip_on_cran() - skip_on_ci() + appenders = lgr::get_logger("root")$appenders on.exit({ @@ -976,8 +950,7 @@ test_that("settings the buffer size in redis appender works", { }) test_that("pushing tasks and terminating worker works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = RushWorker$new(network_id = "test-rush", config = config, host = "local") @@ -997,8 +970,7 @@ test_that("pushing tasks and terminating worker works", { }) test_that("terminate on idle works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = RushWorker$new(network_id = "test-rush", config = config, host = "local") @@ -1017,8 +989,7 @@ test_that("terminate on idle works", { # seed ------------------------------------------------------------------------- test_that("popping a task with seed from the queue works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = RushWorker$new(network_id = "test-rush", config = config, host = "local", seed = 123) @@ -1035,8 +1006,7 @@ test_that("popping a task with seed from the queue works", { # atomic operations ----------------------------------------------------------- test_that("task in states works", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush = RushWorker$new(network_id = "test-rush", config = config, host = "local", seed = 123) diff --git a/tests/testthat/test-rush_plan.R b/tests/testthat/test-rush_plan.R index a315ce5..934436a 100644 --- a/tests/testthat/test-rush_plan.R +++ b/tests/testthat/test-rush_plan.R @@ -1,6 +1,5 @@ test_that("rush_plan family works", { - skip_on_cran() - skip_on_ci() + expect_false(rush_available()) config = redis_config() @@ -13,16 +12,14 @@ test_that("rush_plan family works", { }) test_that("rush_plan throws and error if redis is not available", { - skip_on_cran() - skip_on_ci() + config = redis_config(url = "redis://localhost:1234") expect_error(rush_plan(n_workers = 2, config), "Can't connect to Redis") }) test_that("start workers", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush_plan(n_workers = 2, config) @@ -39,8 +36,7 @@ test_that("start workers", { }) test_that("set threshold", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush_plan(n_workers = 2, config, lgr_thresholds = c(rush = "debug")) @@ -56,8 +52,7 @@ test_that("set threshold", { }) test_that("set start worker timeout", { - skip_on_cran() - skip_on_ci() + config = start_flush_redis() rush_plan(n_workers = 2, config, start_worker_timeout = -Inf)