Deflake faster joins tests by leaving rooms as part of test cleanup#626
Merged
Deflake faster joins tests by leaving rooms as part of test cleanup#626
Conversation
added 3 commits
March 10, 2023 19:37
This will allow test setup and teardown to expect PDUs and EDUs independently of tests. In a future commit, test teardown will leave rooms as part of cleanup and expect to see a corresponding leave event.
Make the homeserver under test leave test rooms at the end of each test, so that it stops trying to contact other homeservers in the room. Signed-off-by: Sean Quah <seanq@matrix.org>
DMRobertson
approved these changes
Mar 15, 2023
Contributor
DMRobertson
left a comment
There was a problem hiding this comment.
LGTM, huge thanks for this!
| s.pduHandlers[pduHandlerKey] = pduHandler | ||
|
|
||
| return func() { | ||
| delete(s.pduHandlers, pduHandlerKey) |
Contributor
There was a problem hiding this comment.
is this roughly equivalent to del s.pduHandlers[pduHandlerKey] in Python?
| leaveChannel := make(chan *gomatrixserverlib.Event, 10) | ||
| removePDUHandler := s.AddPDUHandler( | ||
| func(e *gomatrixserverlib.Event) bool { | ||
| if membership, _ := e.Membership(); e.Type() == "m.room.member" && |
Contributor
There was a problem hiding this comment.
what's the second thing returned by Membership() that gets bound(?) to _ -- a state key?
Contributor
Author
There was a problem hiding this comment.
It's err (surprise!). membership is "" when there's no such state entry, so I elided the err check.
Contributor
Author
|
Thanks for the review! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Many of the faster joins test flakes are due to the homeserver under
test failing to contact Complement homeservers after they have been
torn down. When this happens, subsequent tests can fail if they use a
Complement homeserver that happens to have the same hostname:port as one
which the homeserver under test has previously marked as offline.
Make the homeserver under test leave rooms at the end of each test, so
that it stops trying to contact the Complement homeservers in the room.
Signed-off-by: Sean Quah seanq@matrix.org
Reviewable commit by commit.
NB: you can tease out the flakes by forcing Complement to reuse ports whenever possible: