Caching removed from post_store.go, remove caching test (#13437)

Automatic Merge
Этот коммит содержится в:
Scott Bishel
2020-01-07 12:13:56 -07:00
коммит произвёл mattermod
родитель ecb41c6eb5
Коммит bd480b70f3

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

@@ -22,7 +22,6 @@ func TestPostStore(t *testing.T, ss store.Store, s SqlSupplier) {
t.Run("SaveAndUpdateChannelMsgCounts", func(t *testing.T) { testPostStoreSaveChannelMsgCounts(t, ss) })
t.Run("Get", func(t *testing.T) { testPostStoreGet(t, ss) })
t.Run("GetSingle", func(t *testing.T) { testPostStoreGetSingle(t, ss) })
t.Run("GetEtagCache", func(t *testing.T) { testGetEtagCache(t, ss) })
t.Run("Update", func(t *testing.T) { testPostStoreUpdate(t, ss) })
t.Run("Delete", func(t *testing.T) { testPostStoreDelete(t, ss) })
t.Run("Delete1Level", func(t *testing.T) { testPostStoreDelete1Level(t, ss) })
@@ -173,41 +172,6 @@ func testPostStoreGetSingle(t *testing.T, ss store.Store) {
}
}
func testGetEtagCache(t *testing.T, ss store.Store) {
o1 := &model.Post{}
o1.ChannelId = model.NewId()
o1.UserId = model.NewId()
o1.Message = "zz" + model.NewId() + "b"
etag1 := ss.Post().GetEtag(o1.ChannelId, true)
if strings.Index(etag1, model.CurrentVersion+".") != 0 {
t.Fatal("Invalid Etag")
}
// This one should come from the cache
etag2 := ss.Post().GetEtag(o1.ChannelId, true)
if strings.Index(etag2, model.CurrentVersion+".") != 0 {
t.Fatal("Invalid Etag")
}
o1, err := ss.Post().Save(o1)
require.Nil(t, err)
// We have not invalidated the cache so this should be the same as above
etag3 := ss.Post().GetEtag(o1.ChannelId, true)
if strings.Index(etag3, etag2) != 0 {
t.Fatal("Invalid Etag")
}
ss.Post().InvalidateLastPostTimeCache(o1.ChannelId)
// Invalidated cache so we should get a good result
etag4 := ss.Post().GetEtag(o1.ChannelId, true)
if strings.Index(etag4, fmt.Sprintf("%v.%v", model.CurrentVersion, o1.UpdateAt)) != 0 {
t.Fatal("Invalid Etag")
}
}
func testPostStoreUpdate(t *testing.T, ss store.Store) {
o1 := &model.Post{}
o1.ChannelId = model.NewId()