From 4d2dc74f05339f0b3cd28b997a2e35ae20f898be Mon Sep 17 00:00:00 2001 From: wiggin77 Date: Mon, 20 Mar 2023 22:40:00 -0400 Subject: [PATCH] disable playbooks for more tests --- server/channels/api4/apitestlib.go | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/server/channels/api4/apitestlib.go b/server/channels/api4/apitestlib.go index 4eece6ac23a..92ef4a9221d 100644 --- a/server/channels/api4/apitestlib.go +++ b/server/channels/api4/apitestlib.go @@ -110,6 +110,11 @@ func setupTestHelper(dbStore store.Store, searchEngine *searchengine.Broker, ent os.Unsetenv("MM_FEATUREFLAGS_BoardsProduct") memoryConfig.FeatureFlags.BoardsProduct = false + // disable Playbooks (temporarily) as it causes many more mocked methods to get + // called, and cannot receieve a mocked database. + playbooksDisableEnvValue := os.Getenv("MM_DISABLE_PLAYBOOKS") + os.Setenv("MM_DISABLE_PLAYBOOKS", "true") + if updateConfig != nil { updateConfig(memoryConfig) } @@ -148,14 +153,15 @@ func setupTestHelper(dbStore store.Store, searchEngine *searchengine.Broker, ent } th := &TestHelper{ - App: app.New(app.ServerConnector(s.Channels())), - Server: s, - ConfigStore: configStore, - IncludeCacheLayer: includeCache, - Context: request.EmptyContext(testLogger), - TestLogger: testLogger, - LogBuffer: buffer, - boardsProductEnvValue: boardsProductEnvValue, + App: app.New(app.ServerConnector(s.Channels())), + Server: s, + ConfigStore: configStore, + IncludeCacheLayer: includeCache, + Context: request.EmptyContext(testLogger), + TestLogger: testLogger, + LogBuffer: buffer, + boardsProductEnvValue: boardsProductEnvValue, + playbooksDisableEnvValue: playbooksDisableEnvValue, } th.Context.SetLogger(testLogger) @@ -317,11 +323,6 @@ func SetupConfigWithStoreMock(tb testing.TB, updateConfig func(cfg *model.Config } func SetupWithStoreMock(tb testing.TB) *TestHelper { - // disable Playbooks (temporarily) as it causes many more mocked methods to get - // called, and cannot receieve a mocked database. Boards is already disabled here. - playbooksDisableEnvValue := os.Getenv("MM_DISABLE_PLAYBOOKS") - os.Setenv("MM_DISABLE_PLAYBOOKS", "true") - th := setupTestHelper(testlib.GetMockStoreForSetupFunctions(), nil, false, false, nil, nil) statusMock := mocks.StatusStore{} statusMock.On("UpdateExpiredDNDStatuses").Return([]*model.Status{}, nil) @@ -332,8 +333,6 @@ func SetupWithStoreMock(tb testing.TB) *TestHelper { emptyMockStore.On("Close").Return(nil) emptyMockStore.On("Status").Return(&statusMock) th.App.Srv().SetStore(&emptyMockStore) - - th.playbooksDisableEnvValue = playbooksDisableEnvValue return th }