Skip to content

Commit

Permalink
make tests uniquely identifiable
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed May 10, 2023
1 parent 9be0286 commit 85953f8
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 57 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: mirai
Type: Package
Title: Minimalist Async Evaluation Framework for R
Version: 0.8.4.9003
Version: 0.8.4.9004
Description: Lightweight parallel code execution and distributed computing.
Designed for simplicity, a 'mirai' evaluates an R expression asynchronously,
on local or network resources, resolving automatically upon completion.
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# mirai 0.8.4.9003
# mirai 0.8.4.9004

* `server()` and `dispatcher()` argument 'asyncdial' is now FALSE by default, causing these functions to exit if a connection is not immediately available. This means that for distributed computing purposes, `dameons()` should be called before `server()` is launched on remote resources, or else `server(asyncdial = TRUE)` allows servers to wait for a connection.
* Ensure all tests pass on CRAN.
Expand Down
112 changes: 57 additions & 55 deletions tests/tests.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,59 +87,61 @@ nanotest(daemons(.compute = "new")[["connections"]] == 0L)
nanotestz(daemons(0L, .compute = "new"))
Sys.sleep(1L)

nanotest(daemons(n = 2, "ws://:0") == 2L)
Sys.sleep(1L)
status <- daemons()[["daemons"]]
nanotest(is.matrix(status) || is_error_value(status))
if (is.matrix(status)) {
nanotest(is.character(dn1 <- dimnames(status)[[1L]]))
nanotest(is.integer(attr(dn1, "dispatcher_pid")))
nanotest(is.character(parse1 <- nanonext::parse_url(dn1[1L])))
nanotest(is.character(parse2 <- nanonext::parse_url(dn1[2L])))
nanotest((port <- as.integer(parse1[["port"]])) > 0L)
nanotest(as.integer(parse2[["port"]]) == port)
nanotest(parse1[["path"]] == "/1")
nanotest(parse2[["path"]] == "/2")
nanotestz(sum(status[, "online"]))
nanotestz(sum(status[, "instance"]))
nanotestz(sum(status[, "assigned"]))
nanotestz(sum(status[, "complete"]))
}
nanotest(is.character(saisei(i = 1L)))
nanotestn(saisei(i = 10L))
Sys.sleep(0.5)
nanotestz(daemons(0))
Sys.sleep(1L)
nanotest(daemons(n = 2, "tcp://127.0.0.1:0") == 2L)
Sys.sleep(1L)
nanotest(is.integer(launch_server(row.names(daemons()[["daemons"]])[1L], maxtasks = 1L)))
Sys.sleep(1L)
status <- daemons()[["daemons"]]
nanotest(is.matrix(status) || is_error_value(status))
if (is.matrix(status)) {
nanotest(is.character(dn1 <- dimnames(status)[[1L]]))
nanotest(is.integer(attr(dn1, "dispatcher_pid")))
nanotest(is.character(parse1 <- nanonext::parse_url(dn1[1L])))
nanotest(is.character(parse2 <- nanonext::parse_url(dn1[2L])))
nanotest((port <- as.integer(parse1[["port"]])) > 0L)
nanotest(as.integer(parse2[["port"]]) != port)
nanotest(is.integer(sum(status[, "online"])))
nanotest(is.integer(sum(status[, "instance"])))
nanotestz(sum(status[, "assigned"]))
nanotestz(sum(status[, "complete"]))
if (.Platform[["OS.type"]] != "windows") {
nanotest(daemons(n = 2, "ws://:0") == 2L)
Sys.sleep(1L)
status <- daemons()[["daemons"]]
nanotest(is.matrix(status) || is_error_value(status))
if (is.matrix(status)) {
nanotest(is.character(dn1 <- dimnames(status)[[1L]]))
nanotest(is.integer(attr(dn1, "dispatcher_pid")))
nanotest(is.character(parse1 <- nanonext::parse_url(dn1[1L])))
nanotest(is.character(parse2 <- nanonext::parse_url(dn1[2L])))
nanotest((port <- as.integer(parse1[["port"]])) > 0L)
nanotest(as.integer(parse2[["port"]]) == port)
nanotest(parse1[["path"]] == "/1")
nanotest(parse2[["path"]] == "/2")
nanotestz(sum(status[, "online"]))
nanotestz(sum(status[, "instance"]))
nanotestz(sum(status[, "assigned"]))
nanotestz(sum(status[, "complete"]))
}
nanotest(is.character(saisei(i = 1L)))
nanotestn(saisei(i = 10L))
Sys.sleep(0.5)
nanotestz(daemons(0))
Sys.sleep(1L)
nanotest(daemons(n = 2, "tcp://127.0.0.1:0") == 2L)
Sys.sleep(1L)
nanotest(is.integer(launch_server(row.names(daemons()[["daemons"]])[1L], maxtasks = 1L)))
Sys.sleep(1L)
tstatus <- daemons()[["daemons"]]
nanotest(is.matrix(tstatus) || is_error_value(tstatus))
if (is.matrix(tstatus)) {
nanotest(is.character(tdn1 <- dimnames(tstatus)[[1L]]))
nanotest(is.integer(attr(tdn1, "dispatcher_pid")))
nanotest(is.character(tparse1 <- nanonext::parse_url(tdn1[1L])))
nanotest(is.character(tparse2 <- nanonext::parse_url(tdn1[2L])))
nanotest((tport <- as.integer(tparse1[["port"]])) > 0L)
nanotest(as.integer(tparse2[["port"]]) != tport)
nanotest(is.integer(sum(tstatus[, "online"])))
nanotest(is.integer(sum(tstatus[, "instance"])))
nanotestz(sum(tstatus[, "assigned"]))
nanotestz(sum(tstatus[, "complete"]))
}
nanotestz(daemons(0))
Sys.sleep(1L)
option <- 15L
nanotesto(daemons(1, dispatcher = TRUE, maxtasks = 10L, timerstart = 1L, walltime = 2000L, token = TRUE, lock = TRUE, cleanup = option))
Sys.sleep(1L)
mq <- mirai("server", .timeout = 1000)
nanotest(call_mirai(mq)$data == "server" || is_error_value(mq$data))
dstatus <- daemons()[["daemons"]]
nanotest(is.matrix(dstatus) || is_error_value(dstatus))
if (is.matrix(dstatus)) {
nanotest(is.integer(dstatus[, "online"]))
nanotest(is.integer(dstatus[, "instance"]))
}
nanotestz(daemons(0))
Sys.sleep(2L)
}
nanotestz(daemons(0))
Sys.sleep(1L)
option <- 15L
nanotesto(daemons(1, dispatcher = TRUE, maxtasks = 10L, timerstart = 1L, walltime = 2000L, token = TRUE, lock = TRUE, cleanup = option))
Sys.sleep(1L)
mq <- mirai("server", .timeout = 1000)
nanotest(call_mirai(mq)$data == "server" || is_error_value(mq$data))
status <- daemons()[["daemons"]]
nanotest(is.matrix(status) || is_error_value(status))
if (is.matrix(status)) {
nanotest(is.integer(status[, "online"]))
nanotest(is.integer(status[, "instance"]))
}
nanotestz(daemons(0))
Sys.sleep(2L)

0 comments on commit 85953f8

Please sign in to comment.