Skip to content

Commit f0a5c2f

Browse files
aceppaluniryjones
authored andcommitted
Removed calls to reset
Signed-off-by: Angelina <[email protected]> Signed-off-by: Ry Jones <[email protected]>
1 parent b3b5b2c commit f0a5c2f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+3
-161
lines changed

cmd/firefly.go

-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ func init() {
8383
}
8484

8585
func resetConfig() {
86-
coreconfig.Reset()
8786
namespace.InitConfig()
8887
apiserver.InitConfig()
8988
}

doc-site/config_docs_generate_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import (
3434

3535
func TestGenerateConfigDocs(t *testing.T) {
3636
// Initialize config of all plugins
37-
coreconfig.Reset()
3837
namespace.InitConfig()
3938
apiserver.InitConfig()
4039
f, err := os.Create(filepath.Join("docs", "reference", "config.md"))

doc-site/config_docs_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import (
3535

3636
func TestConfigDocsUpToDate(t *testing.T) {
3737
// Initialize config of all plugins
38-
coreconfig.Reset()
3938
namespace.InitConfig()
4039
apiserver.InitConfig()
4140
generatedConfig, err := config.GenerateConfigMarkdown(context.Background(), configDocHeader, config.GetKnownKeys())

internal/apiserver/server_test.go

-7
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ import (
5353
const configDir = "../../test/data/config"
5454

5555
func newTestServer() (*namespacemocks.Manager, *orchestratormocks.Orchestrator, *apiServer) {
56-
coreconfig.Reset()
5756
InitConfig()
5857
mgr := &namespacemocks.Manager{}
5958
o := &orchestratormocks.Orchestrator{}
@@ -81,7 +80,6 @@ func newTestSPIServer() (*orchestratormocks.Orchestrator, *mux.Router) {
8180
}
8281

8382
func TestStartStopServer(t *testing.T) {
84-
coreconfig.Reset()
8583
metrics.Clear()
8684
InitConfig()
8785
apiConfig.Set(httpserver.HTTPConfPort, 0)
@@ -100,7 +98,6 @@ func TestStartStopServer(t *testing.T) {
10098
}
10199

102100
func TestStartLegacyAdminConfig(t *testing.T) {
103-
coreconfig.Reset()
104101
metrics.Clear()
105102
InitConfig()
106103
apiConfig.Set(httpserver.HTTPConfPort, 0)
@@ -119,7 +116,6 @@ func TestStartLegacyAdminConfig(t *testing.T) {
119116
}
120117

121118
func TestStartAPIFail(t *testing.T) {
122-
coreconfig.Reset()
123119
metrics.Clear()
124120
InitConfig()
125121
apiConfig.Set(httpserver.HTTPConfAddress, "...://")
@@ -132,7 +128,6 @@ func TestStartAPIFail(t *testing.T) {
132128
}
133129

134130
func TestStartAdminFail(t *testing.T) {
135-
coreconfig.Reset()
136131
metrics.Clear()
137132
InitConfig()
138133
spiConfig.Set(httpserver.HTTPConfAddress, "...://")
@@ -148,7 +143,6 @@ func TestStartAdminFail(t *testing.T) {
148143
}
149144

150145
func TestStartAdminWSHandler(t *testing.T) {
151-
coreconfig.Reset()
152146
metrics.Clear()
153147
InitConfig()
154148
spiConfig.Set(httpserver.HTTPConfAddress, "...://")
@@ -167,7 +161,6 @@ func TestStartAdminWSHandler(t *testing.T) {
167161
}
168162

169163
func TestStartMetricsFail(t *testing.T) {
170-
coreconfig.Reset()
171164
metrics.Clear()
172165
InitConfig()
173166
metricsConfig.Set(httpserver.HTTPConfAddress, "...://")

internal/apiserver/swagger_check_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import (
3838
)
3939

4040
func TestDiffSwaggerYAML(t *testing.T) {
41-
coreconfig.Reset()
4241
config.Set(coreconfig.APIOASPanicOnMissingDescription, true)
4342
as := &apiServer{}
4443
hf := as.handlerFactory()

internal/apiserver/swagger_generate_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import (
3737
)
3838

3939
func TestDownloadSwaggerYAML(t *testing.T) {
40-
coreconfig.Reset()
4140
config.Set(coreconfig.APIOASPanicOnMissingDescription, true)
4241
as := &apiServer{}
4342
hf := as.handlerFactory()

internal/assets/manager_test.go

-5
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ func newTestAssetsWithMetrics(t *testing.T) (*assetManager, func()) {
5353
}
5454

5555
func newTestAssetsCommon(t *testing.T, metrics bool) (*assetManager, func()) {
56-
coreconfig.Reset()
5756
mdi := &databasemocks.Plugin{}
5857
mim := &identitymanagermocks.Manager{}
5958
mdm := &datamocks.Manager{}
@@ -91,7 +90,6 @@ func TestInitFail(t *testing.T) {
9190

9291
func TestCacheInitFail(t *testing.T) {
9392
cacheInitError := errors.New("Initialization error.")
94-
coreconfig.Reset()
9593
mdi := &databasemocks.Plugin{}
9694
mdm := &datamocks.Manager{}
9795
mim := &identitymanagermocks.Manager{}
@@ -163,7 +161,6 @@ func TestGetTokenConnectors(t *testing.T) {
163161
}
164162

165163
func TestStart(t *testing.T) {
166-
coreconfig.Reset()
167164
mdi := &databasemocks.Plugin{}
168165
mdm := &datamocks.Manager{}
169166
mim := &identitymanagermocks.Manager{}
@@ -193,7 +190,6 @@ func TestStart(t *testing.T) {
193190
}
194191

195192
func TestStartDBError(t *testing.T) {
196-
coreconfig.Reset()
197193
mdi := &databasemocks.Plugin{}
198194
mdm := &datamocks.Manager{}
199195
mim := &identitymanagermocks.Manager{}
@@ -216,7 +212,6 @@ func TestStartDBError(t *testing.T) {
216212
}
217213

218214
func TestStartError(t *testing.T) {
219-
coreconfig.Reset()
220215
mdi := &databasemocks.Plugin{}
221216
mdm := &datamocks.Manager{}
222217
mim := &identitymanagermocks.Manager{}

internal/batch/batch_manager_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ import (
4040
)
4141

4242
func testConfigReset() {
43-
coreconfig.Reset()
4443
config.Set(coreconfig.BatchManagerMinimumPollDelay, "0")
4544
log.SetLevel("debug")
4645
}

internal/batch/batch_processor_test.go

-7
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ func (tce *testConflictError) IsConflictError() bool {
8989

9090
func TestUnfilledBatch(t *testing.T) {
9191
log.SetLevel("debug")
92-
coreconfig.Reset()
9392

9493
dispatched := make(chan *DispatchPayload)
9594
cancel, mdi, bp := newTestBatchProcessor(t, func(c context.Context, state *DispatchPayload) error {
@@ -154,7 +153,6 @@ func TestHandleDispatchConflictError(t *testing.T) {
154153

155154
func TestBatchSizeOverflow(t *testing.T) {
156155
log.SetLevel("debug")
157-
coreconfig.Reset()
158156

159157
dispatched := make(chan *DispatchPayload)
160158
cancel, mdi, bp := newTestBatchProcessor(t, func(c context.Context, state *DispatchPayload) error {
@@ -553,7 +551,6 @@ func TestStartQuiesceNonBlocking(t *testing.T) {
553551

554552
func TestMarkMessageDispatchedUnpinnedOK(t *testing.T) {
555553
log.SetLevel("debug")
556-
coreconfig.Reset()
557554

558555
dispatched := make(chan *DispatchPayload)
559556
cancel, mdi, bp := newTestBatchProcessor(t, func(c context.Context, state *DispatchPayload) error {
@@ -611,7 +608,6 @@ func TestMarkMessageDispatchedUnpinnedOK(t *testing.T) {
611608

612609
func TestMaskContextsRetryAfterPinsAssigned(t *testing.T) {
613610
log.SetLevel("debug")
614-
coreconfig.Reset()
615611

616612
dispatched := make(chan *DispatchPayload)
617613
cancel, mdi, bp := newTestBatchProcessor(t, func(c context.Context, state *DispatchPayload) error {
@@ -681,7 +677,6 @@ func TestMaskContextsRetryAfterPinsAssigned(t *testing.T) {
681677

682678
func TestMaskContextsUpdateMessageFail(t *testing.T) {
683679
log.SetLevel("debug")
684-
coreconfig.Reset()
685680

686681
dispatched := make(chan *DispatchPayload)
687682
cancel, mdi, bp := newTestBatchProcessor(t, func(c context.Context, state *DispatchPayload) error {
@@ -720,7 +715,6 @@ func TestMaskContextsUpdateMessageFail(t *testing.T) {
720715
}
721716

722717
func TestSealBatchTXAlreadyAssigned(t *testing.T) {
723-
coreconfig.Reset()
724718

725719
dispatched := make(chan *DispatchPayload)
726720
cancel, mdi, bp := newTestBatchProcessor(t, func(c context.Context, state *DispatchPayload) error {
@@ -831,7 +825,6 @@ func TestCalculateContextsLoadPinsFail(t *testing.T) {
831825

832826
func TestBigBatchEstimate(t *testing.T) {
833827
log.SetLevel("debug")
834-
coreconfig.Reset()
835828

836829
bd := []byte(`{
837830
"id": "37ba893b-fcfa-4cf9-8ce8-34cd8bc9bc72",

internal/blockchain/ethereum/address_resolver_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ import (
3939
)
4040

4141
func utAddresResolverConfig() config.Section {
42-
coreconfig.Reset()
4342
config := config.RootSection("utaddressresovler")
4443
(&Ethereum{}).InitConfig(config)
4544
return config.SubSection(AddressResolverConfigKey)

internal/blockchain/ethereum/ethereum_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ func testFFIErrors() []*fftypes.FFIError {
113113
}
114114

115115
func resetConf(e *Ethereum) {
116-
coreconfig.Reset()
117116
e.InitConfig(utConfig)
118117
}
119118

internal/blockchain/fabric/fabric_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ var utFabconnectConf = utConfig.SubSection(FabconnectConfigKey)
5555
var signer = "orgMSP::x509::CN=signer001,OU=client::CN=fabric-ca"
5656

5757
func resetConf(e *Fabric) {
58-
coreconfig.Reset()
5958
e.InitConfig(utConfig)
6059
}
6160

internal/blockchain/tezos/address_resolver_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import (
3838
)
3939

4040
func utAddresResolverConfig() config.Section {
41-
coreconfig.Reset()
4241
config := config.RootSection("utaddressresovler")
4342
(&Tezos{}).InitConfig(config)
4443
return config.SubSection(AddressResolverConfigKey)

internal/blockchain/tezos/tezos_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ func testFFIMethod() *fftypes.FFIMethod {
8989
}
9090

9191
func resetConf(t *Tezos) {
92-
coreconfig.Reset()
9392
t.InitConfig(utConfig)
9493
}
9594

internal/broadcast/manager_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ import (
4646
)
4747

4848
func newTestBroadcastCommon(t *testing.T, metricsEnabled bool) (*broadcastManager, func()) {
49-
coreconfig.Reset()
5049
mdi := &databasemocks.Plugin{}
5150
mim := &identitymanagermocks.Manager{}
5251
mdm := &datamocks.Manager{}

internal/cache/cache_test.go

-5
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727
)
2828

2929
func TestNewCacheCreationFail(t *testing.T) {
30-
coreconfig.Reset()
3130
ctx := context.Background()
3231
cacheManager := NewCacheManager(ctx)
3332
_, err := cacheManager.GetCache(NewCacheConfig(ctx, "", "", ""))
@@ -41,7 +40,6 @@ func TestNewCacheCreationFail(t *testing.T) {
4140
}
4241

4342
func TestGetCacheReturnsSameCacheForSameConfig(t *testing.T) {
44-
coreconfig.Reset()
4543
ctx := context.Background()
4644
cacheManager := NewCacheManager(ctx)
4745
cache0, _ := cacheManager.GetCache(NewCacheConfig(ctx, "cache.batch.limit", "cache.batch.ttl", "testnamespace"))
@@ -57,7 +55,6 @@ func TestGetCacheReturnsSameCacheForSameConfig(t *testing.T) {
5755
}
5856

5957
func TestTwoSeparateCacheWorksIndependently(t *testing.T) {
60-
coreconfig.Reset()
6158
ctx := context.Background()
6259
cacheManager := NewCacheManager(ctx)
6360
cache0, _ := cacheManager.GetCache(NewCacheConfig(ctx, "cache.batch.limit", "cache.batch.ttl", ""))
@@ -77,7 +74,6 @@ func TestTwoSeparateCacheWorksIndependently(t *testing.T) {
7774
}
7875

7976
func TestReturnsDummyCacheWhenCacheDisabled(t *testing.T) {
80-
coreconfig.Reset()
8177
config.Set(coreconfig.CacheEnabled, false)
8278
ctx := context.Background()
8379
cacheManager := NewCacheManager(ctx)
@@ -93,7 +89,6 @@ func TestUmmanagedCacheInstance(t *testing.T) {
9389
}
9490

9591
func TestResetCachesForNamespace(t *testing.T) {
96-
coreconfig.Reset()
9792
ctx := context.Background()
9893
cacheManager := NewCacheManager(ctx)
9994
cacheNS1, _ := cacheManager.GetCache(NewCacheConfig(ctx, "cache.batch.limit", "cache.batch.ttl", "ns1"))

internal/coreconfig/coreconfig_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import (
2626
const configDir = "../../test/data/config"
2727

2828
func TestInitConfigOK(t *testing.T) {
29-
Reset()
3029

3130
assert.Equal(t, 25, config.GetInt(APIDefaultFilterLimit))
3231
assert.Equal(t, "localhost", config.GetString(DebugAddress))

internal/data/data_manager_test.go

-5
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ import (
4040

4141
func TestCacheInitFail(t *testing.T) {
4242
cacheInitError := errors.New("Initialization error.")
43-
coreconfig.Reset()
4443
config.Set(coreconfig.MessageWriterCount, 1)
4544
ctx := context.Background()
4645
mdi := &databasemocks.Plugin{}
@@ -80,7 +79,6 @@ func TestCacheInitFail(t *testing.T) {
8079
}
8180

8281
func newTestDataManager(t *testing.T) (*dataManager, context.Context, func()) {
83-
coreconfig.Reset()
8482
config.Set(coreconfig.MessageWriterCount, 1)
8583
ctx, cancel := context.WithCancel(context.Background())
8684
mdi := &databasemocks.Plugin{}
@@ -134,7 +132,6 @@ func testNewMessage() (*fftypes.UUID, *fftypes.Bytes32, *NewMessage) {
134132

135133
func TestValidateE2E(t *testing.T) {
136134

137-
coreconfig.Reset()
138135
dm, ctx, cancel := newTestDataManager(t)
139136
defer cancel()
140137
mdi := dm.database.(*databasemocks.Plugin)
@@ -281,7 +278,6 @@ func TestInitBadDeps(t *testing.T) {
281278
}
282279

283280
func TestValidatorLookupCached(t *testing.T) {
284-
coreconfig.Reset()
285281
dm, ctx, cancel := newTestDataManager(t)
286282
defer cancel()
287283
mdi := dm.database.(*databasemocks.Plugin)
@@ -309,7 +305,6 @@ func TestValidatorLookupCached(t *testing.T) {
309305

310306
func TestValidateBadHash(t *testing.T) {
311307

312-
coreconfig.Reset()
313308
dm, ctx, cancel := newTestDataManager(t)
314309
defer cancel()
315310
mdi := dm.database.(*databasemocks.Plugin)

internal/database/sqlcommon/chart_sql_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ func TestGetChartHistogramValidCollectionNameWithTypes(t *testing.T) {
135135

136136
func TestGetChartHistogramValidCollectionNameWithTypesAndCapped(t *testing.T) {
137137
s, mock := newMockProvider().init()
138-
coreconfig.Reset()
139138
config.Set(coreconfig.HistogramsMaxChartRows, 10)
140139
for i := range validCollectionsWithTypes {
141140
mock.ExpectQuery("SELECT .*").WillReturnRows(sqlmock.NewRows([]string{"timestamp", "type"}).

internal/database/sqlcommon/provider_mock_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ type mockProvider struct {
4949
}
5050

5151
func newMockProvider() *mockProvider {
52-
coreconfig.Reset()
5352
conf := config.RootSection("unittest.db")
5453
conf.AddKnownKey("url", "test")
5554
mp := &mockProvider{

0 commit comments

Comments
 (0)