From 608fd9dac6cc4af7a2cee6842910f3e8c06249c5 Mon Sep 17 00:00:00 2001 From: NagyZoltanPeter <113987313+NagyZoltanPeter@users.noreply.github.com> Date: Tue, 6 Jan 2026 20:46:42 +0100 Subject: [PATCH] Adjust store test rate limit to eliminate CI test flakyness of timing - lightpush/legacy_lightpush/filter --- .../test_waku_filter_dos_protection.nim | 12 ++++++------ tests/waku_lightpush/test_ratelimit.nim | 2 +- tests/waku_lightpush_legacy/test_ratelimit.nim | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/waku_filter_v2/test_waku_filter_dos_protection.nim b/tests/waku_filter_v2/test_waku_filter_dos_protection.nim index 70055471b..30a5a8f5d 100644 --- a/tests/waku_filter_v2/test_waku_filter_dos_protection.nim +++ b/tests/waku_filter_v2/test_waku_filter_dos_protection.nim @@ -122,15 +122,15 @@ suite "Waku Filter - DOS protection": check client2.subscribe(serverRemotePeerInfo, pubsubTopic, contentTopicSeq) == none(FilterSubscribeErrorKind) - await sleepAsync(20.milliseconds) + await sleepAsync(5.milliseconds) check client1.subscribe(serverRemotePeerInfo, pubsubTopic, contentTopicSeq) == none(FilterSubscribeErrorKind) check client2.subscribe(serverRemotePeerInfo, pubsubTopic, contentTopicSeq) == none(FilterSubscribeErrorKind) - await sleepAsync(20.milliseconds) + await sleepAsync(5.milliseconds) check client1.subscribe(serverRemotePeerInfo, pubsubTopic, contentTopicSeq) == none(FilterSubscribeErrorKind) - await sleepAsync(20.milliseconds) + await sleepAsync(5.milliseconds) check client1.subscribe(serverRemotePeerInfo, pubsubTopic, contentTopicSeq) == some(FilterSubscribeErrorKind.TOO_MANY_REQUESTS) check client2.subscribe(serverRemotePeerInfo, pubsubTopic, contentTopicSeq) == @@ -170,14 +170,14 @@ suite "Waku Filter - DOS protection": # After another ~500ms, ~1 token refilled; PING consumes 1 => expected remaining: 2 - await sleepAsync(50.milliseconds) + await sleepAsync(10.milliseconds) check client1.unsubscribe(serverRemotePeerInfo, pubsubTopic, contentTopicSeq) == none(FilterSubscribeErrorKind) check wakuFilter.subscriptions.isSubscribed(client1.clientPeerId) == false - # ~50ms is not enough to refill a token at 3/sec; UNSUBSCRIBE consumes 1 => expected remaining: 1 + # ~10ms is not enough to refill a token at 3/sec; UNSUBSCRIBE consumes 1 => expected remaining: 1 - await sleepAsync(50.milliseconds) + await sleepAsync(10.milliseconds) check client1.ping(serverRemotePeerInfo) == some(FilterSubscribeErrorKind.NOT_FOUND) # PING consumes the last token => expected remaining: 0 diff --git a/tests/waku_lightpush/test_ratelimit.nim b/tests/waku_lightpush/test_ratelimit.nim index 7420a4e56..8f4cc5ad1 100644 --- a/tests/waku_lightpush/test_ratelimit.nim +++ b/tests/waku_lightpush/test_ratelimit.nim @@ -124,7 +124,7 @@ suite "Rate limited push service": for testCnt in 0 .. 2: await successProc() - await sleepAsync(20.millis) + await sleepAsync(5.millis) await rejectProc() diff --git a/tests/waku_lightpush_legacy/test_ratelimit.nim b/tests/waku_lightpush_legacy/test_ratelimit.nim index 3df8d369d..c71711461 100644 --- a/tests/waku_lightpush_legacy/test_ratelimit.nim +++ b/tests/waku_lightpush_legacy/test_ratelimit.nim @@ -130,7 +130,7 @@ suite "Rate limited push service": for testCnt in 0 .. 2: await successProc() - await sleepAsync(20.millis) + await sleepAsync(5.millis) await rejectProc()