[MM-53026] - Disabled insights by default (#23702)

* Insights disabled by default

* fixed tests

* fixed tests

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Harshil Sharma
2023-06-14 19:40:12 +05:30
коммит произвёл GitHub
родитель 4021098456
Коммит 79abeb6382
9 изменённых файлов: 89 добавлений и 3 удалений

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

@@ -2482,6 +2482,10 @@ func TestGetTopChannelsForTeamSince(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()
th.ConfigStore.SetReadOnlyFF(false)
defer th.ConfigStore.SetReadOnlyFF(true)
th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = true })
channel2 := th.CreateChannel(th.Context, th.BasicTeam)
// add a bot post to ensure it's not counted
@@ -2594,6 +2598,10 @@ func TestGetTopChannelsForUserSince(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()
th.ConfigStore.SetReadOnlyFF(false)
defer th.ConfigStore.SetReadOnlyFF(true)
th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = true })
channel2 := th.CreateChannel(th.Context, th.BasicTeam)
// add a bot post to ensure it's not counted
@@ -2672,6 +2680,10 @@ func TestPostCountsByDuration(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()
th.ConfigStore.SetReadOnlyFF(false)
defer th.ConfigStore.SetReadOnlyFF(true)
th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = true })
channel2 := th.CreateChannel(th.Context, th.BasicTeam)
channel3 := th.CreatePrivateChannel(th.Context, th.BasicTeam)
channel4 := th.CreatePrivateChannel(th.Context, th.BasicTeam)
@@ -2793,6 +2805,10 @@ func TestGetTopInactiveChannelsForTeamSince(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()
th.ConfigStore.SetReadOnlyFF(false)
defer th.ConfigStore.SetReadOnlyFF(true)
th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = true })
channel2 := th.CreateChannel(th.Context, th.BasicTeam, WithCreateAt(1))
channel3 := th.CreateChannel(th.Context, th.BasicTeam, WithCreateAt(1))
channel4 := th.CreatePrivateChannel(th.Context, th.BasicTeam, WithCreateAt(1))
@@ -2889,6 +2905,10 @@ func TestGetTopInactiveChannelsForUserSince(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()
th.ConfigStore.SetReadOnlyFF(false)
defer th.ConfigStore.SetReadOnlyFF(true)
th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = true })
// delete offtopic, town-square, th.basicchannel channels - which interferes with 'least' active channel results
offTopicChannel, appErr := th.App.GetChannelByName(th.Context, "off-topic", th.BasicTeam.Id, false)
require.Nil(t, appErr, "Expected nil, didn't receive nil")