Fix flaky TestCreateDefaultMemberships (#18330)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
b41b7eae10
Коммит
aaeaaf716b
@@ -13,7 +13,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestCreateDefaultMemberships(t *testing.T) {
|
func TestCreateDefaultMemberships(t *testing.T) {
|
||||||
t.Skip("MM-36909")
|
|
||||||
th := Setup(t).InitBasic()
|
th := Setup(t).InitBasic()
|
||||||
defer th.TearDown()
|
defer th.TearDown()
|
||||||
|
|
||||||
@@ -297,14 +296,15 @@ func TestCreateDefaultMemberships(t *testing.T) {
|
|||||||
t.Errorf("unable to add user to channel: %s", err.Error())
|
t.Errorf("unable to add user to channel: %s", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
timeAfterLeaving := model.GetMillis()
|
timeAfterLeaving := model.GetMillis() + 1
|
||||||
|
|
||||||
// Purging channelmemberhistory doesn't re-add user to channel
|
// Purging channelmemberhistory doesn't re-add user to channel
|
||||||
_, _, nErr := th.App.Srv().Store.ChannelMemberHistory().PermanentDeleteBatchForRetentionPolicies(
|
deletedCount, _, nErr := th.App.Srv().Store.ChannelMemberHistory().PermanentDeleteBatchForRetentionPolicies(
|
||||||
0, timeBeforeLeaving, 1000, model.RetentionPolicyCursor{})
|
0, timeBeforeLeaving, 1000, model.RetentionPolicyCursor{})
|
||||||
if nErr != nil {
|
if nErr != nil {
|
||||||
t.Errorf("error permanently deleting channelmemberhistory: %s", nErr.Error())
|
t.Errorf("error permanently deleting channelmemberhistory: %s", nErr.Error())
|
||||||
}
|
}
|
||||||
|
require.Equal(t, int64(1), deletedCount)
|
||||||
|
|
||||||
pErr = th.App.CreateDefaultMemberships(th.Context, scienceChannelGroupSyncable.UpdateAt, false)
|
pErr = th.App.CreateDefaultMemberships(th.Context, scienceChannelGroupSyncable.UpdateAt, false)
|
||||||
if pErr != nil {
|
if pErr != nil {
|
||||||
@@ -317,11 +317,12 @@ func TestCreateDefaultMemberships(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Purging channelmemberhistory doesn't re-add user to channel
|
// Purging channelmemberhistory doesn't re-add user to channel
|
||||||
_, _, nErr = th.App.Srv().Store.ChannelMemberHistory().PermanentDeleteBatchForRetentionPolicies(
|
deletedCount, _, nErr = th.App.Srv().Store.ChannelMemberHistory().PermanentDeleteBatchForRetentionPolicies(
|
||||||
0, timeAfterLeaving, 1000, model.RetentionPolicyCursor{})
|
0, timeAfterLeaving, 1000, model.RetentionPolicyCursor{})
|
||||||
if nErr != nil {
|
if nErr != nil {
|
||||||
t.Errorf("error permanently deleting channelmemberhistory: %s", nErr.Error())
|
t.Errorf("error permanently deleting channelmemberhistory: %s", nErr.Error())
|
||||||
}
|
}
|
||||||
|
require.Equal(t, int64(1), deletedCount)
|
||||||
|
|
||||||
pErr = th.App.CreateDefaultMemberships(th.Context, scienceChannelGroupSyncable.UpdateAt, false)
|
pErr = th.App.CreateDefaultMemberships(th.Context, scienceChannelGroupSyncable.UpdateAt, false)
|
||||||
if pErr != nil {
|
if pErr != nil {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user