De-race types.RoomInfo (#2600)

This commit is contained in:
Neil Alexander 2022-08-01 15:29:19 +01:00 committed by GitHub
parent 05c83923e3
commit 119cde3766
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 72 additions and 42 deletions

View file

@ -63,12 +63,12 @@ func TestRoomsTable(t *testing.T) {
roomInfo, err := tab.SelectRoomInfo(ctx, nil, room.ID)
assert.NoError(t, err)
assert.Equal(t, &types.RoomInfo{
RoomNID: wantRoomNID,
RoomVersion: room.Version,
StateSnapshotNID: 0,
IsStub: true, // there are no latestEventNIDs
}, roomInfo)
expected := &types.RoomInfo{
RoomNID: wantRoomNID,
RoomVersion: room.Version,
}
expected.SetIsStub(true) // there are no latestEventNIDs
assert.Equal(t, expected, roomInfo)
roomInfo, err = tab.SelectRoomInfo(ctx, nil, "!doesnotexist:localhost")
assert.NoError(t, err)
@ -103,12 +103,12 @@ func TestRoomsTable(t *testing.T) {
roomInfo, err = tab.SelectRoomInfo(ctx, nil, room.ID)
assert.NoError(t, err)
assert.Equal(t, &types.RoomInfo{
RoomNID: wantRoomNID,
RoomVersion: room.Version,
StateSnapshotNID: 1,
IsStub: false,
}, roomInfo)
expected = &types.RoomInfo{
RoomNID: wantRoomNID,
RoomVersion: room.Version,
}
expected.SetStateSnapshotNID(1)
assert.Equal(t, expected, roomInfo)
eventNIDs, snapshotNID, err := tab.SelectLatestEventNIDs(ctx, nil, wantRoomNID)
assert.NoError(t, err)