Skip to content

Commit

Permalink
resolve URLs on MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Sep 11, 2024
1 parent 661a8b4 commit 59742fa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion R/daemons.R
Original file line number Diff line number Diff line change
Expand Up @@ -591,8 +591,9 @@ create_stream <- function(n, seed, envir) {
`[[<-`(.GlobalEnv, ".Random.seed", oseed)
}

# "%s-%d" format required by IPC under MacOS
auto_dispatcher_urls <- function(n, url)
as.character(lapply(seq_len(n), function(x) sprintf("%s/%d", url, x)))
as.character(lapply(seq_len(n), function(x) sprintf("%s-%d", url, x)))

resolve_url_port <- function(url) {
parse_url(url)[["port"]] == "0" || return(url)
Expand Down
8 changes: 4 additions & 4 deletions tests/tests.R
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,8 @@ connection && .Platform[["OS.type"]] != "windows" && Sys.getenv("NOT_CRAN") == "
}
# threaded dispatcher tests
connection && Sys.getenv("NOT_CRAN") == "true" && {
nanotesto(daemons(1, dispatcher = NA))
nanotesto(nextget("n"))
nanotest(daemons(2, dispatcher = NA) == 2L)
nanotest(nextget("n") == 2L)
nanotest(startsWith(nextget("urls")[[1L]], mirai:::.urlscheme))
nanotest(is.matrix(status()$daemons))
nanotest(mirai(TRUE)[])
Expand All @@ -302,8 +302,8 @@ connection && Sys.getenv("NOT_CRAN") == "true" && {
nanotestz(daemons(0))
nanotest(daemons(2, url = local_url(), dispatcher = NA) == 2L)
nanotest(length(urls <- nextget("urls")) == 2L)
nanotest(endsWith(urls[[1L]], "/1"))
nanotest(endsWith(urls[[2L]], "/2"))
nanotest(endsWith(urls[[1L]], "1"))
nanotest(endsWith(urls[[2L]], "2"))
nanotestz(daemons(0))
}
Sys.sleep(1L)

0 comments on commit 59742fa

Please sign in to comment.