From d3955e6f7717fdbbd77d304b8369574784aaebbd Mon Sep 17 00:00:00 2001 From: Urvi Date: Fri, 19 Jan 2024 15:14:19 -0800 Subject: [PATCH] Fix linter errors --- exp/services/ledgerexporter/internal/app.go | 6 +++--- exp/services/ledgerexporter/internal/config.go | 4 ++-- exp/services/ledgerexporter/internal/config_test.go | 3 ++- .../ledgerexporter/internal/exportmanager_test.go | 8 +++++--- support/storage/mock_storage.go | 3 ++- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/exp/services/ledgerexporter/internal/app.go b/exp/services/ledgerexporter/internal/app.go index b266035063..47b88adf6c 100644 --- a/exp/services/ledgerexporter/internal/app.go +++ b/exp/services/ledgerexporter/internal/app.go @@ -119,7 +119,7 @@ func (a *App) Run() { } func NewDestinationStorage(config *Config) storage.Storage { - destinationStorage, err := storage.ConnectBackend(config.DestinationUrl, storage.ConnectOptions{}) + destinationStorage, err := storage.ConnectBackend(config.DestinationURL, storage.ConnectOptions{}) logFatalIf(err, "Could not connect to destination storage") return destinationStorage } @@ -131,7 +131,7 @@ func NewLedgerBackend(config Config) ledgerbackend.LedgerBackend { params := ledgerbackend.CaptiveCoreTomlParams{ NetworkPassphrase: coreConfig.NetworkPassphrase, HistoryArchiveURLs: coreConfig.HistoryArchiveUrls, - UseDB: coreConfig.CaptiveCoreUseDb, + UseDB: coreConfig.CaptiveCoreUseDB, } if coreConfig.CaptiveCoreTomlPath == "" { logger.Fatal("Missing captive_core_toml_path in the config") @@ -147,7 +147,7 @@ func NewLedgerBackend(config Config) ledgerbackend.LedgerBackend { CheckpointFrequency: 64, Log: logger.WithField("subservice", "stellar-core"), Toml: captiveCoreToml, - UseDB: coreConfig.CaptiveCoreUseDb, + UseDB: coreConfig.CaptiveCoreUseDB, } // Create a new captive core backend diff --git a/exp/services/ledgerexporter/internal/config.go b/exp/services/ledgerexporter/internal/config.go index 19668c635d..24c5ed1246 100644 --- a/exp/services/ledgerexporter/internal/config.go +++ b/exp/services/ledgerexporter/internal/config.go @@ -14,12 +14,12 @@ type StellarCoreConfig struct { HistoryArchiveUrls []string `toml:"history_archive_urls"` StellarCoreBinaryPath string `toml:"stellar_core_binary_path"` CaptiveCoreTomlPath string `toml:"captive_core_toml_path"` - CaptiveCoreUseDb bool `toml:"captive_core_use_db"` + CaptiveCoreUseDB bool `toml:"captive_core_use_db"` } type Config struct { Network string `toml:"network"` - DestinationUrl string `toml:"destination_url"` + DestinationURL string `toml:"destination_url"` ExporterConfig ExporterConfig `toml:"exporter_config"` StellarCoreConfig StellarCoreConfig `toml:"stellar_core_config"` diff --git a/exp/services/ledgerexporter/internal/config_test.go b/exp/services/ledgerexporter/internal/config_test.go index c051d44cc9..d7d30afadf 100644 --- a/exp/services/ledgerexporter/internal/config_test.go +++ b/exp/services/ledgerexporter/internal/config_test.go @@ -1,8 +1,9 @@ package exporter import ( - "github.com/stretchr/testify/assert" "testing" + + "github.com/stretchr/testify/assert" ) func TestInvalidEndLedgerBoundedMode(t *testing.T) { diff --git a/exp/services/ledgerexporter/internal/exportmanager_test.go b/exp/services/ledgerexporter/internal/exportmanager_test.go index b13c35c9b8..b57377048a 100644 --- a/exp/services/ledgerexporter/internal/exportmanager_test.go +++ b/exp/services/ledgerexporter/internal/exportmanager_test.go @@ -9,7 +9,6 @@ import ( "github.com/stellar/go/ingest/ledgerbackend" "github.com/stellar/go/support/collections/set" "github.com/stellar/go/xdr" - _ "github.com/stellar/go/xdr" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" ) @@ -65,7 +64,9 @@ func (s *ExportManagerSuite) TestRun() { } }() - exporter.Run(s.ctx, uint32(start), uint32(end)) + err := exporter.Run(s.ctx, uint32(start), uint32(end)) + assert.NoError(s.T(), err) + wg.Wait() assert.Equal(s.T(), expectedObjectkeys, actualObjectKeys) @@ -91,7 +92,7 @@ func (s *ExportManagerSuite) TestAddLedgerCloseMeta() { start := 0 end := 255 for i := start; i <= end; i++ { - exporter.AddLedgerCloseMeta(xdr.LedgerCloseMeta{ + err := exporter.AddLedgerCloseMeta(xdr.LedgerCloseMeta{ V0: &xdr.LedgerCloseMetaV0{ LedgerHeader: xdr.LedgerHeaderHistoryEntry{ Header: xdr.LedgerHeader{ @@ -100,6 +101,7 @@ func (s *ExportManagerSuite) TestAddLedgerCloseMeta() { }, }, }) + assert.NoError(s.T(), err) key, _ := config.getObjectKey(uint32(i)) expectedObjectkeys.Add(key) } diff --git a/support/storage/mock_storage.go b/support/storage/mock_storage.go index c78804c177..4c07992675 100644 --- a/support/storage/mock_storage.go +++ b/support/storage/mock_storage.go @@ -1,8 +1,9 @@ package storage import ( - "github.com/stretchr/testify/mock" "io" + + "github.com/stretchr/testify/mock" ) // MockStorage is a mock implementation for the Storage interface.