Skip to content

Commit

Permalink
fix(libsinsp/test): fix async_key_value_source flakiness
Browse files Browse the repository at this point in the history
Signed-off-by: Roberto Scolaro <[email protected]>
  • Loading branch information
therealbobo authored and poiana committed Nov 7, 2024
1 parent 34a6c0d commit dd8d508
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions userspace/libsinsp/test/async_key_value_source.ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,15 +358,15 @@ TEST(async_key_value_source_test, prune_old_metadata) {
ASSERT_FALSE(source.lookup(key1, response));

// Wait long enough for the old entry to require pruning
std::this_thread::sleep_for(std::chrono::milliseconds(2 * TTL_MS));
usleep(1000 * 2 * TTL_MS);

// Request the other key. This should wake up the thread and actually
// preform the pruning.
ASSERT_FALSE(source.lookup(key2, response));

// Wait long enough for the async thread to get woken up and to
// prune the old entry
std::this_thread::sleep_for(std::chrono::milliseconds(TTL_MS));
usleep(1000 * TTL_MS);

// Since the first key should have been pruned, a second call to
// fetch the first key should also return false.
Expand Down

0 comments on commit dd8d508

Please sign in to comment.