From b3b5b2cf559fe85981afabc0d37c4f581d98c04e Mon Sep 17 00:00:00 2001 From: Angelina Date: Wed, 22 Jan 2025 12:08:18 -0500 Subject: [PATCH 1/2] Bug: E2E test failure with new namespace Signed-off-by: Angelina Signed-off-by: Ry Jones --- internal/coreconfig/coreconfig.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/internal/coreconfig/coreconfig.go b/internal/coreconfig/coreconfig.go index 401f69c1ac..4b4fb34384 100644 --- a/internal/coreconfig/coreconfig.go +++ b/internal/coreconfig/coreconfig.go @@ -475,7 +475,3 @@ func setDefaults() { viper.SetDefault(string(CacheTokenPoolLimit), 100) viper.SetDefault(string(CacheTokenPoolTTL), "1h") } - -func Reset() { - config.RootConfigReset(setDefaults) -} From f0a5c2fc3989c9f641f965d96c907b02f0418896 Mon Sep 17 00:00:00 2001 From: Angelina Date: Wed, 29 Jan 2025 09:25:56 -0500 Subject: [PATCH 2/2] Removed calls to reset Signed-off-by: Angelina Signed-off-by: Ry Jones --- cmd/firefly.go | 1 - doc-site/config_docs_generate_test.go | 1 - doc-site/config_docs_test.go | 1 - internal/apiserver/server_test.go | 7 ---- internal/apiserver/swagger_check_test.go | 1 - internal/apiserver/swagger_generate_test.go | 1 - internal/assets/manager_test.go | 5 --- internal/batch/batch_manager_test.go | 1 - internal/batch/batch_processor_test.go | 7 ---- .../ethereum/address_resolver_test.go | 1 - internal/blockchain/ethereum/ethereum_test.go | 1 - internal/blockchain/fabric/fabric_test.go | 1 - .../blockchain/tezos/address_resolver_test.go | 1 - internal/blockchain/tezos/tezos_test.go | 1 - internal/broadcast/manager_test.go | 1 - internal/cache/cache_test.go | 5 --- internal/coreconfig/coreconfig_test.go | 1 - internal/data/data_manager_test.go | 5 --- internal/database/sqlcommon/chart_sql_test.go | 1 - .../database/sqlcommon/provider_mock_test.go | 1 - internal/dataexchange/ffdx/ffdx_test.go | 7 ---- internal/events/aggregator_test.go | 3 -- internal/events/event_dispatcher_test.go | 1 - internal/events/event_manager_test.go | 4 --- internal/events/subscription_manager_test.go | 3 -- internal/events/system/events_test.go | 1 - internal/events/webhooks/webhooks_test.go | 2 -- internal/events/websockets/websockets_test.go | 1 - internal/identity/identitymanager_test.go | 2 -- internal/metrics/metrics_test.go | 1 - internal/namespace/configreload_test.go | 15 ++------ internal/namespace/manager_test.go | 36 +------------------ internal/networkmap/manager_test.go | 1 - internal/operations/manager_test.go | 2 -- internal/operations/operation_updater_test.go | 1 - internal/orchestrator/orchestrator_test.go | 6 ---- internal/orchestrator/status_test.go | 22 ------------ .../privatemessaging/privatemessaging_test.go | 2 -- .../shareddownload/download_manager_test.go | 1 - internal/sharedstorage/ipfs/ipfs_test.go | 1 - internal/spievents/manager_test.go | 2 -- internal/tokens/fftokens/fftokens_test.go | 5 --- internal/txwriter/txwriter_test.go | 1 - 43 files changed, 3 insertions(+), 161 deletions(-) diff --git a/cmd/firefly.go b/cmd/firefly.go index f1b09195a5..e3314879b8 100644 --- a/cmd/firefly.go +++ b/cmd/firefly.go @@ -83,7 +83,6 @@ func init() { } func resetConfig() { - coreconfig.Reset() namespace.InitConfig() apiserver.InitConfig() } diff --git a/doc-site/config_docs_generate_test.go b/doc-site/config_docs_generate_test.go index 994162b88e..6bb731afd3 100644 --- a/doc-site/config_docs_generate_test.go +++ b/doc-site/config_docs_generate_test.go @@ -34,7 +34,6 @@ import ( func TestGenerateConfigDocs(t *testing.T) { // Initialize config of all plugins - coreconfig.Reset() namespace.InitConfig() apiserver.InitConfig() f, err := os.Create(filepath.Join("docs", "reference", "config.md")) diff --git a/doc-site/config_docs_test.go b/doc-site/config_docs_test.go index 80c0b0dbcd..9df0fbc2be 100644 --- a/doc-site/config_docs_test.go +++ b/doc-site/config_docs_test.go @@ -35,7 +35,6 @@ import ( func TestConfigDocsUpToDate(t *testing.T) { // Initialize config of all plugins - coreconfig.Reset() namespace.InitConfig() apiserver.InitConfig() generatedConfig, err := config.GenerateConfigMarkdown(context.Background(), configDocHeader, config.GetKnownKeys()) diff --git a/internal/apiserver/server_test.go b/internal/apiserver/server_test.go index 7855a033ef..1913f84324 100644 --- a/internal/apiserver/server_test.go +++ b/internal/apiserver/server_test.go @@ -53,7 +53,6 @@ import ( const configDir = "../../test/data/config" func newTestServer() (*namespacemocks.Manager, *orchestratormocks.Orchestrator, *apiServer) { - coreconfig.Reset() InitConfig() mgr := &namespacemocks.Manager{} o := &orchestratormocks.Orchestrator{} @@ -81,7 +80,6 @@ func newTestSPIServer() (*orchestratormocks.Orchestrator, *mux.Router) { } func TestStartStopServer(t *testing.T) { - coreconfig.Reset() metrics.Clear() InitConfig() apiConfig.Set(httpserver.HTTPConfPort, 0) @@ -100,7 +98,6 @@ func TestStartStopServer(t *testing.T) { } func TestStartLegacyAdminConfig(t *testing.T) { - coreconfig.Reset() metrics.Clear() InitConfig() apiConfig.Set(httpserver.HTTPConfPort, 0) @@ -119,7 +116,6 @@ func TestStartLegacyAdminConfig(t *testing.T) { } func TestStartAPIFail(t *testing.T) { - coreconfig.Reset() metrics.Clear() InitConfig() apiConfig.Set(httpserver.HTTPConfAddress, "...://") @@ -132,7 +128,6 @@ func TestStartAPIFail(t *testing.T) { } func TestStartAdminFail(t *testing.T) { - coreconfig.Reset() metrics.Clear() InitConfig() spiConfig.Set(httpserver.HTTPConfAddress, "...://") @@ -148,7 +143,6 @@ func TestStartAdminFail(t *testing.T) { } func TestStartAdminWSHandler(t *testing.T) { - coreconfig.Reset() metrics.Clear() InitConfig() spiConfig.Set(httpserver.HTTPConfAddress, "...://") @@ -167,7 +161,6 @@ func TestStartAdminWSHandler(t *testing.T) { } func TestStartMetricsFail(t *testing.T) { - coreconfig.Reset() metrics.Clear() InitConfig() metricsConfig.Set(httpserver.HTTPConfAddress, "...://") diff --git a/internal/apiserver/swagger_check_test.go b/internal/apiserver/swagger_check_test.go index 11de61d7a6..6f22f3834d 100644 --- a/internal/apiserver/swagger_check_test.go +++ b/internal/apiserver/swagger_check_test.go @@ -38,7 +38,6 @@ import ( ) func TestDiffSwaggerYAML(t *testing.T) { - coreconfig.Reset() config.Set(coreconfig.APIOASPanicOnMissingDescription, true) as := &apiServer{} hf := as.handlerFactory() diff --git a/internal/apiserver/swagger_generate_test.go b/internal/apiserver/swagger_generate_test.go index 8d394960a2..fcb6c60251 100644 --- a/internal/apiserver/swagger_generate_test.go +++ b/internal/apiserver/swagger_generate_test.go @@ -37,7 +37,6 @@ import ( ) func TestDownloadSwaggerYAML(t *testing.T) { - coreconfig.Reset() config.Set(coreconfig.APIOASPanicOnMissingDescription, true) as := &apiServer{} hf := as.handlerFactory() diff --git a/internal/assets/manager_test.go b/internal/assets/manager_test.go index 93f4c191f7..c277c8490d 100644 --- a/internal/assets/manager_test.go +++ b/internal/assets/manager_test.go @@ -53,7 +53,6 @@ func newTestAssetsWithMetrics(t *testing.T) (*assetManager, func()) { } func newTestAssetsCommon(t *testing.T, metrics bool) (*assetManager, func()) { - coreconfig.Reset() mdi := &databasemocks.Plugin{} mim := &identitymanagermocks.Manager{} mdm := &datamocks.Manager{} @@ -91,7 +90,6 @@ func TestInitFail(t *testing.T) { func TestCacheInitFail(t *testing.T) { cacheInitError := errors.New("Initialization error.") - coreconfig.Reset() mdi := &databasemocks.Plugin{} mdm := &datamocks.Manager{} mim := &identitymanagermocks.Manager{} @@ -163,7 +161,6 @@ func TestGetTokenConnectors(t *testing.T) { } func TestStart(t *testing.T) { - coreconfig.Reset() mdi := &databasemocks.Plugin{} mdm := &datamocks.Manager{} mim := &identitymanagermocks.Manager{} @@ -193,7 +190,6 @@ func TestStart(t *testing.T) { } func TestStartDBError(t *testing.T) { - coreconfig.Reset() mdi := &databasemocks.Plugin{} mdm := &datamocks.Manager{} mim := &identitymanagermocks.Manager{} @@ -216,7 +212,6 @@ func TestStartDBError(t *testing.T) { } func TestStartError(t *testing.T) { - coreconfig.Reset() mdi := &databasemocks.Plugin{} mdm := &datamocks.Manager{} mim := &identitymanagermocks.Manager{} diff --git a/internal/batch/batch_manager_test.go b/internal/batch/batch_manager_test.go index 00987c9ddd..e7527351fb 100644 --- a/internal/batch/batch_manager_test.go +++ b/internal/batch/batch_manager_test.go @@ -40,7 +40,6 @@ import ( ) func testConfigReset() { - coreconfig.Reset() config.Set(coreconfig.BatchManagerMinimumPollDelay, "0") log.SetLevel("debug") } diff --git a/internal/batch/batch_processor_test.go b/internal/batch/batch_processor_test.go index f5704b60e0..47f82b0e92 100644 --- a/internal/batch/batch_processor_test.go +++ b/internal/batch/batch_processor_test.go @@ -89,7 +89,6 @@ func (tce *testConflictError) IsConflictError() bool { func TestUnfilledBatch(t *testing.T) { log.SetLevel("debug") - coreconfig.Reset() dispatched := make(chan *DispatchPayload) cancel, mdi, bp := newTestBatchProcessor(t, func(c context.Context, state *DispatchPayload) error { @@ -154,7 +153,6 @@ func TestHandleDispatchConflictError(t *testing.T) { func TestBatchSizeOverflow(t *testing.T) { log.SetLevel("debug") - coreconfig.Reset() dispatched := make(chan *DispatchPayload) cancel, mdi, bp := newTestBatchProcessor(t, func(c context.Context, state *DispatchPayload) error { @@ -553,7 +551,6 @@ func TestStartQuiesceNonBlocking(t *testing.T) { func TestMarkMessageDispatchedUnpinnedOK(t *testing.T) { log.SetLevel("debug") - coreconfig.Reset() dispatched := make(chan *DispatchPayload) cancel, mdi, bp := newTestBatchProcessor(t, func(c context.Context, state *DispatchPayload) error { @@ -611,7 +608,6 @@ func TestMarkMessageDispatchedUnpinnedOK(t *testing.T) { func TestMaskContextsRetryAfterPinsAssigned(t *testing.T) { log.SetLevel("debug") - coreconfig.Reset() dispatched := make(chan *DispatchPayload) cancel, mdi, bp := newTestBatchProcessor(t, func(c context.Context, state *DispatchPayload) error { @@ -681,7 +677,6 @@ func TestMaskContextsRetryAfterPinsAssigned(t *testing.T) { func TestMaskContextsUpdateMessageFail(t *testing.T) { log.SetLevel("debug") - coreconfig.Reset() dispatched := make(chan *DispatchPayload) cancel, mdi, bp := newTestBatchProcessor(t, func(c context.Context, state *DispatchPayload) error { @@ -720,7 +715,6 @@ func TestMaskContextsUpdateMessageFail(t *testing.T) { } func TestSealBatchTXAlreadyAssigned(t *testing.T) { - coreconfig.Reset() dispatched := make(chan *DispatchPayload) cancel, mdi, bp := newTestBatchProcessor(t, func(c context.Context, state *DispatchPayload) error { @@ -831,7 +825,6 @@ func TestCalculateContextsLoadPinsFail(t *testing.T) { func TestBigBatchEstimate(t *testing.T) { log.SetLevel("debug") - coreconfig.Reset() bd := []byte(`{ "id": "37ba893b-fcfa-4cf9-8ce8-34cd8bc9bc72", diff --git a/internal/blockchain/ethereum/address_resolver_test.go b/internal/blockchain/ethereum/address_resolver_test.go index 15fe68d355..0d637a5978 100644 --- a/internal/blockchain/ethereum/address_resolver_test.go +++ b/internal/blockchain/ethereum/address_resolver_test.go @@ -39,7 +39,6 @@ import ( ) func utAddresResolverConfig() config.Section { - coreconfig.Reset() config := config.RootSection("utaddressresovler") (&Ethereum{}).InitConfig(config) return config.SubSection(AddressResolverConfigKey) diff --git a/internal/blockchain/ethereum/ethereum_test.go b/internal/blockchain/ethereum/ethereum_test.go index 739a3e2989..cbd48ee08e 100644 --- a/internal/blockchain/ethereum/ethereum_test.go +++ b/internal/blockchain/ethereum/ethereum_test.go @@ -113,7 +113,6 @@ func testFFIErrors() []*fftypes.FFIError { } func resetConf(e *Ethereum) { - coreconfig.Reset() e.InitConfig(utConfig) } diff --git a/internal/blockchain/fabric/fabric_test.go b/internal/blockchain/fabric/fabric_test.go index 2453ba5d46..0b7e401247 100644 --- a/internal/blockchain/fabric/fabric_test.go +++ b/internal/blockchain/fabric/fabric_test.go @@ -55,7 +55,6 @@ var utFabconnectConf = utConfig.SubSection(FabconnectConfigKey) var signer = "orgMSP::x509::CN=signer001,OU=client::CN=fabric-ca" func resetConf(e *Fabric) { - coreconfig.Reset() e.InitConfig(utConfig) } diff --git a/internal/blockchain/tezos/address_resolver_test.go b/internal/blockchain/tezos/address_resolver_test.go index b1135bb632..b200b18874 100644 --- a/internal/blockchain/tezos/address_resolver_test.go +++ b/internal/blockchain/tezos/address_resolver_test.go @@ -38,7 +38,6 @@ import ( ) func utAddresResolverConfig() config.Section { - coreconfig.Reset() config := config.RootSection("utaddressresovler") (&Tezos{}).InitConfig(config) return config.SubSection(AddressResolverConfigKey) diff --git a/internal/blockchain/tezos/tezos_test.go b/internal/blockchain/tezos/tezos_test.go index 6ed39ae656..c6d0ff6073 100644 --- a/internal/blockchain/tezos/tezos_test.go +++ b/internal/blockchain/tezos/tezos_test.go @@ -89,7 +89,6 @@ func testFFIMethod() *fftypes.FFIMethod { } func resetConf(t *Tezos) { - coreconfig.Reset() t.InitConfig(utConfig) } diff --git a/internal/broadcast/manager_test.go b/internal/broadcast/manager_test.go index db95cd3f11..a5ccf31d37 100644 --- a/internal/broadcast/manager_test.go +++ b/internal/broadcast/manager_test.go @@ -46,7 +46,6 @@ import ( ) func newTestBroadcastCommon(t *testing.T, metricsEnabled bool) (*broadcastManager, func()) { - coreconfig.Reset() mdi := &databasemocks.Plugin{} mim := &identitymanagermocks.Manager{} mdm := &datamocks.Manager{} diff --git a/internal/cache/cache_test.go b/internal/cache/cache_test.go index a5b129d907..3aeebb98a9 100644 --- a/internal/cache/cache_test.go +++ b/internal/cache/cache_test.go @@ -27,7 +27,6 @@ import ( ) func TestNewCacheCreationFail(t *testing.T) { - coreconfig.Reset() ctx := context.Background() cacheManager := NewCacheManager(ctx) _, err := cacheManager.GetCache(NewCacheConfig(ctx, "", "", "")) @@ -41,7 +40,6 @@ func TestNewCacheCreationFail(t *testing.T) { } func TestGetCacheReturnsSameCacheForSameConfig(t *testing.T) { - coreconfig.Reset() ctx := context.Background() cacheManager := NewCacheManager(ctx) cache0, _ := cacheManager.GetCache(NewCacheConfig(ctx, "cache.batch.limit", "cache.batch.ttl", "testnamespace")) @@ -57,7 +55,6 @@ func TestGetCacheReturnsSameCacheForSameConfig(t *testing.T) { } func TestTwoSeparateCacheWorksIndependently(t *testing.T) { - coreconfig.Reset() ctx := context.Background() cacheManager := NewCacheManager(ctx) cache0, _ := cacheManager.GetCache(NewCacheConfig(ctx, "cache.batch.limit", "cache.batch.ttl", "")) @@ -77,7 +74,6 @@ func TestTwoSeparateCacheWorksIndependently(t *testing.T) { } func TestReturnsDummyCacheWhenCacheDisabled(t *testing.T) { - coreconfig.Reset() config.Set(coreconfig.CacheEnabled, false) ctx := context.Background() cacheManager := NewCacheManager(ctx) @@ -93,7 +89,6 @@ func TestUmmanagedCacheInstance(t *testing.T) { } func TestResetCachesForNamespace(t *testing.T) { - coreconfig.Reset() ctx := context.Background() cacheManager := NewCacheManager(ctx) cacheNS1, _ := cacheManager.GetCache(NewCacheConfig(ctx, "cache.batch.limit", "cache.batch.ttl", "ns1")) diff --git a/internal/coreconfig/coreconfig_test.go b/internal/coreconfig/coreconfig_test.go index 3344cc0ddc..f7f8d231a5 100644 --- a/internal/coreconfig/coreconfig_test.go +++ b/internal/coreconfig/coreconfig_test.go @@ -26,7 +26,6 @@ import ( const configDir = "../../test/data/config" func TestInitConfigOK(t *testing.T) { - Reset() assert.Equal(t, 25, config.GetInt(APIDefaultFilterLimit)) assert.Equal(t, "localhost", config.GetString(DebugAddress)) diff --git a/internal/data/data_manager_test.go b/internal/data/data_manager_test.go index a8a3e9afd2..aa85939641 100644 --- a/internal/data/data_manager_test.go +++ b/internal/data/data_manager_test.go @@ -40,7 +40,6 @@ import ( func TestCacheInitFail(t *testing.T) { cacheInitError := errors.New("Initialization error.") - coreconfig.Reset() config.Set(coreconfig.MessageWriterCount, 1) ctx := context.Background() mdi := &databasemocks.Plugin{} @@ -80,7 +79,6 @@ func TestCacheInitFail(t *testing.T) { } func newTestDataManager(t *testing.T) (*dataManager, context.Context, func()) { - coreconfig.Reset() config.Set(coreconfig.MessageWriterCount, 1) ctx, cancel := context.WithCancel(context.Background()) mdi := &databasemocks.Plugin{} @@ -134,7 +132,6 @@ func testNewMessage() (*fftypes.UUID, *fftypes.Bytes32, *NewMessage) { func TestValidateE2E(t *testing.T) { - coreconfig.Reset() dm, ctx, cancel := newTestDataManager(t) defer cancel() mdi := dm.database.(*databasemocks.Plugin) @@ -281,7 +278,6 @@ func TestInitBadDeps(t *testing.T) { } func TestValidatorLookupCached(t *testing.T) { - coreconfig.Reset() dm, ctx, cancel := newTestDataManager(t) defer cancel() mdi := dm.database.(*databasemocks.Plugin) @@ -309,7 +305,6 @@ func TestValidatorLookupCached(t *testing.T) { func TestValidateBadHash(t *testing.T) { - coreconfig.Reset() dm, ctx, cancel := newTestDataManager(t) defer cancel() mdi := dm.database.(*databasemocks.Plugin) diff --git a/internal/database/sqlcommon/chart_sql_test.go b/internal/database/sqlcommon/chart_sql_test.go index 2df51d1441..44a84f0ce7 100644 --- a/internal/database/sqlcommon/chart_sql_test.go +++ b/internal/database/sqlcommon/chart_sql_test.go @@ -135,7 +135,6 @@ func TestGetChartHistogramValidCollectionNameWithTypes(t *testing.T) { func TestGetChartHistogramValidCollectionNameWithTypesAndCapped(t *testing.T) { s, mock := newMockProvider().init() - coreconfig.Reset() config.Set(coreconfig.HistogramsMaxChartRows, 10) for i := range validCollectionsWithTypes { mock.ExpectQuery("SELECT .*").WillReturnRows(sqlmock.NewRows([]string{"timestamp", "type"}). diff --git a/internal/database/sqlcommon/provider_mock_test.go b/internal/database/sqlcommon/provider_mock_test.go index 38faa5eb98..779d2d1057 100644 --- a/internal/database/sqlcommon/provider_mock_test.go +++ b/internal/database/sqlcommon/provider_mock_test.go @@ -49,7 +49,6 @@ type mockProvider struct { } func newMockProvider() *mockProvider { - coreconfig.Reset() conf := config.RootSection("unittest.db") conf.AddKnownKey("url", "test") mp := &mockProvider{ diff --git a/internal/dataexchange/ffdx/ffdx_test.go b/internal/dataexchange/ffdx/ffdx_test.go index 63efbcd8d0..cd81b0d2c4 100644 --- a/internal/dataexchange/ffdx/ffdx_test.go +++ b/internal/dataexchange/ffdx/ffdx_test.go @@ -55,7 +55,6 @@ func newTestFFDX(t *testing.T, manifestEnabled bool) (h *FFDX, toServer, fromSer u.Scheme = "http" httpURL = u.String() - coreconfig.Reset() h.InitConfig(utConfig) utConfig.Set(ffresty.HTTPConfigURL, httpURL) utConfig.Set(ffresty.HTTPCustomClient, mockedClient) @@ -109,7 +108,6 @@ func TestJoinBlobPath(t *testing.T) { } func TestInitBadURL(t *testing.T) { - coreconfig.Reset() h := &FFDX{} h.InitConfig(utConfig) utConfig.Set(ffresty.HTTPConfigURL, "::::////") @@ -119,7 +117,6 @@ func TestInitBadURL(t *testing.T) { } func TestInitBadTLS(t *testing.T) { - coreconfig.Reset() h := &FFDX{} h.InitConfig(utConfig) utConfig.Set(ffresty.HTTPConfigURL, "http://localhost:12345") @@ -132,7 +129,6 @@ func TestInitBadTLS(t *testing.T) { } func TestInitMissingURL(t *testing.T) { - coreconfig.Reset() h := &FFDX{} h.InitConfig(utConfig) ctx, cancel := context.WithCancel(context.Background()) @@ -438,7 +434,6 @@ func TestBadEvents(t *testing.T) { func TestBackgroundStartWSFail(t *testing.T) { h := &FFDX{initialized: true} - coreconfig.Reset() u, _ := url.Parse("http://localhost:12345") u.Scheme = "http" @@ -775,7 +770,6 @@ func TestWebsocketWithReinit(t *testing.T) { httpURL := u.String() h := &FFDX{} - coreconfig.Reset() h.InitConfig(utConfig) utConfig.Set(ffresty.HTTPConfigURL, httpURL) utConfig.Set(ffresty.HTTPCustomClient, mockedClient) @@ -831,7 +825,6 @@ func TestWebsocketWithEmptyNodesInit(t *testing.T) { httpURL := u.String() h := &FFDX{} - coreconfig.Reset() h.InitConfig(utConfig) utConfig.Set(ffresty.HTTPConfigURL, httpURL) utConfig.Set(ffresty.HTTPCustomClient, mockedClient) diff --git a/internal/events/aggregator_test.go b/internal/events/aggregator_test.go index 012dc0c934..8c8ae4ae11 100644 --- a/internal/events/aggregator_test.go +++ b/internal/events/aggregator_test.go @@ -72,7 +72,6 @@ func (tag *testAggregator) cleanup(t *testing.T) { } func newTestAggregatorCommon(metrics bool) *testAggregator { - coreconfig.Reset() ctx, ctxCancel := context.WithCancel(context.Background()) logrus.SetLevel(logrus.DebugLevel) mdi := &databasemocks.Plugin{} @@ -174,7 +173,6 @@ func newTestManifest(mType core.MessageType, groupID *fftypes.Bytes32) (*core.Me } func TestNewAggregator(t *testing.T) { - coreconfig.Reset() ctx := context.Background() logrus.SetLevel(logrus.DebugLevel) mdi := &databasemocks.Plugin{} @@ -198,7 +196,6 @@ func TestNewAggregator(t *testing.T) { )) } func TestCacheInitFail(t *testing.T) { - coreconfig.Reset() ctx := context.Background() cacheInitError := errors.New("Initialization error.") logrus.SetLevel(logrus.DebugLevel) diff --git a/internal/events/event_dispatcher_test.go b/internal/events/event_dispatcher_test.go index a056c32518..d02d381592 100644 --- a/internal/events/event_dispatcher_test.go +++ b/internal/events/event_dispatcher_test.go @@ -60,7 +60,6 @@ func newTestEventDispatcher(sub *subscription) (*eventDispatcher, func()) { ctx, cancel := context.WithCancel(context.Background()) return newEventDispatcher(ctx, enricher, mei, mdi, mdm, mbm, mpm, fftypes.NewUUID().String(), sub, newEventNotifier(ctx, "ut"), txHelper), func() { cancel() - coreconfig.Reset() } } diff --git a/internal/events/event_manager_test.go b/internal/events/event_manager_test.go index ac06c88c08..fef459c9ca 100644 --- a/internal/events/event_manager_test.go +++ b/internal/events/event_manager_test.go @@ -114,7 +114,6 @@ func newTestEventManagerWithDBConcurrency(t *testing.T) *testEventManager { } func newTestEventManagerCommon(t *testing.T, metrics, dbconcurrency bool) *testEventManager { - coreconfig.Reset() config.Set(coreconfig.BlobReceiverWorkerCount, 1) config.Set(coreconfig.BlobReceiverWorkerBatchTimeout, "1s") logrus.SetLevel(logrus.DebugLevel) @@ -215,7 +214,6 @@ func TestStartStopBadDependencies(t *testing.T) { func TestAggregatorCacheInitFail(t *testing.T) { cacheInitError := errors.New("Initialization error.") config.Set(coreconfig.EventTransportsEnabled, []string{"wrongun"}) - defer coreconfig.Reset() mdi := &databasemocks.Plugin{} mbi := &blockchainmocks.Plugin{} mim := &identitymanagermocks.Manager{} @@ -270,7 +268,6 @@ func TestAggregatorCacheInitFail(t *testing.T) { func TestEventCacheInitFail(t *testing.T) { cacheInitError := errors.New("Initialization error.") config.Set(coreconfig.EventTransportsEnabled, []string{"wrongun"}) - defer coreconfig.Reset() mdi := &databasemocks.Plugin{} mbi := &blockchainmocks.Plugin{} mim := &identitymanagermocks.Manager{} @@ -318,7 +315,6 @@ func TestEventCacheInitFail(t *testing.T) { func TestStartStopEventListenerFail(t *testing.T) { config.Set(coreconfig.EventTransportsEnabled, []string{"wrongun"}) - defer coreconfig.Reset() mdi := &databasemocks.Plugin{} mbi := &blockchainmocks.Plugin{} mim := &identitymanagermocks.Manager{} diff --git a/internal/events/subscription_manager_test.go b/internal/events/subscription_manager_test.go index ef509c7057..f0b6f5ebb5 100644 --- a/internal/events/subscription_manager_test.go +++ b/internal/events/subscription_manager_test.go @@ -43,7 +43,6 @@ import ( ) func newTestSubManager(t *testing.T, mei *eventsmocks.Plugin) (*subscriptionManager, func()) { - coreconfig.Reset() config.Set(coreconfig.EventTransportsEnabled, []string{}) mdi := &databasemocks.Plugin{} @@ -526,7 +525,6 @@ func TestCreateSubscriptionSuccessBlockchainEvent(t *testing.T) { } func TestCreateSubscriptionSuccessTLSConfig(t *testing.T) { - coreconfig.Reset() mei := &eventsmocks.Plugin{} sm, cancel := newTestSubManager(t, mei) @@ -552,7 +550,6 @@ func TestCreateSubscriptionSuccessTLSConfig(t *testing.T) { } func TestCreateSubscriptionSuccessBatch(t *testing.T) { - coreconfig.Reset() mei := &eventsmocks.Plugin{} sm, cancel := newTestSubManager(t, mei) diff --git a/internal/events/system/events_test.go b/internal/events/system/events_test.go index 69f6c3bfb9..4992ff2373 100644 --- a/internal/events/system/events_test.go +++ b/internal/events/system/events_test.go @@ -32,7 +32,6 @@ import ( ) func newTestEvents(t *testing.T) (se *Events, cancel func()) { - coreconfig.Reset() cbs := &eventsmocks.Callbacks{} rc := cbs.On("RegisterConnection", mock.Anything, mock.Anything).Return(nil) diff --git a/internal/events/webhooks/webhooks_test.go b/internal/events/webhooks/webhooks_test.go index f38ba4e0a7..81158f84d3 100644 --- a/internal/events/webhooks/webhooks_test.go +++ b/internal/events/webhooks/webhooks_test.go @@ -49,7 +49,6 @@ import ( ) func newTestWebHooks(t *testing.T) (wh *WebHooks, cancel func()) { - coreconfig.Reset() cbs := &eventsmocks.Callbacks{} rc := cbs.On("RegisterConnection", mock.Anything, mock.Anything).Return(nil) @@ -68,7 +67,6 @@ func newTestWebHooks(t *testing.T) (wh *WebHooks, cancel func()) { } func TestInitBadTLS(t *testing.T) { - coreconfig.Reset() wh := &WebHooks{} ctx := context.Background() diff --git a/internal/events/websockets/websockets_test.go b/internal/events/websockets/websockets_test.go index 031adebdfe..17e442ecf3 100644 --- a/internal/events/websockets/websockets_test.go +++ b/internal/events/websockets/websockets_test.go @@ -63,7 +63,6 @@ func (h *testNamespacedHandler) ServeHTTP(res http.ResponseWriter, req *http.Req h.ws.ServeHTTPNamespaced(h.namespace, res, req) } func newTestWebsocketsCommon(t *testing.T, cbs *eventsmocks.Callbacks, authorizer core.Authorizer, namespace string, queryParams ...string) (ws *WebSockets, wsc wsclient.WSClient, cancel func()) { - coreconfig.Reset() ws = &WebSockets{} ctx, cancelCtx := context.WithCancel(context.Background()) diff --git a/internal/identity/identitymanager_test.go b/internal/identity/identitymanager_test.go index 93565d9752..ae2e280867 100644 --- a/internal/identity/identitymanager_test.go +++ b/internal/identity/identitymanager_test.go @@ -38,7 +38,6 @@ import ( ) func newTestIdentityManager(t *testing.T) (context.Context, *identityManager) { - coreconfig.Reset() mdi := &databasemocks.Plugin{} mbi := &blockchainmocks.Plugin{} @@ -67,7 +66,6 @@ func TestNewIdentityManagerMissingDeps(t *testing.T) { func TestCacheInitFail(t *testing.T) { cacheInitError := errors.New("Initialization error.") - coreconfig.Reset() mdi := &databasemocks.Plugin{} mbi := &blockchainmocks.Plugin{} diff --git a/internal/metrics/metrics_test.go b/internal/metrics/metrics_test.go index 7e8c685f46..02d75cf315 100644 --- a/internal/metrics/metrics_test.go +++ b/internal/metrics/metrics_test.go @@ -49,7 +49,6 @@ var TokenTransfer = &core.TokenTransfer{ } func newTestMetricsManager(t *testing.T) (*metricsManager, func()) { - coreconfig.Reset() Clear() Registry() ctx, cancel := context.WithCancel(context.Background()) diff --git a/internal/namespace/configreload_test.go b/internal/namespace/configreload_test.go index 9afd00b91d..d0bd4c6eeb 100644 --- a/internal/namespace/configreload_test.go +++ b/internal/namespace/configreload_test.go @@ -473,7 +473,6 @@ func TestConfigListenerE2E(t *testing.T) { configFilename := fmt.Sprintf("%s/firefly.core", testDir) renameWriteFile(t, configFilename, []byte(exampleConfig1base)) - coreconfig.Reset() InitConfig() err := config.ReadConfig("core", configFilename) assert.NoError(t, err) @@ -486,7 +485,7 @@ func TestConfigListenerE2E(t *testing.T) { ctx, cancelCtx := context.WithCancel(context.Background()) err = nm.Init(ctx, cancelCtx, make(chan bool), func() error { - coreconfig.Reset() + return config.ReadConfig("core", configFilename) }) assert.NoError(t, err) @@ -514,7 +513,6 @@ func TestConfigListenerUnreadableYAML(t *testing.T) { configFilename := fmt.Sprintf("%s/firefly.core", testDir) viper.SetConfigFile(configFilename) - coreconfig.Reset() InitConfig() config.Set(coreconfig.ConfigAutoReload, true) @@ -524,7 +522,7 @@ func TestConfigListenerUnreadableYAML(t *testing.T) { ctx, cancelCtx := context.WithCancel(context.Background()) err := nm.Init(ctx, cancelCtx, make(chan bool), func() error { - coreconfig.Reset() + return config.ReadConfig("core", configFilename) }) assert.NoError(t, err) @@ -576,7 +574,6 @@ func TestConfigReload1to2(t *testing.T) { originalNSHashes[k] = v.configHash } - coreconfig.Reset() InitConfig() viper.SetConfigType("yaml") err = viper.ReadConfig(strings.NewReader(exampleConfig2extraNS)) @@ -652,7 +649,6 @@ func TestConfigReload1to3(t *testing.T) { } waitInit = namespaceInitWaiter(t, nmm, []string{"ns1", "ns2"}) - coreconfig.Reset() InitConfig() viper.SetConfigType("yaml") err = viper.ReadConfig(strings.NewReader(exampleConfig3NSchanges)) @@ -714,7 +710,6 @@ func TestConfigReloadBadNewConfigPlugins(t *testing.T) { waitInit.Wait() - coreconfig.Reset() InitConfig() viper.SetConfigType("yaml") err = viper.ReadConfig(strings.NewReader(` @@ -766,7 +761,6 @@ func TestConfigReloadBadNSMissingRequiredPlugins(t *testing.T) { waitInit.Wait() - coreconfig.Reset() InitConfig() viper.SetConfigType("yaml") err = viper.ReadConfig(strings.NewReader(` @@ -846,7 +840,6 @@ func TestConfigDownToNothingOk(t *testing.T) { assert.NoError(t, err) waitInit.Wait() - coreconfig.Reset() InitConfig() viper.SetConfigType("yaml") // Nothing - no plugins, no namespaces @@ -896,7 +889,6 @@ func TestConfigStartPluginsFails(t *testing.T) { assert.NoError(t, err) waitInit.Wait() - coreconfig.Reset() InitConfig() viper.SetConfigType("yaml") // Nothing - no plugins, no namespaces @@ -940,7 +932,6 @@ func TestConfigReloadInitPluginsFailOnReload(t *testing.T) { err = nm.Start() assert.NoError(t, err) - coreconfig.Reset() InitConfig() viper.SetConfigType("yaml") err = viper.ReadConfig(strings.NewReader(` @@ -983,7 +974,6 @@ func TestConfigReloadInitNamespacesFailOnReload(t *testing.T) { err = nm.Start() assert.NoError(t, err) - coreconfig.Reset() InitConfig() viper.SetConfigType("yaml") err = viper.ReadConfig(strings.NewReader(` @@ -1035,7 +1025,6 @@ func TestConfigReloadInitNamespacesFailOnStart(t *testing.T) { err = nm.Start() assert.NoError(t, err) - coreconfig.Reset() InitConfig() viper.SetConfigType("yaml") err = viper.ReadConfig(strings.NewReader(` diff --git a/internal/namespace/manager_test.go b/internal/namespace/manager_test.go index 9d21f65d15..c87852cb15 100644 --- a/internal/namespace/manager_test.go +++ b/internal/namespace/manager_test.go @@ -238,7 +238,6 @@ func mockPluginFactories(inm Manager) (nmm *nmMocks) { } func newTestNamespaceManager(t *testing.T, initConfig bool) (*namespaceManager, *nmMocks, func()) { - coreconfig.Reset() InitConfig() ctx, cancelCtx := context.WithCancel(context.Background()) nm := &namespaceManager{ @@ -246,7 +245,7 @@ func newTestNamespaceManager(t *testing.T, initConfig bool) (*namespaceManager, cancelCtx: cancelCtx, reset: make(chan bool, 1), reloadConfig: func() error { - coreconfig.Reset() + InitConfig() viper.SetConfigType("yaml") return viper.ReadConfig(strings.NewReader(testBaseConfig)) @@ -949,7 +948,6 @@ func TestTokensPluginDuplicateBroadcastName(t *testing.T) { nm, _, cleanup := newTestNamespaceManager(t, true) defer cleanup() - coreconfig.Reset() tifactory.InitConfig(tokensConfig) viper.SetConfigType("yaml") err := viper.ReadConfig(strings.NewReader(` @@ -977,7 +975,6 @@ func TestMultipleTokensPluginsWithBroadcastName(t *testing.T) { nm, _, cleanup := newTestNamespaceManager(t, true) defer cleanup() - coreconfig.Reset() tifactory.InitConfig(tokensConfig) viper.SetConfigType("yaml") err := viper.ReadConfig(strings.NewReader(` @@ -1152,7 +1149,6 @@ func TestInitBadNamespace(t *testing.T) { nm, _, cleanup := newTestNamespaceManager(t, true) defer cleanup() - coreconfig.Reset() viper.SetConfigType("yaml") err := viper.ReadConfig(strings.NewReader(` namespaces: @@ -1171,7 +1167,6 @@ func TestLoadNamespacesReservedName(t *testing.T) { nm, _, cleanup := newTestNamespaceManager(t, true) defer cleanup() - coreconfig.Reset() viper.SetConfigType("yaml") err := viper.ReadConfig(strings.NewReader(` namespaces: @@ -1189,7 +1184,6 @@ func TestLoadNamespacesNetworkName(t *testing.T) { nm, _, cleanup := newTestNamespaceManager(t, true) defer cleanup() - coreconfig.Reset() viper.SetConfigType("yaml") err := viper.ReadConfig(strings.NewReader(` namespaces: @@ -1212,7 +1206,6 @@ func TestLoadNamespacesReservedNetworkName(t *testing.T) { nm, _, cleanup := newTestNamespaceManager(t, true) defer cleanup() - coreconfig.Reset() viper.SetConfigType("yaml") err := viper.ReadConfig(strings.NewReader(` namespaces: @@ -1233,7 +1226,6 @@ func TestLoadNamespacesDuplicate(t *testing.T) { nm, _, cleanup := newTestNamespaceManager(t, true) defer cleanup() - coreconfig.Reset() viper.SetConfigType("yaml") err := viper.ReadConfig(strings.NewReader(` namespaces: @@ -1255,7 +1247,6 @@ func TestLoadNamespacesNoName(t *testing.T) { nm, _, cleanup := newTestNamespaceManager(t, true) defer cleanup() - coreconfig.Reset() viper.SetConfigType("yaml") err := viper.ReadConfig(strings.NewReader(` namespaces: @@ -1272,7 +1263,6 @@ func TestLoadNamespacesNoDefault(t *testing.T) { nm, _, cleanup := newTestNamespaceManager(t, true) defer cleanup() - coreconfig.Reset() viper.SetConfigType("yaml") err := viper.ReadConfig(strings.NewReader(` namespaces: @@ -1291,7 +1281,6 @@ func TestLoadNamespacesUseDefaults(t *testing.T) { nm, _, cleanup := newTestNamespaceManager(t, true) defer cleanup() - coreconfig.Reset() viper.SetConfigType("yaml") err := viper.ReadConfig(strings.NewReader(` namespaces: @@ -1319,7 +1308,6 @@ func TestLoadTLSConfigsBadTLS(t *testing.T) { nm, _, cleanup := newTestNamespaceManager(t, true) defer cleanup() - coreconfig.Reset() viper.SetConfigType("yaml") err := viper.ReadConfig(strings.NewReader(` namespaces: @@ -1347,7 +1335,6 @@ func TestLoadTLSConfigsNotEnabled(t *testing.T) { nm, _, cleanup := newTestNamespaceManager(t, true) defer cleanup() - coreconfig.Reset() viper.SetConfigType("yaml") err := viper.ReadConfig(strings.NewReader(` namespaces: @@ -1424,7 +1411,6 @@ func TestLoadTLSConfigs(t *testing.T) { Certificates: []tls.Certificate{cert}, } - coreconfig.Reset() viper.SetConfigType("yaml") err = viper.ReadConfig(strings.NewReader(fmt.Sprintf(` namespaces: @@ -1460,7 +1446,6 @@ func TestLoadTLSConfigsDuplicateConfigs(t *testing.T) { publicKeyFile, privateKeyFile, cleanCertificates := generateTestCertificates() defer cleanCertificates() - coreconfig.Reset() viper.SetConfigType("yaml") err := viper.ReadConfig(strings.NewReader(fmt.Sprintf(` namespaces: @@ -1495,7 +1480,6 @@ func TestLoadNamespacesWithErrorTLSConfigs(t *testing.T) { nm, _, cleanup := newTestNamespaceManager(t, true) defer cleanup() - coreconfig.Reset() viper.SetConfigType("yaml") err := viper.ReadConfig(strings.NewReader(` namespaces: @@ -1521,7 +1505,6 @@ func TestLoadNamespacesNonMultipartyNoDatabase(t *testing.T) { nm, _, cleanup := newTestNamespaceManager(t, true) defer cleanup() - coreconfig.Reset() viper.SetConfigType("yaml") err := viper.ReadConfig(strings.NewReader(` namespaces: @@ -1541,7 +1524,6 @@ func TestLoadNamespacesMultipartyUnknownPlugin(t *testing.T) { nm, _, cleanup := newTestNamespaceManager(t, true) defer cleanup() - coreconfig.Reset() viper.SetConfigType("yaml") err := viper.ReadConfig(strings.NewReader(` namespaces: @@ -1562,7 +1544,6 @@ func TestLoadNamespacesMultipartyMultipleBlockchains(t *testing.T) { nm, _, cleanup := newTestNamespaceManager(t, true) defer cleanup() - coreconfig.Reset() viper.SetConfigType("yaml") err := viper.ReadConfig(strings.NewReader(` namespaces: @@ -1583,7 +1564,6 @@ func TestLoadNamespacesMultipartyMultipleDX(t *testing.T) { nm, _, cleanup := newTestNamespaceManager(t, true) defer cleanup() - coreconfig.Reset() viper.SetConfigType("yaml") err := viper.ReadConfig(strings.NewReader(` namespaces: @@ -1604,7 +1584,6 @@ func TestLoadNamespacesMultipartyMultipleSS(t *testing.T) { nm, _, cleanup := newTestNamespaceManager(t, true) defer cleanup() - coreconfig.Reset() viper.SetConfigType("yaml") err := viper.ReadConfig(strings.NewReader(` namespaces: @@ -1625,7 +1604,6 @@ func TestLoadNamespacesMultipartyMultipleDB(t *testing.T) { nm, _, cleanup := newTestNamespaceManager(t, true) defer cleanup() - coreconfig.Reset() viper.SetConfigType("yaml") err := viper.ReadConfig(strings.NewReader(` namespaces: @@ -1646,7 +1624,6 @@ func TestLoadNamespacesMultipartyMultipleAuths(t *testing.T) { nm, _, cleanup := newTestNamespaceManager(t, true) defer cleanup() - coreconfig.Reset() viper.SetConfigType("yaml") err := viper.ReadConfig(strings.NewReader(` namespaces: @@ -1667,7 +1644,6 @@ func TestLoadNamespacesMultipartyMultipleIdentity(t *testing.T) { nm, _, cleanup := newTestNamespaceManager(t, true) defer cleanup() - coreconfig.Reset() viper.SetConfigType("yaml") err := viper.ReadConfig(strings.NewReader(` namespaces: @@ -1688,7 +1664,6 @@ func TestInitNamespacesMultipartyWithAuth(t *testing.T) { nm, _, cleanup := newTestNamespaceManager(t, true) defer cleanup() - coreconfig.Reset() viper.SetConfigType("yaml") err := viper.ReadConfig(strings.NewReader(` namespaces: @@ -1709,7 +1684,6 @@ func TestLoadNamespacesNonMultipartyWithAuth(t *testing.T) { nm, _, cleanup := newTestNamespaceManager(t, true) defer cleanup() - coreconfig.Reset() viper.SetConfigType("yaml") err := viper.ReadConfig(strings.NewReader(` namespaces: @@ -1730,7 +1704,6 @@ func TestLoadNamespacesMultipartyContract(t *testing.T) { nm, _, cleanup := newTestNamespaceManager(t, true) defer cleanup() - coreconfig.Reset() viper.SetConfigType("yaml") err := viper.ReadConfig(strings.NewReader(` namespaces: @@ -1754,7 +1727,6 @@ func TestLoadNamespacesNonMultipartyMultipleDB(t *testing.T) { nm, _, cleanup := newTestNamespaceManager(t, true) defer cleanup() - coreconfig.Reset() viper.SetConfigType("yaml") err := viper.ReadConfig(strings.NewReader(` namespaces: @@ -1773,7 +1745,6 @@ func TestLoadNamespacesNonMultipartyMultipleBlockchains(t *testing.T) { nm, _, cleanup := newTestNamespaceManager(t, true) defer cleanup() - coreconfig.Reset() viper.SetConfigType("yaml") err := viper.ReadConfig(strings.NewReader(` namespaces: @@ -1792,7 +1763,6 @@ func TestLoadNamespacesMultipartyMissingPlugins(t *testing.T) { nm, _, cleanup := newTestNamespaceManager(t, true) defer cleanup() - coreconfig.Reset() viper.SetConfigType("yaml") err := viper.ReadConfig(strings.NewReader(` namespaces: @@ -1813,7 +1783,6 @@ func TestLoadNamespacesNonMultipartyUnknownPlugin(t *testing.T) { nm, _, cleanup := newTestNamespaceManager(t, true) defer cleanup() - coreconfig.Reset() viper.SetConfigType("yaml") err := viper.ReadConfig(strings.NewReader(` namespaces: @@ -1832,7 +1801,6 @@ func TestLoadNamespacesNonMultipartyTokens(t *testing.T) { nm, _, cleanup := newTestNamespaceManager(t, true) defer cleanup() - coreconfig.Reset() viper.SetConfigType("yaml") err := viper.ReadConfig(strings.NewReader(` namespaces: @@ -1943,7 +1911,6 @@ func TestReset(t *testing.T) { } func TestResetRejectIfConfigAutoReload(t *testing.T) { - coreconfig.Reset() config.Set(coreconfig.ConfigAutoReload, true) nm, _, cleanup := newTestNamespaceManager(t, true) @@ -2113,7 +2080,6 @@ func TestValidateNonMultipartyConfig(t *testing.T) { nm, _, cleanup := newTestNamespaceManager(t, true) defer cleanup() - coreconfig.Reset() viper.SetConfigType("yaml") err := viper.ReadConfig(strings.NewReader(` namespaces: diff --git a/internal/networkmap/manager_test.go b/internal/networkmap/manager_test.go index 204bc5f622..ba8eb780cb 100644 --- a/internal/networkmap/manager_test.go +++ b/internal/networkmap/manager_test.go @@ -31,7 +31,6 @@ import ( ) func newTestNetworkmap(t *testing.T) (*networkMap, func()) { - coreconfig.Reset() ctx, cancel := context.WithCancel(context.Background()) mdi := &databasemocks.Plugin{} mds := &definitionsmocks.Sender{} diff --git a/internal/operations/manager_test.go b/internal/operations/manager_test.go index 626dc7292f..7b1ecb2708 100644 --- a/internal/operations/manager_test.go +++ b/internal/operations/manager_test.go @@ -75,7 +75,6 @@ func (m *mockHandler) OnOperationUpdate(ctx context.Context, op *core.Operation, } func newTestOperations(t *testing.T) (*operationsManager, func()) { - coreconfig.Reset() config.Set(coreconfig.OpUpdateWorkerCount, 1) ctx, cancel := context.WithCancel(context.Background()) mdi := &databasemocks.Plugin{} @@ -113,7 +112,6 @@ func TestInitFail(t *testing.T) { func TestCacheInitFail(t *testing.T) { cacheInitError := errors.New("Initialization error.") - coreconfig.Reset() config.Set(coreconfig.OpUpdateWorkerCount, 1) mdi := &databasemocks.Plugin{} mdi.On("Capabilities").Return(&database.Capabilities{ diff --git a/internal/operations/operation_updater_test.go b/internal/operations/operation_updater_test.go index 6d31db81a7..fa7a4c4f4a 100644 --- a/internal/operations/operation_updater_test.go +++ b/internal/operations/operation_updater_test.go @@ -47,7 +47,6 @@ func newTestOperationUpdaterNoConcurrency(t *testing.T) *operationUpdater { } func newTestOperationUpdaterCommon(t *testing.T, dbCapabilities *database.Capabilities) *operationUpdater { - coreconfig.Reset() config.Set(coreconfig.OpUpdateWorkerCount, 1) config.Set(coreconfig.OpUpdateWorkerBatchTimeout, "1s") config.Set(coreconfig.OpUpdateWorkerBatchMaxInserts, 200) diff --git a/internal/orchestrator/orchestrator_test.go b/internal/orchestrator/orchestrator_test.go index 6c2cc85e67..2aa8d1e39b 100644 --- a/internal/orchestrator/orchestrator_test.go +++ b/internal/orchestrator/orchestrator_test.go @@ -118,7 +118,6 @@ func (tor *testOrchestrator) cleanup(t *testing.T) { } func newTestOrchestrator() *testOrchestrator { - coreconfig.Reset() ctx, cancel := context.WithCancel(context.Background()) tor := &testOrchestrator{ orchestrator: orchestrator{ @@ -454,7 +453,6 @@ func TestInitOperationsComponentFail(t *testing.T) { } func TestStartBatchFail(t *testing.T) { - coreconfig.Reset() or := newTestOrchestrator() defer or.cleanup(t) or.mdm.On("Start").Return(nil) @@ -474,7 +472,6 @@ func TestInitTXWriter(t *testing.T) { } func TestStartStopOk(t *testing.T) { - coreconfig.Reset() or := newTestOrchestrator() defer or.cleanup(t) or.mdm.On("Start").Return(nil) @@ -524,7 +521,6 @@ func TestStartStopOk(t *testing.T) { } func TestPurge(t *testing.T) { - coreconfig.Reset() or := newTestOrchestrator() defer or.cleanup(t) // Note additional testing of this happens in namespace manager @@ -542,7 +538,6 @@ func TestPurge(t *testing.T) { } func TestPurgeBlockchainError(t *testing.T) { - coreconfig.Reset() or := newTestOrchestrator() defer or.cleanup(t) // Note additional testing of this happens in namespace manager @@ -558,7 +553,6 @@ func TestPurgeBlockchainError(t *testing.T) { } func TestPurgeTokenError(t *testing.T) { - coreconfig.Reset() or := newTestOrchestrator() defer or.cleanup(t) // Note additional testing of this happens in namespace manager diff --git a/internal/orchestrator/status_test.go b/internal/orchestrator/status_test.go index 91f2bd6d38..c7c1f78ed7 100644 --- a/internal/orchestrator/status_test.go +++ b/internal/orchestrator/status_test.go @@ -79,7 +79,6 @@ func TestGetStatusRegistered(t *testing.T) { or := newTestOrchestrator() defer or.cleanup(t) - coreconfig.Reset() config.Set(coreconfig.NamespacesDefault, "default") orgID := fftypes.NewUUID() @@ -141,7 +140,6 @@ func TestGetStatusVerifierLookupFail(t *testing.T) { or := newTestOrchestrator() defer or.cleanup(t) - coreconfig.Reset() config.Set(coreconfig.NamespacesDefault, "default") orgID := fftypes.NewUUID() @@ -167,7 +165,6 @@ func TestGetStatusWrongNodeOwner(t *testing.T) { or := newTestOrchestrator() defer or.cleanup(t) - coreconfig.Reset() config.Set(coreconfig.NamespacesDefault, "default") orgID := fftypes.NewUUID() @@ -220,7 +217,6 @@ func TestGetStatusUnregistered(t *testing.T) { or := newTestOrchestrator() defer or.cleanup(t) - coreconfig.Reset() config.Set(coreconfig.NamespacesDefault, "default") or.mim.On("GetRootOrg", or.ctx).Return(nil, fmt.Errorf("pop")) @@ -247,7 +243,6 @@ func TestGetStatusOrgOnlyRegistered(t *testing.T) { or := newTestOrchestrator() defer or.cleanup(t) - coreconfig.Reset() config.Set(coreconfig.NamespacesDefault, "default") orgID := fftypes.NewUUID() @@ -299,7 +294,6 @@ func TestGetStatusNodeError(t *testing.T) { or := newTestOrchestrator() defer or.cleanup(t) - coreconfig.Reset() config.Set(coreconfig.NamespacesDefault, "default") orgID := fftypes.NewUUID() @@ -333,7 +327,6 @@ func TestGetMultipartyStatusMultipartyNotEnabled(t *testing.T) { or := newTestOrchestrator() defer or.cleanup(t) - coreconfig.Reset() config.Set(coreconfig.NamespacesDefault, "default") or.config.Multiparty.Enabled = false @@ -348,7 +341,6 @@ func TestGetMultipartyStatusUnregistered(t *testing.T) { or := newTestOrchestrator() defer or.cleanup(t) - coreconfig.Reset() config.Set(coreconfig.NamespacesDefault, "default") or.mim.On("GetRootOrg", or.ctx).Return(nil, fmt.Errorf("pop")) @@ -375,7 +367,6 @@ func TestGetMultipartyStatusRegisteringOrg(t *testing.T) { or := newTestOrchestrator() defer or.cleanup(t) - coreconfig.Reset() config.Set(coreconfig.NamespacesDefault, "default") or.mim.On("GetRootOrg", or.ctx).Return(nil, fmt.Errorf("pop")) @@ -411,7 +402,6 @@ func TestGetMultipartyStatusMismatchedOrgRegistration(t *testing.T) { or := newTestOrchestrator() defer or.cleanup(t) - coreconfig.Reset() config.Set(coreconfig.NamespacesDefault, "default") or.mim.On("GetRootOrg", or.ctx).Return(nil, fmt.Errorf("pop")) @@ -446,7 +436,6 @@ func TestGetMultipartyStatusOrgBadMessage(t *testing.T) { or := newTestOrchestrator() defer or.cleanup(t) - coreconfig.Reset() config.Set(coreconfig.NamespacesDefault, "default") or.mim.On("GetRootOrg", or.ctx).Return(nil, fmt.Errorf("pop")) @@ -476,7 +465,6 @@ func TestGetMultipartyStatusMessageErrorRegisteringOrg(t *testing.T) { or := newTestOrchestrator() defer or.cleanup(t) - coreconfig.Reset() config.Set(coreconfig.NamespacesDefault, "default") or.mim.On("GetRootOrg", or.ctx).Return(nil, fmt.Errorf("pop")) @@ -497,7 +485,6 @@ func TestGetMultipartyStatusRegisteringNode(t *testing.T) { or := newTestOrchestrator() defer or.cleanup(t) - coreconfig.Reset() config.Set(coreconfig.NamespacesDefault, "default") orgID := fftypes.NewUUID() @@ -548,7 +535,6 @@ func TestGetMultipartyStatusMismatchedNodeRegistration(t *testing.T) { or := newTestOrchestrator() defer or.cleanup(t) - coreconfig.Reset() config.Set(coreconfig.NamespacesDefault, "default") orgID := fftypes.NewUUID() @@ -596,7 +582,6 @@ func TestGetMultipartyStatusNodeBadMessage(t *testing.T) { or := newTestOrchestrator() defer or.cleanup(t) - coreconfig.Reset() config.Set(coreconfig.NamespacesDefault, "default") orgID := fftypes.NewUUID() @@ -641,7 +626,6 @@ func TestGetMultipartyStatusMessageErrorRegisteringNode(t *testing.T) { or := newTestOrchestrator() defer or.cleanup(t) - coreconfig.Reset() config.Set(coreconfig.NamespacesDefault, "default") orgID := fftypes.NewUUID() @@ -678,7 +662,6 @@ func TestGetMultipartyStatusUnregisteredNode(t *testing.T) { or := newTestOrchestrator() defer or.cleanup(t) - coreconfig.Reset() config.Set(coreconfig.NamespacesDefault, "default") orgID := fftypes.NewUUID() @@ -721,7 +704,6 @@ func TestGetMultipartyStatusRegistered(t *testing.T) { or := newTestOrchestrator() defer or.cleanup(t) - coreconfig.Reset() config.Set(coreconfig.NamespacesDefault, "default") orgID := fftypes.NewUUID() @@ -766,7 +748,6 @@ func TestGetMultipartyStatusErrorStatus(t *testing.T) { or := newTestOrchestrator() defer or.cleanup(t) - coreconfig.Reset() config.Set(coreconfig.NamespacesDefault, "default") orgID := fftypes.NewUUID() @@ -795,7 +776,6 @@ func TestCheckRegistrationType(t *testing.T) { or := newTestOrchestrator() defer or.cleanup(t) - coreconfig.Reset() config.Set(coreconfig.NamespacesDefault, "default") or.config.Multiparty.Org.Name = "org1" @@ -872,7 +852,6 @@ func TestGetMultipartyActiveListenerStatus(t *testing.T) { or := newTestOrchestrator() defer or.cleanup(t) - coreconfig.Reset() config.Set(coreconfig.NamespacesDefault, "default") orgID := fftypes.NewUUID() @@ -923,7 +902,6 @@ func TestGetMultipartyErrorActiveListenerStatus(t *testing.T) { or := newTestOrchestrator() defer or.cleanup(t) - coreconfig.Reset() config.Set(coreconfig.NamespacesDefault, "default") orgID := fftypes.NewUUID() diff --git a/internal/privatemessaging/privatemessaging_test.go b/internal/privatemessaging/privatemessaging_test.go index dab7daccd7..1edc251d3d 100644 --- a/internal/privatemessaging/privatemessaging_test.go +++ b/internal/privatemessaging/privatemessaging_test.go @@ -45,7 +45,6 @@ import ( ) func newTestPrivateMessagingCommon(t *testing.T, metricsEnabled bool) (*privateMessaging, func()) { - coreconfig.Reset() config.Set(coreconfig.CacheGroupLimit, "1m") config.Set(coreconfig.CacheGroupTTL, 10) @@ -101,7 +100,6 @@ func newTestPrivateMessagingCommon(t *testing.T, metricsEnabled bool) (*privateM } func TestCacheInitFail(t *testing.T) { - coreconfig.Reset() config.Set(coreconfig.CacheGroupLimit, "1m") config.Set(coreconfig.CacheGroupTTL, 10) diff --git a/internal/shareddownload/download_manager_test.go b/internal/shareddownload/download_manager_test.go index fd217ec9a0..15fef98f21 100644 --- a/internal/shareddownload/download_manager_test.go +++ b/internal/shareddownload/download_manager_test.go @@ -40,7 +40,6 @@ import ( ) func newTestDownloadManager(t *testing.T) (*downloadManager, func()) { - coreconfig.Reset() config.Set(coreconfig.DownloadWorkerCount, 1) config.Set(coreconfig.DownloadRetryMaxAttempts, 0 /* bumps to 1 */) diff --git a/internal/sharedstorage/ipfs/ipfs_test.go b/internal/sharedstorage/ipfs/ipfs_test.go index fa63c5d174..1b4bd4fec3 100644 --- a/internal/sharedstorage/ipfs/ipfs_test.go +++ b/internal/sharedstorage/ipfs/ipfs_test.go @@ -37,7 +37,6 @@ import ( var utConfig = config.RootSection("ipfs_unit_tests") func resetConf() { - coreconfig.Reset() i := &IPFS{} i.InitConfig(utConfig) } diff --git a/internal/spievents/manager_test.go b/internal/spievents/manager_test.go index bbec947634..d68a2d7683 100644 --- a/internal/spievents/manager_test.go +++ b/internal/spievents/manager_test.go @@ -35,7 +35,6 @@ import ( ) func newTestSPIEventsManager(t *testing.T) (ae *adminEventManager, ws *webSocket, wsc wsclient.WSClient, cancel func()) { - coreconfig.Reset() ae = NewAdminEventManager(context.Background()).(*adminEventManager) svr := httptest.NewServer(http.HandlerFunc(ae.ServeHTTPWebSocketListener)) @@ -136,7 +135,6 @@ func TestSPIEventsE2E(t *testing.T) { } func TestBadUpgrade(t *testing.T) { - coreconfig.Reset() ae := NewAdminEventManager(context.Background()).(*adminEventManager) svr := httptest.NewServer(http.HandlerFunc(ae.ServeHTTPWebSocketListener)) diff --git a/internal/tokens/fftokens/fftokens_test.go b/internal/tokens/fftokens/fftokens_test.go index 886e1d80cc..3b9b29c465 100644 --- a/internal/tokens/fftokens/fftokens_test.go +++ b/internal/tokens/fftokens/fftokens_test.go @@ -57,7 +57,6 @@ func newTestFFTokens(t *testing.T) (h *FFTokens, toServer, fromServer chan strin u.Scheme = "http" httpURL = u.String() - coreconfig.Reset() h = &FFTokens{} h.InitConfig(ffTokensConfig) @@ -95,7 +94,6 @@ func TestUnsetHandler(t *testing.T) { } func TestInitBadURL(t *testing.T) { - coreconfig.Reset() h := &FFTokens{} h.InitConfig(ffTokensConfig) @@ -110,7 +108,6 @@ func TestInitBadURL(t *testing.T) { } func TestStartNamespaceConnectFail(t *testing.T) { - coreconfig.Reset() h := &FFTokens{} h.InitConfig(ffTokensConfig) @@ -139,7 +136,6 @@ func TestStopNamespace(t *testing.T) { } func TestInitBadTLS(t *testing.T) { - coreconfig.Reset() h := &FFTokens{} h.InitConfig(ffTokensConfig) @@ -154,7 +150,6 @@ func TestInitBadTLS(t *testing.T) { } func TestInitMissingURL(t *testing.T) { - coreconfig.Reset() h := &FFTokens{} h.InitConfig(ffTokensConfig) diff --git a/internal/txwriter/txwriter_test.go b/internal/txwriter/txwriter_test.go index 80fc41a674..2672fa00ea 100644 --- a/internal/txwriter/txwriter_test.go +++ b/internal/txwriter/txwriter_test.go @@ -39,7 +39,6 @@ import ( func newTestTransactionWriter(t *testing.T, dbCaps *database.Capabilities, mods ...func()) (context.Context, *txWriter, func()) { ctx, cancelCtx := context.WithCancel(context.Background()) - coreconfig.Reset() config.Set(coreconfig.TransactionWriterCount, 1) mdi := &databasemocks.Plugin{} mdi.On("Capabilities").Return(dbCaps)