Skip to content

Remove unnecessary self.pump calls in some of our tests.#19676

Open
reivilibre wants to merge 3 commits intodevelopfrom
rei/pump1
Open

Remove unnecessary self.pump calls in some of our tests.#19676
reivilibre wants to merge 3 commits intodevelopfrom
rei/pump1

Conversation

@reivilibre
Copy link
Copy Markdown
Contributor

Spawning from some discussion on #19602

There are a good handful of self.pump calls that are not necessary for the test to complete.

This PR removes the ones that a basic dirty search & replace script found.

After this, I have a self.advance helper I intend to PR up that is a wrapper for self.reactor.advance
with assertions that there is actually progress to be made.

reivilibre and others added 2 commits April 10, 2026 17:11
Signed-off-by: Olivier 'reivilibre <oliverw@matrix.org>
@reivilibre reivilibre marked this pull request as ready for review April 10, 2026 17:10
@reivilibre reivilibre requested a review from a team as a code owner April 10, 2026 17:10

d2 = ensureDeferred(second_lookup())

self.pump()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference, as far as I understand, these were found by commenting out the pump functionality and removing them from any tests that still passed.

Comment on lines +850 to 851
# Needed under Postgres
self.pump()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use with a better explanation if we understand. Or at-least some FIXME: Better explanation why?

Comment on lines -1081 to 1084
# Pump the reactor so our deferred goes through the motions. We pump with 10
# seconds (0.1 * 100) so the `MatrixFederationHttpClient` runs out of retries
# and finally passes along the error response.
# Needed under Postgres
self.pump(0.1)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was the previous comment a untrue? It sounds plausible. Introduced in matrix-org/synapse#15913

"deferred goes through the motions" is wrong but the retries explanation sounds accurate given we sleep in MatrixFederationHttpClient (sleep is based on clock.call_later)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah ok derp, this test is skipped on SQLite, d'oh, that explains the difference. I will check the Postgres ones more carefully

self.inject_room_member(self.room, self.u_bob, Membership.JOIN)
self.inject_room_member(self.room, self.u_charlie.to_string(), Membership.JOIN)

self.pump()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one could be plausible given we _count_known_servers updates in a 60 second loop, https://github.com/matrix-org/synapse/blob/be65a8ec0195955c15fdb179c9158b187638e39a/synapse/storage/databases/main/roommember.py#L98-L101

We are testing that it's still empty after a count has been run. There should be a comment though.

Comment thread tests/push/test_http.py
self.push_attempts[0][2]["notification"]["content"]["body"], "Message 1"
)
self.push_attempts[0][0].callback({})
self.pump()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does the push backoff stuff work? Seems plausible that we're dealing with schedule clock.call_later in this stuff.

We need to make sure these don't have any meaning regardless of whether the test passes without them.

(applies to this whole file)

shorthand=False,
await_result=False,
)
self.pump()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see we're removing the pump below. Do we know why this one is necessary?


test_d = defer.ensureDeferred(self.cl.get_json("testserv:8008", "foo/bar"))

self.pump()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we should be able to remove this one 🤔

Are we expecting to hit the timeout or exercise the retry features?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants