Skip to content

Commit

Permalink
temporary logs macos tests failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivansete-status committed May 28, 2024
1 parent 9b2c3bc commit 60a5882
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
17 changes: 17 additions & 0 deletions tests/waku_store/test_waku_store.nim
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,30 @@ import

suite "Waku Store - query handler":
asyncTest "history query handler should be called":
info "ivan"
## Setup
let
serverSwitch = newTestSwitch()
clientSwitch = newTestSwitch()
info "ivan"

await allFutures(serverSwitch.start(), clientSwitch.start())
info "ivan"

## Given
let serverPeerInfo = serverSwitch.peerInfo.toRemotePeerInfo()
info "ivan"

let msg = fakeWakuMessage(contentTopic = DefaultContentTopic)
info "ivan"
let hash = computeMessageHash(DefaultPubsubTopic, msg)
let kv = WakuMessageKeyValue(
messageHash: hash, message: some(msg), pubsubTopic: some(DefaultPubsubTopic)
)
info "ivan"

var queryHandlerFut = newFuture[(StoreQueryRequest)]()
info "ivan"

let queryHandler = proc(
req: StoreQueryRequest
Expand All @@ -42,22 +49,27 @@ suite "Waku Store - query handler":
request.requestId = "" # Must remove the id for equality
queryHandlerFut.complete(request)
return ok(StoreQueryResponse(messages: @[kv]))
info "ivan"

let
server = await newTestWakuStore(serverSwitch, handler = queryhandler)
client = newTestWakuStoreClient(clientSwitch)
info "ivan"

let req = StoreQueryRequest(
contentTopics: @[DefaultContentTopic], paginationForward: PagingDirection.FORWARD
)
info "ivan"

## When
let queryRes = await client.query(req, peer = serverPeerInfo)
info "ivan"

## Then
check:
not queryHandlerFut.failed()
queryRes.isOk()
info "ivan"

let request = queryHandlerFut.read()
check:
Expand All @@ -69,9 +81,12 @@ suite "Waku Store - query handler":
response.messages == @[kv]

## Cleanup
info "ivan"
await allFutures(serverSwitch.stop(), clientSwitch.stop())
info "ivan"

asyncTest "history query handler should be called and return an error":
info "ivan"
## Setup
let
serverSwitch = newTestSwitch()
Expand Down Expand Up @@ -116,4 +131,6 @@ suite "Waku Store - query handler":
error.kind == ErrorCode.BAD_REQUEST

## Cleanup
info "ivan"
await allFutures(serverSwitch.stop(), clientSwitch.stop())
info "ivan"
11 changes: 10 additions & 1 deletion tests/waku_store_legacy/test_waku_store.nim
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ import
../testlib/[common, wakucore],
./store_utils

suite "Waku Store - query handler":
suite "Waku Store - query handler legacy":
asyncTest "history query handler should be called":
info "ivan"
## Setup
let
serverSwitch = newTestSwitch()
clientSwitch = newTestSwitch()
info "ivan"

await allFutures(serverSwitch.start(), clientSwitch.start())
info "ivan"

## Given
let serverPeerInfo = serverSwitch.peerInfo.toRemotePeerInfo()
Expand Down Expand Up @@ -61,13 +64,17 @@ suite "Waku Store - query handler":
response.messages == @[msg]

## Cleanup
info "ivan"
await allFutures(serverSwitch.stop(), clientSwitch.stop())
info "ivan"

asyncTest "history query handler should be called and return an error":
info "ivan"
## Setup
let
serverSwitch = newTestSwitch()
clientSwitch = newTestSwitch()
info "ivan"

await allFutures(serverSwitch.start(), clientSwitch.start())

Expand Down Expand Up @@ -106,4 +113,6 @@ suite "Waku Store - query handler":
error.kind == HistoryErrorKind.BAD_REQUEST

## Cleanup
info "ivan"
await allFutures(serverSwitch.stop(), clientSwitch.stop())
info "ivan"

0 comments on commit 60a5882

Please sign in to comment.