-
Notifications
You must be signed in to change notification settings - Fork 61
Convert Sytest Name/topic keys are correct to Complement
#811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This test has been migrated to Complement, see matrix-org/complement#811
…est_name_topic_keys_are_correct
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.
tests/csapi/public_rooms_test.go
Outdated
| t.Run("Name/topic keys are correct", func(t *testing.T) { | ||
| t.Parallel() |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Co-authored-by: Eric Eastwood <[email protected]>
Co-authored-by: Eric Eastwood <[email protected]>
Better name for the variable.
| func TestPublicRooms(t *testing.T) { | ||
| deployment := complement.Deploy(t, 1) | ||
| defer deployment.Destroy(t) | ||
| server_name := deployment.GetFullyQualifiedHomeserverName(t, "hs1") |
There was a problem hiding this comment.
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
| // 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", | ||
| }), | ||
| ) |
There was a problem hiding this comment.
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)
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.