Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
07387a0
Add some tests for push rule behavior on room upgrade
MadLittleMods Nov 17, 2025
3fdbd02
Make the test generic with multiple push rules types
MadLittleMods Nov 17, 2025
cc58ec9
Revert "Make the test generic with multiple push rules types"
MadLittleMods Nov 17, 2025
1167cee
Add `MustUpgradeRoom`
MadLittleMods Nov 17, 2025
d53a307
Test multiple users
MadLittleMods Nov 17, 2025
e00c1c0
Better remote tests
MadLittleMods Nov 17, 2025
fd90c90
Run tests in parallel
MadLittleMods Nov 17, 2025
ad2a7ea
More robust test (`MustAwaitPartialStateJoinCompletion`)
MadLittleMods Nov 17, 2025
5ebcc9f
Even better test
MadLittleMods Nov 17, 2025
e71b03e
Add manually upgraded variant and more robust
MadLittleMods Nov 18, 2025
4fb255c
Specify predecessor when manually upgrading room
MadLittleMods Nov 18, 2025
369250a
Skip test until Synapse is fixed
MadLittleMods Nov 18, 2025
3b4ca0b
Use `SetPushRule`
MadLittleMods Nov 18, 2025
6e2c6f2
Wait/sync until push rules show up
MadLittleMods Nov 18, 2025
10755c2
Fix waiting since the correct spot
MadLittleMods Nov 18, 2025
a7da686
Merge branch 'main' into madlittlemods/room-upgrade-push-rules
MadLittleMods Nov 18, 2025
7a601fa
Skip earlier
MadLittleMods Nov 18, 2025
201a93f
Skip on Dendrite
MadLittleMods Nov 18, 2025
126cc9b
This does sometimes pass but skip since not reliable
MadLittleMods Nov 18, 2025
32aff46
Accurate plural language
MadLittleMods Nov 20, 2025
bae2b74
`upgradeDescriptorPrefix` typo
MadLittleMods Nov 20, 2025
87d6ef0
Explain state of the spec
MadLittleMods Nov 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,31 @@ func (c *CSAPI) CreateRoom(t ct.TestLike, body map[string]interface{}) *http.Res
return c.Do(t, "POST", []string{"_matrix", "client", "v3", "createRoom"}, WithJSONBody(t, body))
}

// MustUpgradeRoom upgrades a room to the newVersion. Fails the test on error. Returns the new room ID.
func (c *CSAPI) MustUpgradeRoom(t ct.TestLike, roomID string, newVersion string) string {
t.Helper()
res := c.UpgradeRoom(t, roomID, newVersion)
mustRespond2xx(t, res)
resBody := ParseJSON(t, res)
return GetJSONFieldStr(t, resBody, "replacement_room")
}

// UpgradeRoom upgrades a room to the newVersion
func (c *CSAPI) UpgradeRoom(t ct.TestLike, roomID string, newVersion string) *http.Response {
t.Helper()
// Ensure we don't call create a room (upgrade creates a new room) from the same user
// in parallel, else we might try to make 2 rooms in the same millisecond (same
// `origin_server_ts`), causing v12 rooms to get the same room ID thus failing the
// test.
c.createRoomMutex.Lock()
defer c.createRoomMutex.Unlock()
return c.Do(t, "POST", []string{"_matrix", "client", "v3", "rooms", roomID, "upgrade"},
WithJSONBody(t, map[string]string{
"new_version": newVersion,
}),
)
}

// MustJoinRoom joins the room ID or alias given, else fails the test. Returns the room ID.
//
// Args:
Expand Down Expand Up @@ -214,6 +239,21 @@ func (c *CSAPI) JoinRoom(t ct.TestLike, roomIDOrAlias string, serverNames []spec
)
}

// MustAwaitPartialStateJoinCompletion waits until the joined room is no longer partial-stated
func (c *CSAPI) MustAwaitPartialStateJoinCompletion(t ct.TestLike, room_id string) {
t.Helper()

// Use a `/members` request to wait for the room to be un-partial stated.
// We avoid using `/sync`, as it only waits (or used to wait) for full state at
// particular events, rather than the whole room.
c.MustDo(
t,
"GET",
[]string{"_matrix", "client", "v3", "rooms", room_id, "members"},
)
t.Logf("%s's partial state join to %s completed.", c.UserID, room_id)
}

// MustLeaveRoom leaves the room ID, else fails the test.
func (c *CSAPI) MustLeaveRoom(t ct.TestLike, roomID string) {
res := c.LeaveRoom(t, roomID)
Expand Down
Loading
Loading