Running 'tests.R' [17s]
Running the tests in 'tests/tests.R' failed.
Complete output:
  > # minitest - a minimal testing framework v0.0.6 --------------------------------
  > test_library <- function(package) library(package = package, character.only = TRUE)
  > test_true <- function(x) invisible(isTRUE(x) || {print(x); stop("the above was returned instead of TRUE")})
  > test_false <- function(x) invisible(isFALSE(x) || {print(x); stop("the above was returned instead of FALSE")})
  > test_null <- function(x) invisible(is.null(x) || {print(x); stop("the above was returned instead of NULL")})
  > test_notnull <- function(x) invisible(!is.null(x) || stop("returns NULL when expected to be not NULL"))
  > test_zero <- function(x) invisible(x == 0L || {print(x); stop("the above was returned instead of 0L")})
  > test_type <- function(type, x) invisible(typeof(x) == type || {stop("object of type '", typeof(x), "' was returned instead of '", type, "'")})
  > test_class <- function(class, x) invisible(inherits(x, class) || {stop("object of class '", paste(class(x), collapse = ", "), "' was returned instead of '", class, "'")})
  > test_equal <- function(a, b) invisible(a == b || {print(a); print(b); stop("the above expressions were not equal")})
  > test_identical <- function(a, b) invisible(identical(a, b) || {print(a); print(b); stop("the above expressions were not identical")})
  > test_print <- function(x) invisible(is.character(capture.output(print(x))) || stop("print output of expression cannot be captured as a character value"))
  > test_error <- function(x, containing = "") invisible(inherits(x <- tryCatch(x, error = identity), "error") && grepl(containing, x[["message"]], fixed = TRUE) || stop("Expected error message containing: ", containing, "\nActual error message: ", x[["message"]]))
  > mock_binding <- function(ns, name, value) { original <- ns[[name]]; unlockBinding(name, ns); ns[[name]] <- value; original }
  > restore_binding <- function(ns, name, value) { ns[[name]] <- value; lockBinding(name, ns) }
  > NOT_CRAN <- Sys.getenv("NOT_CRAN") == "true"
  > # ------------------------------------------------------------------------------
  > 
  > test_library("mirai")
  > connection <- !is_error_value(collect_mirai(mirai(TRUE, .timeout = 2000L)))
  > # core tests
  > test_null(info())
  > test_type("list", status())
  > test_zero(status()[["connections"]])
  > test_zero(status()[["daemons"]])
  > test_false(daemons(0L))
  > test_error(mirai(), "missing expression, perhaps wrap in {}?")
  > test_error(mirai(a, 1), "all `...` arguments must be named")
  > test_error(mirai(a, .args = list(1)), "all items in `.args` must be named")
  > test_error(mirai_map(1:2, identity))
  > test_error(daemons(url = "URL"))
  > test_error(daemons(-1), "zero or greater")
  > test_error(daemons(raw(0L)), "must be numeric")
  > test_error(daemons(1, dispatcher = ""))
  > test_error(daemons(url = local_url(), dispatcher = NA))
  > test_error(daemons(url = host_url), "must be of type character")
  > test_error(daemon("URL"))
  > test_error(launch_local(1L), "daemons must be set")
  > test_error(race_mirai(list()), "daemons must be set")
  > test_false(daemons_set())
  > test_error(require_daemons())
  > if (mirai:::cli_enabled) {
  +   ns <- getNamespace("mirai")
  +   unlockBinding("cli_enabled", ns)
  +   ns[["cli_enabled"]] <- FALSE
  +   cli_disabled <- TRUE
  + } else {
  +   cli_disabled <- FALSE
  + }
  > test_error(mirai:::stop_d(NULL), "No daemons set.")
  > test_error(mirai:::stop_d("default"), "No daemons set for the 'default' compute profile.")
  > if (cli_disabled) {
  +   ns[["cli_enabled"]] <- TRUE
  +   lockBinding("cli_enabled", ns)
  + }
  > test_type("character", host_url())
  > test_type("character", names(host_url()))
  > test_true(all(startsWith(host_url(tls = TRUE), "tls")))
  > test_true(all(grepl("5555", host_url(port = 5555), fixed = TRUE)))
  > test_identical(local_url(tcp = TRUE), "tcp://127.0.0.1:0")
  > test_true(grepl("5555", local_url(tcp = TRUE, port = 5555), fixed = TRUE))
  > test_type("list", ssh_config("ssh://remotehost"))
  > test_type("list", ssh_config("ssh://remotehost", tunnel = TRUE))
  > test_type("list", cluster_config())
  > test_type("list", cfg <- http_config(url = "https://example.com", cookie = "abc", data = '{"cmd":"%s"}'))
  > test_equal(cfg$type, "http")
  > test_equal(cfg$url, "https://example.com")
  > test_equal(cfg$cookie, "abc")
  > test_equal(cfg$data, '{"cmd":"%s"}')
  > test_true(is_mirai_interrupt(r <- mirai:::mk_mirai_interrupt()))
  > test_print(r)
  > test_true(is_mirai_error(r <- `class<-`("Error in: testing\n", c("miraiError", "errorValue", "try-error"))))
  > test_print(r)
  > test_false(on_daemon())
  > test_equal(mirai:::.DollarNames.miraiError(r, "c"), "class")
  > test_true(mirai:::is.promising.mirai())
  > test_true(mirai:::is.promising.mirai_map())
  > test_error(everywhere({}))
  > test_null(nextstream())
  > for (i in 0:4)
  +   test_type("character", nextcode(i))
  > test_null(register_serial("test_klass1", serialize, unserialize))
  > test_null(register_serial(c("test_klass2", "test_klass3"), list(serialize, serialize), list(unserialize, unserialize)))
  > test_equal(length(mirai:::.[["serial"]][[3L]]), 3L)
  > # mirai and daemons tests
  > connection && {
  +   Sys.sleep(1L)
  +   .n <- function() m
  +   m <- mirai({
  +     Sys.sleep(0.1)
  +     q <- m + .n() + 2L
  +     q / m
  +   }, m = 2L, .args = environment(), .timeout = 2000L)
  +   test_identical(call_mirai(m), m)
  +   test_type("integer", attr(m, "id"))
  +   if (!is_error_value(m$data)) test_equal(m$data, 3L)
  +   Sys.sleep(1L)
  +   `lang obj` <- quote(m + n + 2L)
  +   args <- c(m = 2L, n = 4L)
  +   m <- mirai(.expr = `lang obj`, .args = args, .timeout = 2000L)
  +   if (!is_error_value(call_mirai(m)$data)) test_equal(m$data, 8L)
  +   test_false(stop_mirai(m))
  +   Sys.sleep(1L)
  +   m <- mirai(mirai::on_daemon(), .timeout = 2000L)
  +   if (!is_error_value(m[])) test_true(m[])
  +   Sys.sleep(1L)
  +   test_true(d <- daemons(1L, dispatcher = FALSE, asyncdial = FALSE, seed = 1546L))
  +   test_print(d)
  +   test_true(daemons_set())
  +   me <- mirai(mirai::mirai(), .timeout = 2000L)[]
  +   test_notnull(me)
  +   if (is_mirai_error(me)) test_type("list", me$stack.trace)
  +   if (is_mirai_error(me)) test_true(length(me$stack.trace) >= 2L)
  +   if (is_mirai_error(me)) test_true(all(as.logical(lapply(me$stack.trace, is.language))))
  +   if (is_mirai_error(me)) test_type("character", me$condition.class)
  +   if (is_mirai_error(me)) test_type("character", conditionMessage(me))
  +   if (is_mirai_error(me)) test_type("language", conditionCall(me))
  +   test_false(is_mirai_interrupt(me))
  +   test_class("errorValue", me)
  +   test_print(me)
  +   m <- mirai(mirai::on_daemon(), .timeout = 2000L)
  +   if (!is_error_value(m[])) test_true(m[])
  +   df <- data.frame(a = 1, b = 2, .Random.seed = 0)
  +   dm <- mirai(as.matrix(df), .args = list(df = df), .timeout = 2000L)
  +   test_true(is_mirai(call_mirai(dm)))
  +   test_false(unresolved(dm))
  +   if (!is_error_value(dm$data)) test_class("matrix", dm$data)
  +   test_print(dm)
  +   m1 <- mirai(Sys.sleep(0.1), .timeout = 200L)
  +   m2 <- mirai({}, .timeout = 200L)
  +   m3 <- mirai(Sys.sleep(0.1), .timeout = 200L)
  +   test_zero(race_mirai(list()))
  +   ml <- list(m1, m2, m3)
  +   while (length(ml)) {
  +     idx <- race_mirai(ml)
  +     test_type("integer", idx)
  +     test_true(idx >= 1L && idx <= length(ml))
  +     test_class("mirai", ml[[idx]])
  +     ml <- ml[-idx]
  +   }
  +   test_type("integer", info())
  +   test_type("integer", status()[["connections"]])
  +   test_type("character", status()[["daemons"]])
  +   test_type("character", mlc <- launch_remote())
  +   test_class("miraiLaunchCmd", mlc)
  +   test_print(mlc)
  +   test_error(launch_remote(1L, remote = remote_config(command = "echo", args = "invalid")), "must be an element")
  +   test_error(launch_remote(3L, remote = remote_config(command = "echo", args = list(c("test", "."), c("test", ".")))), "must equal the length")
  +   test_false(daemons(0L))
  +   Sys.sleep(1L)
  +   test_true(daemons(1L, dispatcher = FALSE, maxtasks = 10L, walltime = 10000L, idletime = 20000L, cleanup = FALSE, output = TRUE, .compute = "new"))
  +   test_type("character", nextget("url", .compute = "new"))
  +   test_type("integer", nextstream(.compute = "new"))
  +   test_true(require_daemons("new", call = environment()))
  +   Sys.sleep(1.5)
  +   run_checks_on <- function(.compute, check) {
  +     local_daemons(.compute)
  +     check
  +   }
  +   run_checks_on("new", test_type("list", everywhere({}, as.environment(df))))
  +   test_zero(status()$connections)
  +   with_daemons("new", {
  +     mn <- mirai("test1")
  +     mp <- mirai(b + 1)
  +   })
  +   Sys.sleep(1L)
  +   if (!unresolved(mn$data)) test_equal(mn$data, "test1")
  +   if (!unresolved(mp$data)) test_equal(mp$data, 3)
  +   Sys.sleep(1L)
  +   test_type("integer", status(.compute = "new")[["connections"]])
  +   test_error(mirai_map(1:2, "a function", .compute = "new"), "must be of type function, not character")
  +   test_false(daemons(0L, .compute = "new"))
  + }
  [1] TRUE
  > # additional daemons tests
  > connection && {
  +   Sys.sleep(1L)
  +   test_true(daemons(url = value <- local_url(), dispatcher = FALSE))
  +   test_identical(status()$daemons, value)
  +   test_identical(nextget("url"), value)
  +   test_type("character", launch_remote(remote = remote_config(command = "echo", args = list(c("Test out:", ".", ">/dev/null")), rscript = "/usr/lib/R/bin/Rscript")))
  +   test_error(launch_remote(remote = ssh_config("ssh://127.0.0.1:5456", tunnel = TRUE)), "127.0.0.1")
  +   test_false(daemons(0L))
  +   Sys.sleep(1L)
  +   test_true(daemons(n = 2L, url = value <- "ws://:0", dispatcher = FALSE, remote = remote_config(quote = TRUE)))
  +   test_true(status()$daemons != value)
  +   test_false(daemons(0L))
  + }
  Test out: /usr/lib/R/bin/Rscript -e mirai::daemon("ipc://3fb4bc8cc6285c032322b3f6",dispatcher=FALSE,rs=c(10407,-152840670,477377339,-488504000,780301377,1386177806,-1496079817)) >/dev/null
  [1] TRUE
  > # mirai_map tests
  > connection && {
  +   Sys.sleep(1L)
  +   m <- with(daemons(1, dispatcher = FALSE, .compute = "ml"), {
  +     if (tryCatch(mirai_map(list(1, "a", 2), sum)[.stop], error = function(e) TRUE) &&
  +         tryCatch(mirai_map(list(1, "a", 2), sum)[.flat], error = function(e) TRUE))
  +       mirai_map(1:3, rnorm, .args = list(mean = 20, 2))[]
  +   })
  +   test_false(is_mirai_map(m))
  +   test_type("list", m)
  +   test_equal(length(m), 3L)
  +   test_true(all(as.logical(lapply(m, is.numeric))))
  +   Sys.sleep(1L)
  +   test_true(daemons(1, dispatcher = FALSE))
  +   mp <- mirai_map(list(x = "a"), function(...) do(...), do = function(x, y) sprintf("%s%s", x, y), .args = list("b"))
  +   test_print(mp)
  +   test_identical(collect_mirai(mp, list(.flat = TRUE))[["x"]], "ab")
  +   test_identical(call_mirai(mp)[["x"]][["data"]], "ab")
  +   mres <- mirai_map(data.frame(1:3, 3:1), sum, .args = list(3L))[.flat]
  +   test_true(all(mres == 7L))
  +   test_null(names(mres))
  +   test_true(all(mirai_map(list(c(a = 1, b = 1, c = 1), 3), sum)[.flat] == 3))
  +   test_type("language", mirai_map(list(quote(1+2)), identity)[][[1]])
  +   test_class("Date", mirai_map(data.frame(x = as.Date("2020-01-01")), identity)[][[1]])
  +   test_true(is_mirai_error(mirai_map(1:2, function(x) daemons(1))[][[1]]))
  +   test_false(daemons(0L))
  + }
  [1] FALSE
  Error in test_true(is_mirai_error(mirai_map(1:2, function(x) daemons(1))[][[1]])) : 
    the above was returned instead of TRUE
  Execution halted