From 78b39ca771c26c74de7601a45e007fae3b60c7dc Mon Sep 17 00:00:00 2001 From: Jeroen Ooms Date: Mon, 21 Oct 2024 21:05:48 +0200 Subject: [PATCH] Try to make test less flaky --- tests/testthat/test-multi.R | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/testthat/test-multi.R b/tests/testthat/test-multi.R index 11ad1061..a990cdc2 100644 --- a/tests/testthat/test-multi.R +++ b/tests/testthat/test-multi.R @@ -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) @@ -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", {