You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
funcTestTimelineAfterRequestingStateAfterGappyPoll(t*testing.T) {
pqString:=testutils.PrepareDBConnectionString()
v2:=runTestV2Server(t)
deferv2.close()
v3:=runTestServer(t, v2, pqString)
deferv3.close()
alice:="alice"aliceToken:="alicetoken"bob:="bob"roomID:="!unimportant"v2.addAccount(t, alice, aliceToken)
t.Log("alice creates a public room.")
timeline1:=createRoomState(t, alice, time.Now())
v2.queueResponse(aliceToken, sync2.SyncResponse{
Rooms: sync2.SyncRoomsResponse{
Join: map[string]sync2.SyncV2JoinResponse{
roomID: {
Timeline: sync2.TimelineResponse{
Events: timeline1,
PrevBatch: "alicePublicPrevBatch1",
},
},
},
},
NextBatch: "aliceSync1",
})
t.Log("alice sliding syncs.")
aliceRes:=v3.mustDoV3Request(t, aliceToken, sync3.Request{
RoomSubscriptions: map[string]sync3.RoomSubscription{
roomID: {TimelineLimit: 20},
},
})
t.Log("She sees herself joined to her room, with an appropriate timeline.")
// Note: we only expect timeline1[1:] here, excluding the create event. See// https://github.com/matrix-org/sliding-sync/issues/343m.MatchResponse(t, aliceRes,
m.LogResponse(t),
m.MatchRoomSubscription(roomID, m.MatchRoomTimeline(timeline1[1:])),
)
t.Logf("Alice's poller gets a gappy sync response for the public room. bob's membership is now join, and alice has sent 10 messages.")
timeline2:=make([]json.RawMessage, 10)
fori:=rangetimeline2 {
timeline2[i] =testutils.NewMessageEvent(t, alice, fmt.Sprintf("hello %d", i))
}
newMembership:=testutils.NewJoinEvent(t, bob)
v2.queueResponse(aliceToken, sync2.SyncResponse{
NextBatch: "alice2",
Rooms: sync2.SyncRoomsResponse{
Join: map[string]sync2.SyncV2JoinResponse{
roomID: {
State: sync2.EventsResponse{
Events: []json.RawMessage{newMembership},
},
Timeline: sync2.TimelineResponse{
Events: timeline2,
Limited: true,
PrevBatch: "alicePublicPrevBatch2",
},
},
},
},
})
v2.waitUntilEmpty(t, aliceToken)
t.Log("alice syncs, requesting Bob's membership. She sees it, and her new timeline.")
aliceRes=v3.mustDoV3RequestWithPos(t, aliceToken, aliceRes.Pos, sync3.Request{
RoomSubscriptions: map[string]sync3.RoomSubscription{
roomID: {
TimelineLimit: 20,
RequiredState: [][2]string{{"m.room.member", bob}},
},
},
})
m.MatchResponse(t, aliceRes, m.MatchRoomSubscription(roomID,
m.MatchRoomTimeline(timeline2),
))
}
Notes on how to fix:
Move the timeline limit changed method onto room subscription for tidying up.
Core problem: RoomDelta.Subs is a []string (roomIDs). Would need to make this a struct that describes how the subscription has changed.
Related: if I shrink the timeline limit, I would only expect to see new entries in the timeline. If I grow the timeline limit... not sure, maybe it's fine to resend the timeline in this situation.
The text was updated successfully, but these errors were encountered:
In this situation I'd expect to see a new required_state blob, but only new entries in the timeline.
Test case, from #329:
Notes on how to fix:
Related: if I shrink the timeline limit, I would only expect to see new entries in the timeline. If I grow the timeline limit... not sure, maybe it's fine to resend the timeline in this situation.
The text was updated successfully, but these errors were encountered: