Skip to content

Conversation

@anoadragon453
Copy link
Member

@anoadragon453 anoadragon453 commented Oct 20, 2025

This PR converts the "Name/topic keys are correct" sytest to Complement.

This was spawned from said test failing in element-hq/synapse#19071, and not wanting to debug perl.

The test was first converted to go via Claude Code, then verified manually. Finally, the test failed when modifying what Synapse returns for /publicRooms, which is what we want to see.

@anoadragon453 anoadragon453 requested review from a team as code owners October 20, 2025 17:27
anoadragon453 added a commit to matrix-org/sytest that referenced this pull request Oct 20, 2025
This test has been migrated to Complement, see
matrix-org/complement#811
As 15s would be quite long to wait until the test failed.
This allows us to collect all incorrect data about a room and print it.
A side-effect is that one doesn't need to re-run the tests to see all
the broken fields.

In addition, the `must.MatchGJSON` was changed to a `should`, which now
re-polls `/publicRooms`. This prevents the test from exiting early upon
receiving an entry that's missing some keys.
A more accurate name for it.
This is indeed much easier to follow, and less book-keeping.
Otherwise we were (correctly) seeing the warning about unexpected rooms
in every time other than the first.
Comment on lines 65 to 66
t.Run("Name/topic keys are correct", func(t *testing.T) {
t.Parallel()
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think either of these tests are resilient to being run in parallel.

The first test assumes there will be one and only room in the results.

This test keeps track of unexpectedRooms. These other rooms are not unexpected if the tests are running in parallel. They are not the expected room though.


Could be resolved a few different ways like making a new deployment for each test.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't have a sense of whether using a new deployment would be faster than having the tests be sequential (I assume sequential tests would be faster?). I've un-parallel'd them in 9ab045c.

Nevertheless, you do raise a good point in that Can search public room list should be cleaning up after itself. Fixed in 83723e7.

func TestPublicRooms(t *testing.T) {
deployment := complement.Deploy(t, 1)
defer deployment.Destroy(t)
server_name := deployment.GetFullyQualifiedHomeserverName(t, "hs1")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Go prefers camelCase

Potential: hs1ServerName

Comment on lines +60 to +68
// Remove the room from the public rooms list to avoid polluting other tests.
authedClient.MustDo(
t,
"PUT",
[]string{"_matrix", "client", "v3", "directory", "list", "room", roomID},
client.WithJSONBody(t, map[string]interface{}{
"visibility": "private",
}),
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will never run if the above check fails leaving the room directory polluted for the next test.

I guess we move this to a defer right after we create the room 🤔

(same with below)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants