test_waku_store.nim: add logs to better analyse uncertain flaky tests (#2740)

This commit is contained in:
Ivan FB 2024-05-29 10:05:07 +02:00 committed by GitHub
parent 302a171416
commit 25a1aa9231
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 27 additions and 1 deletions

View File

@ -17,12 +17,15 @@ import
suite "Waku Store - query handler": suite "Waku Store - query handler":
asyncTest "history query handler should be called": asyncTest "history query handler should be called":
info "check point" # log added to track flaky test
## Setup ## Setup
let let
serverSwitch = newTestSwitch() serverSwitch = newTestSwitch()
clientSwitch = newTestSwitch() clientSwitch = newTestSwitch()
info "check point" # log added to track flaky test
await allFutures(serverSwitch.start(), clientSwitch.start()) await allFutures(serverSwitch.start(), clientSwitch.start())
info "check point" # log added to track flaky test
## Given ## Given
let serverPeerInfo = serverSwitch.peerInfo.toRemotePeerInfo() let serverPeerInfo = serverSwitch.peerInfo.toRemotePeerInfo()
@ -52,7 +55,9 @@ suite "Waku Store - query handler":
) )
## When ## When
info "check point" # log added to track flaky test
let queryRes = await client.query(req, peer = serverPeerInfo) let queryRes = await client.query(req, peer = serverPeerInfo)
info "check point" # log added to track flaky test
## Then ## Then
check: check:
@ -69,15 +74,20 @@ suite "Waku Store - query handler":
response.messages == @[kv] response.messages == @[kv]
## Cleanup ## Cleanup
info "check point" # log added to track flaky test
await allFutures(serverSwitch.stop(), clientSwitch.stop()) await allFutures(serverSwitch.stop(), clientSwitch.stop())
info "check point" # log added to track flaky test
asyncTest "history query handler should be called and return an error": asyncTest "history query handler should be called and return an error":
info "check point" # log added to track flaky test
## Setup ## Setup
let let
serverSwitch = newTestSwitch() serverSwitch = newTestSwitch()
clientSwitch = newTestSwitch() clientSwitch = newTestSwitch()
info "check point" # log added to track flaky test
await allFutures(serverSwitch.start(), clientSwitch.start()) await allFutures(serverSwitch.start(), clientSwitch.start())
info "check point" # log added to track flaky test
## Given ## Given
let serverPeerInfo = serverSwitch.peerInfo.toRemotePeerInfo() let serverPeerInfo = serverSwitch.peerInfo.toRemotePeerInfo()
@ -116,4 +126,6 @@ suite "Waku Store - query handler":
error.kind == ErrorCode.BAD_REQUEST error.kind == ErrorCode.BAD_REQUEST
## Cleanup ## Cleanup
info "check point" # log added to track flaky test
await allFutures(serverSwitch.stop(), clientSwitch.stop()) await allFutures(serverSwitch.stop(), clientSwitch.stop())
info "check point" # log added to track flaky test

View File

@ -13,17 +13,21 @@ import
../testlib/[common, wakucore], ../testlib/[common, wakucore],
./store_utils ./store_utils
suite "Waku Store - query handler": suite "Waku Store - query handler legacy":
asyncTest "history query handler should be called": asyncTest "history query handler should be called":
info "check point" # log added to track flaky test
## Setup ## Setup
let let
serverSwitch = newTestSwitch() serverSwitch = newTestSwitch()
clientSwitch = newTestSwitch() clientSwitch = newTestSwitch()
info "check point" # log added to track flaky test
await allFutures(serverSwitch.start(), clientSwitch.start()) await allFutures(serverSwitch.start(), clientSwitch.start())
info "check point" # log added to track flaky test
## Given ## Given
let serverPeerInfo = serverSwitch.peerInfo.toRemotePeerInfo() let serverPeerInfo = serverSwitch.peerInfo.toRemotePeerInfo()
info "check point" # log added to track flaky test
let msg = fakeWakuMessage(contentTopic = DefaultContentTopic) let msg = fakeWakuMessage(contentTopic = DefaultContentTopic)
@ -44,7 +48,9 @@ suite "Waku Store - query handler":
) )
## When ## When
info "check point" # log added to track flaky test
let queryRes = await client.query(req, peer = serverPeerInfo) let queryRes = await client.query(req, peer = serverPeerInfo)
info "check point" # log added to track flaky test
## Then ## Then
check: check:
@ -61,15 +67,19 @@ suite "Waku Store - query handler":
response.messages == @[msg] response.messages == @[msg]
## Cleanup ## Cleanup
info "check point" # log added to track flaky test
await allFutures(serverSwitch.stop(), clientSwitch.stop()) await allFutures(serverSwitch.stop(), clientSwitch.stop())
info "check point" # log added to track flaky test
asyncTest "history query handler should be called and return an error": asyncTest "history query handler should be called and return an error":
info "check point" # log added to track flaky test
## Setup ## Setup
let let
serverSwitch = newTestSwitch() serverSwitch = newTestSwitch()
clientSwitch = newTestSwitch() clientSwitch = newTestSwitch()
await allFutures(serverSwitch.start(), clientSwitch.start()) await allFutures(serverSwitch.start(), clientSwitch.start())
info "check point" # log added to track flaky test
## Given ## Given
let serverPeerInfo = serverSwitch.peerInfo.toRemotePeerInfo() let serverPeerInfo = serverSwitch.peerInfo.toRemotePeerInfo()
@ -89,8 +99,10 @@ suite "Waku Store - query handler":
contentTopics: @[DefaultContentTopic], direction: PagingDirection.FORWARD contentTopics: @[DefaultContentTopic], direction: PagingDirection.FORWARD
) )
info "check point" # log added to track flaky test
## When ## When
let queryRes = await client.query(req, peer = serverPeerInfo) let queryRes = await client.query(req, peer = serverPeerInfo)
info "check point" # log added to track flaky test
## Then ## Then
check: check:
@ -106,4 +118,6 @@ suite "Waku Store - query handler":
error.kind == HistoryErrorKind.BAD_REQUEST error.kind == HistoryErrorKind.BAD_REQUEST
## Cleanup ## Cleanup
info "check point" # log added to track flaky test
await allFutures(serverSwitch.stop(), clientSwitch.stop()) await allFutures(serverSwitch.stop(), clientSwitch.stop())
info "check point" # log added to track flaky test