Skip to content

Commit

Permalink
Try to make test less flaky
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Oct 21, 2024
1 parent 6a03fb5 commit 78b39ca
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions tests/testthat/test-multi.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
context("Multi handle")

test_that("Timeout works", {
skip_on_os("solaris")
h1 <- new_handle(url = httpbin("delay/3"))
h2 <- new_handle(url = httpbin("post"), postfields = "bla bla")
h3 <- new_handle(url = "https://urldoesnotexist.xyz", connecttimeout = 1)
Expand All @@ -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))
spent <- system.time(multi_run(timeout = 2, pool = m))
expect_lte(spent[['elapsed']], 2.9)
out <- multi_run(pool = m)
expect_equal(out, list(success = 1, error = 0, pending = 0))
expect_equal(out$pending, 0)
})

test_that("Callbacks work", {
Expand Down

0 comments on commit 78b39ca

Please sign in to comment.