Skip to content

Commit

Permalink
utils: deflake external process test
Browse files Browse the repository at this point in the history
the time interval started after the process started, which means that it
was going to measure a time less than the execution time and this was
also excluding any scheduling latency. also increased test time to be
more robust against scheduling issues.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
  • Loading branch information
dotnwat committed Sep 11, 2024
1 parent f415ee5 commit a696800
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/v/utils/tests/external_process_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ TEST_CORO(external_process, echo_hi) {
TEST_CORO(external_process, run_long_process) {
using namespace std::chrono_literals;

auto start_time = std::chrono::high_resolution_clock::now();
auto proc
= co_await external_process::external_process::create_external_process(
{"/bin/sleep", "3"});
auto start_time = std::chrono::high_resolution_clock::now();
{"/bin/sleep", "10"});
auto res = co_await proc->wait();
auto end_time = std::chrono::high_resolution_clock::now();
ASSERT_TRUE_CORO(
Expand All @@ -99,7 +99,7 @@ TEST_CORO(external_process, run_long_process) {
EXPECT_GE(
std::chrono::duration_cast<std::chrono::seconds>(end_time - start_time)
.count(),
3);
10);
}

TEST_CORO(external_process, run_long_process_and_terminate) {
Expand Down

0 comments on commit a696800

Please sign in to comment.