Skip to content

Commit

Permalink
Merge 8fcaa0a into 574cdf5
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivansete-status authored Dec 18, 2023
2 parents 574cdf5 + 8fcaa0a commit e2ab7cd
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions tests/waku_archive/test_driver_postgres_query.nim
Original file line number Diff line number Diff line change
Expand Up @@ -201,18 +201,36 @@ suite "Postgres driver - query by content topic":
require (await driver.put(DefaultPubsubTopic, msg, computeDigest(msg), computeMessageHash(DefaultPubsubTopic, msg), msg.timestamp)).isOk()

## When
let res = await driver.getMessages(
var res = await driver.getMessages(
contentTopic= @[contentTopic1, contentTopic2],
pubsubTopic=some(DefaultPubsubTopic),
maxPageSize=2,
ascendingOrder=true
ascendingOrder=true,
startTime=some(ts(00)),
endTime=some(ts(40))
)

## Then
assert res.isOk(), res.error
var filteredMessages = res.tryGet().mapIt(it[1])
check filteredMessages == expected[2..3]

let filteredMessages = res.tryGet().mapIt(it[1])
check:
filteredMessages == expected[2..3]
## When
## This is very similar to the previous one but we enforce to use the prepared
## statement by querying one single content topic
res = await driver.getMessages(
contentTopic= @[contentTopic1],
pubsubTopic=some(DefaultPubsubTopic),
maxPageSize=2,
ascendingOrder=true,
startTime=some(ts(00)),
endTime=some(ts(40))
)

## Then
assert res.isOk(), res.error
filteredMessages = res.tryGet().mapIt(it[1])
check filteredMessages == @[expected[2]]

## Cleanup
(await driver.close()).expect("driver to close")
Expand Down

0 comments on commit e2ab7cd

Please sign in to comment.