diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 41f84886c..41b57d18b 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -2,9 +2,9 @@ # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: - branches: [main] + branches: [main, dev] pull_request: - branches: [main] + branches: [main, dev] name: test-coverage diff --git a/tests/tests.R b/tests/tests.R index d8746ad8e..d603484a4 100644 --- a/tests/tests.R +++ b/tests/tests.R @@ -225,7 +225,20 @@ connection && .Platform[["OS.type"]] != "windows" && Sys.getenv("NOT_CRAN") == " test_equal(daemons()[["connections"]], 2L) test_type("list", res <- mirai_map(c(1,1), rnorm)[.progress]) test_true(res[[1L]] != res[[2L]]) + test_equal(stop_daemon(4L), 2L) + Sys.sleep(0.1) + test_zero(daemons()[["connections"]]) test_zero(daemons(0L)) + Sys.sleep(1L) + test_zero(daemons(url = "tls+tcp://127.0.0.1:0", dispatcher = "default")) + test_equal(launch_local(1L), 1L) + Sys.sleep(1L) + test_true(grepl("CERTIFICATE", launch_remote(1L), fixed = TRUE)) + q <- quote(list2env(list(b = 2), envir = .GlobalEnv)) + m <- mirai("Seattle", .timeout = 1000) + if (!is_error_value(m[])) test_equal(m[], "Seattle") + test_class("errorValue", mirai(q(), .timeout = 1000)[]) + test_zero(daemons(0)) } # TLS tests connection && Sys.getenv("NOT_CRAN") == "true" && { @@ -287,18 +300,6 @@ connection && Sys.getenv("NOT_CRAN") == "true" && { test_equal(length(nextget("urls")), 1L) test_class("miraiLaunchCmd", launch_remote(1)) test_zero(daemons(0)) - Sys.sleep(1L) - test_zero(daemons(url = "tls+tcp://127.0.0.1:0", dispatcher = "default")) - test_equal(launch_local(3L), 3L) - Sys.sleep(1L) - test_true(grepl("CERTIFICATE", launch_remote(1L), fixed = TRUE)) - test_equal(stop_daemon(2L), 2L) - q <- quote(list2env(list(b = 2), envir = .GlobalEnv)) - m <- mirai("Seattle", .timeout = 1000) - if (!is_error_value(m[])) test_equal(m[], "Seattle") - test_equal(daemons()[["connections"]], 1L) - test_class("errorValue", mirai(q(), .timeout = 1000)[]) - test_zero(daemons(0)) } # additional stress testing connection && Sys.getenv("NOT_CRAN") == "true" && { @@ -319,22 +320,30 @@ connection && Sys.getenv("NOT_CRAN") == "true" && { Sys.sleep(1L) option <- 15L Sys.setenv(R_DEFAULT_PACKAGES = "stats,utils") - test_equal(1L, daemons(1, dispatcher = "process", maxtasks = 10L, timerstart = 1L, walltime = 500L, seed = 1546, token = TRUE, cleanup = option, autoexit = tools::SIGCONT)) + test_equal(2L, daemons(2, dispatcher = "process", maxtasks = 10L, timerstart = 1L, walltime = 500L, seed = 1546, token = TRUE, cleanup = option, autoexit = tools::SIGCONT)) Sys.unsetenv("R_DEFAULT_PACKAGES") Sys.sleep(1L) mq <- mirai(runif(1L), .timeout = 1000) test_true(is.numeric(mq[])) mq <- mirai(Sys.sleep(0.7), .timeout = 500) test_class("matrix", status()[["daemons"]]) + test_type("character", saisei(i = 2L, force = TRUE)) + m <- mirai(mirai::daemon(url), url = nextget("urls")[2L]) + Sys.sleep(0.1) + test_null(saisei(i = 1L)) + test_type("integer", mirai(1L, .timeout = 500)[]) + test_zero(daemons(0)) +} +# additional legacy interface tests +connection && .Platform[["OS.type"]] != "windows" && Sys.getenv("NOT_CRAN") == "true" && { Sys.sleep(1L) test_equal(daemons(url = host_url(ws = TRUE, tls = TRUE), dispatcher = "thread", output = TRUE), 1L) test_equal(nextget("n"), 1L) test_equal(length(nextget("urls")), 1L) + Sys.sleep(1L) test_class("matrix", status()$daemons) test_null(saisei(i = 0L)) - test_print(saisei(i = 1L)) - Sys.sleep(0.1) - test_print(saisei(i = 1L, force = TRUE)) + test_type("character", saisei(i = 1L)) Sys.sleep(0.1) test_zero(daemons(0)) }