-
Notifications
You must be signed in to change notification settings - Fork 240
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
Fix flaky TestEmptyTableTest #433
Fix flaky TestEmptyTableTest #433
Conversation
@@ -805,7 +805,7 @@ func TestEmptyTable(t *testing.T) { | |||
ctx, cancel := context.WithCancel(context.Background()) | |||
defer cancel() | |||
|
|||
nDHTs := 50 // needs more than 40 peers so we don't add all of them to our routing table. |
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.
@Stebalien Why did we assume here that not all peers will get added to the RT ?
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 can't remember but I was probably thinking something along the lines of: Given 50 peers, about half of them will differ in the first bit. That means we'll have 25 candidates for the first bucket, leaving 5 peers out.
But there's still a high probability that this won't be the case.
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! This looks like the right fix.
@@ -805,7 +805,7 @@ func TestEmptyTable(t *testing.T) { | |||
ctx, cancel := context.WithCancel(context.Background()) | |||
defer cancel() | |||
|
|||
nDHTs := 50 // needs more than 40 peers so we don't add all of them to our routing table. |
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 can't remember but I was probably thinking something along the lines of: Given 50 peers, about half of them will differ in the first bit. That means we'll have 25 candidates for the first bucket, leaving 5 peers out.
But there's still a high probability that this won't be the case.
For #426
@Stebalien Please review.
Proof
There is nothing that will prevent all the peers from being added to the RT if the stars/randomly generated hostID cpl's align. We should remove one peer from the RT so that not all peers end up getting disconnected.