Adjust store test rate limit to eliminate CI test flakyness of timing - lightpush/legacy_lightpush/filter

This commit is contained in:
NagyZoltanPeter 2026-01-06 20:46:42 +01:00
parent 73b5cc9654
commit 608fd9dac6
No known key found for this signature in database
GPG Key ID: 3E1F97CF4A7B6F42
3 changed files with 8 additions and 8 deletions

View File

@ -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

View File

@ -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()

View File

@ -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()