Migrates the lastPostsCache from PostStore into cache layer (#13141)
* Some advances * Partial advances * Cache moved * Tests finished * Removed all test for PostStore (store/sqlstore) related with Cache. This is tested in the cache layer now
Этот коммит содержится в:
коммит произвёл
Claudio Costa
родитель
85960abb08
Коммит
3a8fb53f3e
@@ -697,7 +697,7 @@ func testPostStoreGetPostsWithDetails(t *testing.T, ss store.Store) {
|
||||
t.Fatal("Missing parent")
|
||||
}
|
||||
|
||||
r2, err := ss.Post().GetPosts(model.GetPostsOptions{ChannelId: o1.ChannelId, Page: 0, PerPage: 4}, true)
|
||||
r2, err := ss.Post().GetPosts(model.GetPostsOptions{ChannelId: o1.ChannelId, Page: 0, PerPage: 4}, false)
|
||||
require.Nil(t, err)
|
||||
|
||||
if r2.Order[0] != o5.Id {
|
||||
@@ -725,7 +725,7 @@ func testPostStoreGetPostsWithDetails(t *testing.T, ss store.Store) {
|
||||
}
|
||||
|
||||
// Run once to fill cache
|
||||
_, err = ss.Post().GetPosts(model.GetPostsOptions{ChannelId: o1.ChannelId, Page: 0, PerPage: 30}, true)
|
||||
_, err = ss.Post().GetPosts(model.GetPostsOptions{ChannelId: o1.ChannelId, Page: 0, PerPage: 30}, false)
|
||||
require.Nil(t, err)
|
||||
|
||||
o6 := &model.Post{}
|
||||
@@ -735,17 +735,9 @@ func testPostStoreGetPostsWithDetails(t *testing.T, ss store.Store) {
|
||||
_, err = ss.Post().Save(o6)
|
||||
require.Nil(t, err)
|
||||
|
||||
// Should only be 6 since we hit the cache
|
||||
r3, err := ss.Post().GetPosts(model.GetPostsOptions{ChannelId: o1.ChannelId, Page: 0, PerPage: 30}, true)
|
||||
r3, err := ss.Post().GetPosts(model.GetPostsOptions{ChannelId: o1.ChannelId, Page: 0, PerPage: 30}, false)
|
||||
require.Nil(t, err)
|
||||
assert.Equal(t, 6, len(r3.Order))
|
||||
|
||||
ss.Post().InvalidateLastPostTimeCache(o1.ChannelId)
|
||||
|
||||
// Cache was invalidated, we should get all the posts
|
||||
r4, err := ss.Post().GetPosts(model.GetPostsOptions{ChannelId: o1.ChannelId, Page: 0, PerPage: 30}, true)
|
||||
require.Nil(t, err)
|
||||
assert.Equal(t, 7, len(r4.Order))
|
||||
assert.Equal(t, 7, len(r3.Order))
|
||||
}
|
||||
|
||||
func testPostStoreGetPostsBeforeAfter(t *testing.T, ss store.Store) {
|
||||
|
||||
Ссылка в новой задаче
Block a user