From b33636824d0ac4f4038cd2d00a5f80f4dcb5dd0f Mon Sep 17 00:00:00 2001 From: wlandau-lilly Date: Thu, 30 Nov 2023 16:27:20 -0500 Subject: [PATCH] Use spinners --- tests/backlog/test-seconds_idle.R | 6 ++++-- tests/backlog/test-tasks_max.R | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/backlog/test-seconds_idle.R b/tests/backlog/test-seconds_idle.R index a653e4c6..f715b4c5 100644 --- a/tests/backlog/test-seconds_idle.R +++ b/tests/backlog/test-seconds_idle.R @@ -8,11 +8,12 @@ controller$start() names <- character(0L) index <- 0L n_tasks <- 60000L +spinner <- cli::make_spinner() system.time( while (index < n_tasks || !(controller$empty())) { if (index < n_tasks) { index <- index + 1L - # cat("submit", index, "\n") # nolint + spinner$spin() controller$push( name = as.character(index), command = Sys.sleep(0.005) @@ -20,11 +21,12 @@ system.time( } out <- controller$pop() if (!is.null(out)) { - # cat("collect", out$name, "\n") # nolint + spinner$spin() names[[length(names) + 1L]] <- out$name } } ) +spinner$finish() testthat::expect_equal(sort(as.integer(names)), seq_len(n_tasks)) controller$launcher$workers$launched <- FALSE controller$launcher$tally() diff --git a/tests/backlog/test-tasks_max.R b/tests/backlog/test-tasks_max.R index 013375c8..16c2f2f0 100644 --- a/tests/backlog/test-tasks_max.R +++ b/tests/backlog/test-tasks_max.R @@ -8,11 +8,12 @@ controller$start() names <- character(0L) index <- 0L n_tasks <- 60000L +spinner <- cli::make_spinner() system.time( while (index < n_tasks || !(controller$empty())) { if (index < n_tasks) { index <- index + 1L - # cat("submit", index, "\n") # nolint + spinner$spin() controller$push( name = as.character(index), command = TRUE @@ -20,11 +21,12 @@ system.time( } out <- controller$pop() if (!is.null(out)) { - # cat("collect", out$name, "\n") # nolint + spinner$spin() names[[length(names) + 1L]] <- out$name } } ) +spinner$finish() testthat::expect_equal(sort(as.integer(names)), seq_len(n_tasks)) controller$launcher$workers$launched <- FALSE controller$launcher$tally()