MM-27187: Use the correct page offset for cache clear methods (#15094)

* MM-27187: Use the correct page offset for cache clear methods

We were just using page and incrementing by 1. This would fetch pages
one by one like (1-100, 2-102, 3-103) rather than (1-100,100-200,200-300).

We fix that to update the correct page offset.

* Trigger CI
Этот коммит содержится в:
Agniva De Sarker
2020-07-23 19:55:16 +05:30
коммит произвёл GitHub
родитель 46207a35f5
Коммит aad940e104
4 изменённых файлов: 47 добавлений и 2 удалений

Просмотреть файл

@@ -1877,6 +1877,28 @@ func TestMarkChannelsAsViewedPanic(t *testing.T) {
require.Nil(t, err)
}
func TestClearChannelMembersCache(t *testing.T) {
th := SetupWithStoreMock(t)
defer th.TearDown()
mockStore := th.App.Srv().Store.(*mocks.Store)
mockChannelStore := mocks.ChannelStore{}
cms := model.ChannelMembers{}
for i := 0; i < 200; i++ {
cms = append(cms, model.ChannelMember{
ChannelId: "1",
})
}
mockChannelStore.On("GetMembers", "channelID", 0, 100).Return(&cms, nil)
mockChannelStore.On("GetMembers", "channelID", 100, 100).Return(&model.ChannelMembers{
model.ChannelMember{
ChannelId: "1",
}}, nil)
mockStore.On("Channel").Return(&mockChannelStore)
th.App.ClearChannelMembersCache("channelID")
}
func TestSidebarCategory(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()