fix: making filter admin data test order independent (#2355)

This commit is contained in:
gabrielmer 2024-01-17 09:42:22 +01:00 committed by GitHub
parent c3358409bb
commit 8a9fad2905
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 12 deletions

View File

@ -107,16 +107,6 @@ suite "Waku v2 Rest API - Admin":
pubsubTopicNode2 = DefaultPubsubTopic
pubsubTopicNode3 = PubsubTopic("/waku/2/custom-waku/proto")
## TODO: Note that such checks may depend heavily on the order of the returned data!
expectedFilterData2 = fmt"(peerId: ""{$peerInfo2}"", filterCriteria:" &
fmt" @[(pubsubTopic: ""{pubsubTopicNode2}"", contentTopic: ""{contentFiltersNode2[1]}""), " &
fmt"(pubsubTopic: ""{pubsubTopicNode2}"", contentTopic: ""{contentFiltersNode2[2]}""), " &
fmt"(pubsubTopic: ""{pubsubTopicNode2}"", contentTopic: ""{contentFiltersNode2[0]}"")]"
expectedFilterData3 = fmt"(peerId: ""{$peerInfo3}"", filterCriteria:" &
fmt" @[(pubsubTopic: ""{pubsubTopicNode3}"", contentTopic: ""{contentFiltersNode3[0]}""), " &
fmt"(pubsubTopic: ""{pubsubTopicNode3}"", contentTopic: ""{contentFiltersNode3[1]}"")]"
let
subscribeResponse2 = await node2.wakuFilterClient.subscribe(
peerInfo1, pubsubTopicNode2, contentFiltersNode2
@ -134,8 +124,16 @@ suite "Waku v2 Rest API - Admin":
getRes.status == 200
$getRes.contentType == $MIMETYPE_JSON
getRes.data.len() == 2
($getRes.data).contains(expectedFilterData2)
($getRes.data).contains(expectedFilterData3)
let
peers = @[getRes.data[0].peerId, getRes.data[1].peerId]
numCriteria = @[getRes.data[0].filterCriteria.len, getRes.data[1].filterCriteria.len]
check:
$peerInfo2 in peers
$peerInfo3 in peers
2 in numCriteria
3 in numCriteria
asyncTest "Get filter data - no filter subscribers":
await node1.mountFilter()