fix: improve filter test race condition (#1529)

* fix: improve filter test race condition

* fix: missed one sleep
This commit is contained in:
Hanno Cornelius 2023-02-03 10:00:26 +02:00 committed by GitHub
parent 94459b4886
commit f36d708e76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 291 additions and 291 deletions

View File

@ -69,11 +69,11 @@ suite "Waku Filter":
require (await client.subscribe(pubsubTopic, contentTopic, pushHandler, peer=serverAddr)).isOk()
# WARN: Sleep necessary to avoid a race condition between the subscription and the handle message proc
await sleepAsync(5.milliseconds)
await sleepAsync(500.milliseconds)
await server.handleMessage(pubsubTopic, msg)
require await pushHandlerFuture.withTimeout(5.seconds)
require await pushHandlerFuture.withTimeout(3.seconds)
## Then
let (pushedMsgPubsubTopic, pushedMsg) = pushHandlerFuture.read()
@ -112,7 +112,7 @@ suite "Waku Filter":
require (await client.subscribe(pubsubTopic, contentTopic, pushHandler, peer=serverAddr)).isOk()
# WARN: Sleep necessary to avoid a race condition between the subscription and the handle message proc
await sleepAsync(5.milliseconds)
await sleepAsync(500.milliseconds)
await server.handleMessage(pubsubTopic, msg)
@ -124,7 +124,7 @@ suite "Waku Filter":
require (await client.unsubscribe(pubsubTopic, contentTopic, peer=serverAddr)).isOk()
# WARN: Sleep necessary to avoid a race condition between the unsubscription and the handle message proc
await sleepAsync(5.milliseconds)
await sleepAsync(500.milliseconds)
await server.handleMessage(pubsubTopic, msg)
@ -164,7 +164,7 @@ suite "Waku Filter":
require (await client.subscribe(pubsubTopic, contentTopic, pushHandler, peer=serverAddr)).isOk()
# WARN: Sleep necessary to avoid a race condition between the unsubscription and the handle message proc
await sleepAsync(5.milliseconds)
await sleepAsync(500.milliseconds)
await server.handleMessage(DefaultPubsubTopic, msg)
@ -174,7 +174,7 @@ suite "Waku Filter":
# Stop client node to test timeout unsubscription
await clientSwitch.stop()
await sleepAsync(5.milliseconds)
await sleepAsync(500.milliseconds)
# First failure should not remove the subscription
await server.handleMessage(DefaultPubsubTopic, msg)
@ -229,7 +229,7 @@ suite "Waku Filter":
require (await client.subscribe(pubsubTopic, contentTopic, pushHandler, peer=serverAddr)).isOk()
# WARN: Sleep necessary to avoid a race condition between the unsubscription and the handle message proc
await sleepAsync(5.milliseconds)
await sleepAsync(500.milliseconds)
await server.handleMessage(DefaultPubsubTopic, msg)
@ -243,7 +243,7 @@ suite "Waku Filter":
# Stop switch to test unsubscribe
await clientSwitch.stop()
await sleepAsync(5.milliseconds)
await sleepAsync(500.milliseconds)
# First failure should add to failure list
await server.handleMessage(DefaultPubsubTopic, msg)