-
Notifications
You must be signed in to change notification settings - Fork 226
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
Implement SearchValue/GetValue #942
Conversation
8b4b920
to
2779cff
Compare
Related: #945 |
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.
Looks good, just a few comments, nothing too substantial
// acknowledgement that the other peer has received the data is not | ||
// guaranteed. The data will be flushed at this point, but the remote might | ||
// not have handled it yet. Therefore, we use "EventuallyWithT" here. | ||
assert.EventuallyWithT(t, func(t *assert.CollectT) { |
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.
We control both peers in this test so can't we deterministically query the remote peer to see if the data has been handled?
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.
In the function body, I'm querying the remote peer to see if the data has been handled. Because of the reasons in the comment above I'm not sure how we can do this deterministically.
I could pass a custom Backend/Datastore to d2 and use a wait group to block until it's stored on the other peer 🤔
|
||
func TestDHT_Bootstrap_no_peers_configured(t *testing.T) { | ||
// TIMING: this test is based on timeouts - so might become flaky! | ||
ctx := kadtest.CtxShort(t) |
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.
We could run timing based tests for longer. CtxShort is for tests that we expect to complete quickly - either the result is processed quickly or it never happens because something is broken. We could have another helper function that always returns a context with a deadline just before the test deadline so the test has the full allotted time to complete
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.
Both of the timing-sensitive tests run very fast. It's just that the state doesn't manifests at the remote peers immediately.
97e9fbe
to
b031121
Compare
fixes #911
fixes #912
Todo
// TODO