matrix-org / complement

Matrix compliance test suite
Apache License 2.0
61 stars 52 forks source link

Fix `TestDeviceListUpdates` flakes, again #610

Closed squahtx closed 1 year ago

squahtx commented 1 year ago

When a homeserver (Synapse) performs a partial state join to a room, it may emit device_lists.changed entries for users it thinks are in the room, despite the room not appearing in the /sync response yet. This is questionable behaviour, but not forbidden by the spec. Once the homeserver is fully joined to the room, it may emit another round of device_lists.changed entries for users it knows are definitely in the room.

These extra entries were causing test cases to advance prematurely and randomly fail. To fix the tests, we explicitly check for join events alongside the device_lists.changed entries produced by joins. In effect, we ensure that homeservers are fully joined to the test rooms before continuing the rest of the tests.

For consistency, we also check for leave events alongside device_lists.left entries.


Fixes https://github.com/matrix-org/synapse/issues/14103.