-
Notifications
You must be signed in to change notification settings - Fork 27
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
E2E flaky test fix #462
E2E flaky test fix #462
Conversation
60b67d5
to
e25618b
Compare
e13a05b
to
81705aa
Compare
81705aa
to
efe0554
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.
Lots of formatting only changes but the core of the fix makes sense to me.
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.
Nice find! One comment to revert an unrelated change.
tests/local/network.go
Outdated
@@ -464,7 +471,7 @@ func (n *LocalNetwork) AddSubnetValidators(ctx context.Context, subnetID ids.ID, | |||
|
|||
// consume some of the extraNodes | |||
newValidatorNodes := n.extraNodes[0:count] | |||
defer slices.Delete(n.extraNodes, 0, int(count)) | |||
copy(n.extraNodes, n.extraNodes[count:]) |
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.
This will still preserve the nodes to be deleted in n.extraNodes
, since n.extraNodes[count:]
is a subset. See example here: https://go.dev/play/p/z8RhPp136sr
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.
Fixed by copying the newValidatorNodes
from extraNodes
and then just assigning extraNodes
to the subset.
@@ -470,8 +470,9 @@ func (n *LocalNetwork) AddSubnetValidators(ctx context.Context, subnetID ids.ID, | |||
)] | |||
|
|||
// consume some of the extraNodes | |||
newValidatorNodes := n.extraNodes[0:count] | |||
copy(n.extraNodes, n.extraNodes[count:]) | |||
var newValidatorNodes []*tmpnet.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.
var newValidatorNodes []*tmpnet.Node | |
newValidatorNodes := make([]*tmpnet.Node, len(n.extraNodes[0:count])) |
We need to preallocate the destination, otherwise nothing will be copied. Example
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.
The append
approach you adopted also works.
Why this should be merged
Fixes test flakiness introduced with the switchover to tmpnet.
Also contains some formatting
How this works
Sorts the slice created by
GetSubnetsInfo()
before returning it. We were adding items to a slice by ranging over a map, which gives a random order. Therefore callingGetTwoSubnets()
could return the two subnets in the opposite order if called twice in one test.How this was tested
Existing E2E tests.
How is this documented
N/A