Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau-lilly committed Aug 25, 2023
1 parent 1e60368 commit 68754bf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion R/utils_retry.R
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ retry_iteration <- function(
}
# Exponential backoff algorithm borrowed from googleAuthR (MIT license):
backoff <- (seconds_interval) ^ tries
jitter <- stats::runif(n = 1L, min = 0, max = seconds_interval)
jitter <- stats::runif(n = 1L, min = 0, max = seconds_interval / 2)
delay <- backoff + jitter
if (verbose) {
tar_message_run("Retrying...")
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-class_store.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ tar_test("store_wait_correct_hash()", {
store <- store_init()
store$file <- file
store$resources <- tar_resources(
network = tar_resources_network(max_tries = 1L)
network = suppressWarnings(tar_resources_network(max_tries = 1L))
)
expect_error(
store_wait_correct_hash(store),
Expand Down
21 changes: 12 additions & 9 deletions tests/testthat/test-tar_resources_network.R
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
tar_test("tar_resources_network()", {
out <- tar_resources_network()
out <- expect_warning(tar_resources_network(), class = "tar_warn_deprecate")
expect_silent(resources_validate(out))
})

tar_test("tar_resources_network() non-default resources", {
tar_option_set(
resources = tar_resources(
network = tar_resources_network(
seconds_interval = 2,
seconds_timeout = 3,
max_tries = 5,
verbose = FALSE
expect_warning(
tar_option_set(
resources = tar_resources(
network = tar_resources_network(
seconds_interval = 2,
seconds_timeout = 3,
max_tries = 5,
verbose = FALSE
)
)
)
),
class = "tar_warn_deprecate"
)
out <- tar_option_get("resources")$network
expect_equal(out$seconds_interval, 2)
Expand Down

0 comments on commit 68754bf

Please sign in to comment.