-
Notifications
You must be signed in to change notification settings - Fork 57
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
chore: unit test for duplicate message push #2852
Conversation
You can find the image built from this PR at
Built from 7749908 |
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.
Thanks for this! I haven't checked in in deep detail but we need to have fast tests :)
Cheers
len(messages1.data) == 1 | ||
|
||
# Pause execution for 2 minutes to test TimeCache functionality of service node | ||
sleep(120000) |
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, unfortunately we can't wait for so long in a single test
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.
agree, we should make it configurable and just configure a lower value for testing
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.
@darshankabariya : I think you need to extend here the mountFilter with a defaulted TTL argument that can be passed to WakuFilter.new...
Line 439 in 18f7a0a
maxFilterCriteriaPerPeer: uint32 = filter_subscriptions.MaxFilterCriteriaPerPeer, |
Than in the test code in the setup part, at testSetup.serviceNode.mountFilter
add a test TTL delay as 1.seconds at max, but maybe 500.milliseconds also fine.
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.
Please adjust mountFilter with the dup check TTL config and than you are able to configure this test's timeout to be short.
len(messages1.data) == 1 | ||
|
||
# Pause execution for 2 minutes to test TimeCache functionality of service node | ||
sleep(120000) |
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.
@darshankabariya : I think you need to extend here the mountFilter with a defaulted TTL argument that can be passed to WakuFilter.new...
Line 439 in 18f7a0a
maxFilterCriteriaPerPeer: uint32 = filter_subscriptions.MaxFilterCriteriaPerPeer, |
Than in the test code in the setup part, at testSetup.serviceNode.mountFilter
add a test TTL delay as 1.seconds at max, but maybe 500.milliseconds also fine.
1dfd377
to
9cfaf90
Compare
I’ve been updating the tests based on your suggestions. However, I encountered an issue with |
Yeah, saw and fixed that. It was a wrong import std/times instead of chronos/timer. Now it compiles I think. |
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 think it will be ok now with 1 sec delay for test.
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.
Compile error is fixed but test fails unfortunately:
2024-06-28T00:09:14.7098245Z /home/runner/work/nwaku/nwaku/build/all_tests_waku 'Waku v2 Rest API - Filter V2::duplicate message push to filter subscriber ( sleep in between )'
2024-06-28T00:09:14.7099205Z ----------------------------------------------------------------
2024-06-28T00:09:14.7099981Z /home/runner/work/nwaku/nwaku/tests/wakunode_rest/test_rest_filter.nim(462, 26): Check failed: len(messages2.data) == 1
2024-06-28T00:09:14.7100699Z len(messages2.data) was 0
2024-06-28T00:09:14.7100903Z
2024-06-28T00:09:14.7101289Z [FAILED ] ( 0.02s) duplicate message push to filter subscriber ( sleep in between )�[0m
2024-06-28T00:09:14.7101714Z
2024-06-28T00:09:14.7101870Z (0.09s) Waku v2 Rest API - Filter V2```
13f0baf
to
8a68bd4
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.
As soon as the tests pass it is very well done!!!
len(messages1.data) == 1 | ||
|
||
# Pause execution for 2 minutes to test TimeCache functionality of service node | ||
sleep(1000) |
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 see, it was the issue!
Maybe to change it for a more commonly used version:
sleep(1000) | |
await sleepAsync(1.seconds) |
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.
Just a side note: using async sleep will not stop the whole thread so async tests can run meanwhile.
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.
await sleepAsync(1.seconds)
oh that's awesome !
postMsgResponse1.data == "OK" | ||
len(messages1.data) == 1 | ||
|
||
# Pause execution for 2 minutes to test TimeCache functionality of service node |
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.
# Pause execution for 2 minutes to test TimeCache functionality of service node | |
# Pause execution for 1 second to test TimeCache functionality of service node |
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! Thanks! Make sure Zoltán's comments are considered before merging :)
Sure ! |
It's related to #2320
It's test duplicate message push from filter service node to filter client