Reduce timeouts in tests to make sure they don't sum up to over 10s
Change-Id: Id3dd3edf44f94b854e942bf57e9ea139d2984b11
diff --git a/cran-comments.md b/cran-comments.md
index 9864f87..d6e3d81 100644
--- a/cran-comments.md
+++ b/cran-comments.md
@@ -25,6 +25,7 @@
<https://github.com/KorAP/RKorAPClient/commit/04814f2be215f08a3777310af2202d14457c2e7c>,
<https://github.com/KorAP/RKorAPClient/commit/f650629fa69ab10979f2ffe2652da77599caaf70>
* Replaced our log.info function with log_info to avoid name clashes
+* Reduced timeouts in tests to make sure they don't sum up to over 10s.
### Old Notes
diff --git a/tests/testthat/test-KorAPConnection.R b/tests/testthat/test-KorAPConnection.R
index a1efd9e..eea2265 100644
--- a/tests/testthat/test-KorAPConnection.R
+++ b/tests/testthat/test-KorAPConnection.R
@@ -3,15 +3,15 @@
})
test_that("KorAPConnection fails gracefully on timeout", {
- expect_message(new("KorAPConnection", apiUrl="http://httpbin.org/delay/3", timeout = 1), "No internet|Timeout|json")
+ expect_message(new("KorAPConnection", apiUrl="http://httpbin.org/delay/3", timeout = 0.2), "No internet|Timeout|json|progress")
})
test_that("KorAPConnection fails gracefully on Bad Gateway errors", {
- expect_message(new("KorAPConnection", apiUrl="http://httpbin.org/status/502", timeout = 1), "No internet|Timeout|json|502")
+ expect_message(new("KorAPConnection", apiUrl="http://httpbin.org/status/502", timeout = 0.5), "No internet|Timeout|progress|json|502")
})
test_that("KorAPConnection is printable", {
- kco <- new("KorAPConnection", timeout = 10)
+ kco <- new("KorAPConnection", timeout = 1)
skip_if(is.null(kco@welcome))
expect_error(print(kco), NA)
})
@@ -21,12 +21,12 @@
})
test_that("Opening KorAPConnection with invalid apiToken fails gracefully", {
- expect_message(new("KorAPConnection", accessToken="test token", timeout = 10),
- "401|Timeout")
+ expect_message(new("KorAPConnection", accessToken="test token", timeout = 3),
+ "401|Timeout|progress")
})
test_that("Persisting null apiToken fails", {
- kco <- new("KorAPConnection", timeout = 10)
+ kco <- new("KorAPConnection", timeout = 3)
skip_if_not(is.null(kco@accessToken))
skip_if(is.null(kco@welcome))
expect_error(persistAccessToken(kco),