-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test(waku-filter): Subscribe tests batch (4/4) #2057
test(waku-filter): Subscribe tests batch (4/4) #2057
Conversation
You can find the image built from this PR at
Built from beafee4 |
b21dd97
to
04da8b5
Compare
ac02255
to
b354235
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented some questions, mostly regarding style and not the logic itself.
For the rest I still have some hw to do, need to first get more familiar with the filter protocol. Working on it and hopefully I'll be able to add more feedback on it soon :)
I think it's best to add one or two more reviewers to the PR, ideally including someone that has already worked with filter.
tests/node/test_wakunode_filter.nim
Outdated
import | ||
std/sequtils, | ||
std/options, | ||
stew/shims/net as stewNet, | ||
testutils/unittests, | ||
chronicles, | ||
chronos, | ||
libp2p/crypto/crypto | ||
|
||
import | ||
std/[options, tables, sequtils], | ||
testutils/unittests, | ||
chronos, | ||
chronicles, | ||
os, | ||
libp2p/peerstore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason for having two separate import statements and with some repeated modules?
I think it's better to combine them into one import statement without duplicates
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I followed the style I saw in sibling files. I think the reasoning is to separate builtin
and third-party
imports from local ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but in this case there's 3 import statements instead of 2 and chronos
, chronicles
and some other modules are being imported twice:
nwaku/tests/node/test_wakunode_filter.nim
Lines 3 to 31 in b354235
import | |
std/sequtils, | |
std/options, | |
stew/shims/net as stewNet, | |
testutils/unittests, | |
chronicles, | |
chronos, | |
libp2p/crypto/crypto | |
import | |
std/[options, tables, sequtils], | |
testutils/unittests, | |
chronos, | |
chronicles, | |
os, | |
libp2p/peerstore | |
import | |
../../../waku/waku_core, | |
../../../waku/node/peer_manager, | |
../../../waku/node/waku_node, | |
../../../waku/waku_filter_v2, | |
../../../waku/waku_filter_v2/client, | |
../../../waku/waku_filter_v2/subscriptions, | |
../testlib/common, | |
../testlib/wakucore, | |
../testlib/wakunode, | |
../testlib/testasync, | |
../testlib/futures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, that. It seems my brain just read the first half and assummed the second part. You're completely right, changing that.
tests/testlib/futures.nim
Outdated
import | ||
# std/sequtils, | ||
# std/options, | ||
# stew/shims/net as stewNet, | ||
# testutils/unittests, | ||
chronicles, | ||
chronos | ||
# libp2p/crypto/crypto |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I would delete the lines with unused modules instead of commenting them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes. Oversight when testing. Thanks!
@@ -18,6 +18,7 @@ import | |||
../testlib/wakucore, | |||
../testlib/testasync, | |||
../testlib/testutils, | |||
../testlib/futures, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is a new import required if no code is being added to this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I moved the newPushHandlerFuture
in waku_filter_utils
(already imported) into the new futures
module, as that function will also be used outside waku filter tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Added one comment with a small nitpick - tests looks great 🔥
Thank you!
var messagePushHandler {.threadvar.}: FilterPushHandler | ||
|
||
asyncSetup: | ||
pushHandlerFuture = newFuture[(string, WakuMessage)]() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a super nit but for consistency I would use here newPushHandlerFuture()
like in the unsubscribed test case
04da8b5
to
8489508
Compare
221db09
to
c1881a8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great PR! LGTM! Just added a tiny comment
check: | ||
subscribeResponse.isOk() | ||
server.wakuFilter.subscriptions.len == 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check: | |
subscribeResponse.isOk() | |
server.wakuFilter.subscriptions.len == 1 | |
assert subscribeResponse.isOk(), $subscribeResponse.error | |
check server.wakuFilter.subscriptions.len == 1 |
If possible, I'd apply that elsewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed! Must've slipped my mind. I'm planning to do a "standardising" PR after I finish the current one I'm working on to mend all places I skipped.
8489508
to
f6a3779
Compare
c1881a8
to
ed5ab6e
Compare
f6a3779
to
14b9eac
Compare
ed5ab6e
to
700fa71
Compare
14b9eac
to
688194c
Compare
700fa71
to
47017d3
Compare
70e8b7b
into
test-waku-filter-subscribe-3
Description
Implement fourth (and last) batch of subscribe tests for waku filter, the service to service ones.
Changes
Dependencies
#2046