Skip to content

Commit

Permalink
TESTS: Make sure to timeout worker properly on MS Windows [#95]
Browse files Browse the repository at this point in the history
  • Loading branch information
HenrikBengtsson committed Jan 4, 2023
1 parent 0e94e25 commit efb1352
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions tests/makeClusterPSOCK.R
Original file line number Diff line number Diff line change
Expand Up @@ -282,15 +282,21 @@ if (fullTest || covr_testing) {


## https://github.com/HenrikBengtsson/parallelly/issues/95
res <- tryCatch({
parallelly::makeClusterPSOCK(1L, connectTimeout = 0.1,
rscript_startup = quote(Sys.sleep(6.0)))
}, error = identity)
print(res)
stopifnot(
inherits(res, "error"),
grepl("^Cluster setup failed", conditionMessage(res))
)
if (getRversion() >= "4.0.0") {
res <- tryCatch({
parallelly::makeClusterPSOCK(1L, rscript_startup = quote(Sys.sleep(6.0)),
connectTimeout = 0.1, timeout = 7.0)
}, error = identity)
print(res)
stopifnot(
inherits(res, "error"),
grepl("^Cluster setup failed", conditionMessage(res))
)

## Make sure to wait for background process to timeout before continuing,
## when on MS Windows
if (.Platform$OS.type == "windows") Sys.sleep(2.0)
}

message("*** makeClusterPSOCK() ... DONE")

Expand Down

0 comments on commit efb1352

Please sign in to comment.