diff --git a/tests/testthat/test-multi-download.R b/tests/testthat/test-multi-download.R index f7bba29..a779259 100644 --- a/tests/testthat/test-multi-download.R +++ b/tests/testthat/test-multi-download.R @@ -3,7 +3,7 @@ context("Multi download") test_that("Stress test multi_download", { skip_on_cran() mirror <- 'https://cloud.r-project.org' - pkgs <- row.names(available.packages(repos = mirror))[1:3000] + pkgs <- row.names(available.packages(repos = mirror))[1:1000] urls <- sprintf('%s/web/packages/%s/DESCRIPTION', mirror, pkgs) outdir <- file.path(tempdir(), 'descriptions') files <- sprintf('%s/%s.txt', outdir, pkgs) diff --git a/tests/testthat/test-multi.R b/tests/testthat/test-multi.R index 11ad106..ad48b02 100644 --- a/tests/testthat/test-multi.R +++ b/tests/testthat/test-multi.R @@ -1,8 +1,7 @@ context("Multi handle") test_that("Timeout works", { - skip_on_os("solaris") - h1 <- new_handle(url = httpbin("delay/3")) + h1 <- new_handle(url = httpbin("delay/10")) h2 <- new_handle(url = httpbin("post"), postfields = "bla bla") h3 <- new_handle(url = "https://urldoesnotexist.xyz", connecttimeout = 1) h4 <- new_handle(url = "http://localhost:14", connecttimeout = 1) @@ -13,12 +12,10 @@ test_that("Timeout works", { multi_add(h4, pool = m) rm(h1, h2, h3, h4) gc() - out <- multi_run(timeout = 2, pool = m) - expect_equal(out, list(success = 1, error = 2, pending = 1)) - out <- multi_run(timeout = 0, pool = m) - expect_equal(out, list(success = 0, error = 0, pending = 1)) - out <- multi_run(pool = m) - expect_equal(out, list(success = 1, error = 0, pending = 0)) + spent <- system.time(out <- multi_run(timeout = 2, pool = m)) + expect_lte(out$pending, 2) + expect_lte(spent[['elapsed']], 4) + lapply(multi_list(m), multi_cancel) }) test_that("Callbacks work", {