Fix flaky TestCreatePost and others (#29320)
We don't clear the Redis cache for every test. This can cause issues because the cache is shared across test. We fix that with this PR. ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
aa0d117f30
Коммит
c6a7a8f628
@@ -165,7 +165,6 @@ func TestCreatePost(t *testing.T) {
|
|||||||
select {
|
select {
|
||||||
case event := <-WebSocketClient.EventChannel:
|
case event := <-WebSocketClient.EventChannel:
|
||||||
if event.EventType() == model.WebsocketEventEphemeralMessage {
|
if event.EventType() == model.WebsocketEventEphemeralMessage {
|
||||||
require.Equal(t, model.WebsocketEventEphemeralMessage, event.EventType())
|
|
||||||
eventsToGo = eventsToGo - 1
|
eventsToGo = eventsToGo - 1
|
||||||
}
|
}
|
||||||
case <-timeout:
|
case <-timeout:
|
||||||
@@ -3129,7 +3128,7 @@ func TestWebHubMembership(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestWebHubCloseConnOnDBFail(t *testing.T) {
|
func TestWebHubCloseConnOnDBFail(t *testing.T) {
|
||||||
t.Skip("https://mattermost.atlassian.net/browse/MM-61780")
|
t.Skip("MM-61780")
|
||||||
th := Setup(t).InitBasic()
|
th := Setup(t).InitBasic()
|
||||||
defer func() {
|
defer func() {
|
||||||
th.TearDown()
|
th.TearDown()
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ func StoreOverride(override any) Option {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// StoreOverrideWithCache is a test option to construct the app with the store layer
|
||||||
|
// wrapped on top of the store that is passed.
|
||||||
func StoreOverrideWithCache(override store.Store) Option {
|
func StoreOverrideWithCache(override store.Store) Option {
|
||||||
return func(ps *PlatformService) error {
|
return func(ps *PlatformService) error {
|
||||||
ps.newStore = func() (store.Store, error) {
|
ps.newStore = func() (store.Store, error) {
|
||||||
@@ -51,6 +53,9 @@ func StoreOverrideWithCache(override store.Store) Option {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
// Clearing all the caches because the in-mem data
|
||||||
|
// is persisted in case of Redis.
|
||||||
|
lcl.Invalidate()
|
||||||
return lcl, nil
|
return lcl, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user