diff options
author | Nick Vatamaniuc <vatamane@apache.org> | 2023-03-04 00:59:19 -0500 |
---|---|---|
committer | Nick Vatamaniuc <nickva@users.noreply.github.com> | 2023-03-04 02:38:45 -0500 |
commit | 7ec5f645f58562fdff8a1bf1865f7c6191f4c1ab (patch) | |
tree | de1614af3802ab2ae87efcf82d2316eed57f93c7 | |
parent | b8abb4aad40d2826aae695aef48d866f62c83185 (diff) | |
download | couchdb-7ec5f645f58562fdff8a1bf1865f7c6191f4c1ab.tar.gz |
Fix flaky LRU test
Try to fix flaky test which was noticed on the MacOS CI worker [1]:
```
[2023-02-17T07:40:34.978Z] ets_lru_test:285: -test_limits/2-fun-7- (Expire leaves new entries)...ok
[2023-02-17T07:40:34.978Z] ets_lru_test:292: -test_limits/2-fun-5- (Entry was expired)...*failed*
[2023-02-17T07:40:34.978Z] in function ets_lru_test:'-test_limits/2-fun-5-'/2 (test/ets_lru_test.erl, line 294)
```
[1] https://github.com/apache/couchdb/issues/4397#issuecomment-1434764920
-rw-r--r-- | src/ets_lru/test/ets_lru_test.erl | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ets_lru/test/ets_lru_test.erl b/src/ets_lru/test/ets_lru_test.erl index 5dd193f8d..be003bee2 100644 --- a/src/ets_lru/test/ets_lru_test.erl +++ b/src/ets_lru/test/ets_lru_test.erl @@ -291,6 +291,12 @@ test_limits([{max_lifetime, N}], {ok, LRU}) -> "Entry was expired", ?_test(begin timer:sleep(round(N * 1.5)), + test_util:wait(fun() -> + case ets_lru:lookup(LRU, foo) of + not_found -> ok; + _ -> wait + end + end), ?assertEqual(not_found, ets_lru:lookup(LRU, foo)) end) } |