Add clarification and test to fixed SSS behaviour#19734
Add clarification and test to fixed SSS behaviour#19734erikjohnston wants to merge 9 commits intodevelopfrom
Conversation
1d9fdc1 to
3149105
Compare
3149105 to
f86094c
Compare
| # Advance past the timeout to make sure the request finishes. (We do this | ||
| # to ensure log contexts don't leak between tests). |
There was a problem hiding this comment.
Which logcontext is being leaked here?
Here was my gut reaction:
Overall, we shouldn't be worrying about LoggingContext problems in the tests,
[...] it's expected that test things run outside of Synapse and by their nature should happen in the
sentinellogcontext. And if we really don't want to see these kind of errors, we would need to refactorget_success(...)to look more likeget_success(func, OTHER_SERVER, ev)where we call the function with somehomeserver_test_caselogcontext instead of passing in an awaitable.
There was a problem hiding this comment.
This was causing test failures. I'm not entirely sure what was going on, but the trial jobs started failing when running in parallel
There was a problem hiding this comment.
Finishing a request to be a good citizen seems fine. The extra complexity in the test is a bit distracting and slightly tricky to figure out that it isn't related to what we're testing. Perhaps a better comment could dispel things better as I read but the current language is fine ⏩
Also makes me wonder what happens if the test fails in the middle of a request (seems like we would run into the same problem).
| response_body["rooms"][room_id]["required_state"][0]["event_id"], | ||
| first_event_id, | ||
| ) | ||
|
|
There was a problem hiding this comment.
We even have a relevant test for this scenario. i.e. we should have a new test just like that but without the
# Send a message so the room comes down sync.
Thoughts?
There was a problem hiding this comment.
Isn't that basically what we're testing here?
There was a problem hiding this comment.
Yes, but this reinvents the wheel. And it would be nice to see the same thing pass without message sending or possibly adapt it so that it doesn't send messages.
At the very least, we should update the comments there to indicate that the message sending isn't necessary anymore (see this test) and move this test closer and possibly align the name better to 'expand'/'retract' just to connect them better (although the current name is fine if it were standalone)
There was a problem hiding this comment.
I think having the test cases be separate makes sense. The other ones are testing that we include/exclude the required_state even when the room does appear in the response (due to there being a message). The fact that we immediately return is a very related but distinct thing.
There was a problem hiding this comment.
I think we should at-least point out the new test (test_changing_required_state_returns_immediately) in the docstring for test_rooms_required_state_expand_retract_expand
Co-authored-by: Eric Eastwood <madlittlemods@gmail.com>
| response_body["rooms"][room_id]["required_state"][0]["event_id"], | ||
| first_event_id, | ||
| ) | ||
|
|
There was a problem hiding this comment.
Yes, but this reinvents the wheel. And it would be nice to see the same thing pass without message sending or possibly adapt it so that it doesn't send messages.
At the very least, we should update the comments there to indicate that the message sending isn't necessary anymore (see this test) and move this test closer and possibly align the name better to 'expand'/'retract' just to connect them better (although the current name is fine if it were standalone)
| # Advance past the timeout to make sure the request finishes. (We do this | ||
| # to ensure log contexts don't leak between tests). |
There was a problem hiding this comment.
Finishing a request to be a good citizen seems fine. The extra complexity in the test is a bit distracting and slightly tricky to figure out that it isn't related to what we're testing. Perhaps a better comment could dispel things better as I read but the current language is fine ⏩
Also makes me wonder what happens if the test fails in the middle of a request (seems like we would run into the same problem).
| ) | ||
|
|
||
| # We should see the new `required_state` immediately without waiting | ||
| # (for the full timeout, we may need to wait briefly). |
There was a problem hiding this comment.
| # (for the full timeout, we may need to wait briefly). | |
| # (for the full timeout, we may need to wait briefly just for the response to be assembled). |
Although this may not be true, see other discussion
|
|
||
| # We should see the new `required_state` immediately without waiting | ||
| # (for the full timeout, we may need to wait briefly). | ||
| channel.await_result(timeout_ms=100) |
There was a problem hiding this comment.
Perhaps this would pass if we just use 0? Are there any clock.call_later things we wait for in /sync response assembly?
| channel.await_result(timeout_ms=100) | |
| channel.await_result(timeout_ms=0) |
| response_body["rooms"][room_id]["required_state"][0]["event_id"], | ||
| first_event_id, | ||
| ) | ||
|
|
There was a problem hiding this comment.
I think we should at-least point out the new test (test_changing_required_state_returns_immediately) in the docstring for test_rooms_required_state_expand_retract_expand
Follow on from #19714, where we should have had an extra comment and test.
cc @MadLittleMods
Dev notes
required_statearen't sent until other activity occurs #18844 (comment)