From 6ce4d19931816155eaa98fc4eb173bebc9f07dc5 Mon Sep 17 00:00:00 2001 From: hq1 Date: Wed, 7 Feb 2024 08:59:00 +0100 Subject: [PATCH] Fix flaky test: wait till ets is emptied (#3755) * Fix flaky test: wait till ets is emptied * fixup --- test/plausible/rate_limit_test.exs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/plausible/rate_limit_test.exs b/test/plausible/rate_limit_test.exs index e6d137e1b..6c6230b75 100644 --- a/test/plausible/rate_limit_test.exs +++ b/test/plausible/rate_limit_test.exs @@ -21,9 +21,9 @@ defmodule Plausible.RateLimitTest do assert expires_at >= System.system_time(:millisecond) assert expires_at <= System.system_time(:millisecond) + 50 - :timer.sleep(150) - - assert :ets.tab2list(@table) == [] + Plausible.TestUtils.eventually(fn -> + {:ets.tab2list(@table) == [], :done} + end) end end