Skip to content

Commit

Permalink
refactor: invert naming on GetTestPostgresDatabase to preserve origin…
Browse files Browse the repository at this point in the history
…al functionality
  • Loading branch information
seanmcgary committed Jan 15, 2025
1 parent 5ba5dcd commit 7449213
Show file tree
Hide file tree
Showing 24 changed files with 27 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func setup() (

l, _ := logger.NewLogger(&logger.LoggerConfig{Debug: cfg.Debug})

dbname, _, grm, err := postgres.GetTestPostgresDatabaseWithMigrations(cfg.DatabaseConfig, cfg, l)
dbname, _, grm, err := postgres.GetTestPostgresDatabase(cfg.DatabaseConfig, cfg, l)
if err != nil {
return dbname, nil, nil, nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/eigenState/avsOperators/avsOperators_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func setup() (

l, _ := logger.NewLogger(&logger.LoggerConfig{Debug: cfg.Debug})

dbname, _, grm, err := postgres.GetTestPostgresDatabaseWithMigrations(cfg.DatabaseConfig, cfg, l)
dbname, _, grm, err := postgres.GetTestPostgresDatabase(cfg.DatabaseConfig, cfg, l)
if err != nil {
return dbname, nil, nil, nil, err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func setup() (

l, _ := logger.NewLogger(&logger.LoggerConfig{Debug: cfg.Debug})

dbname, _, grm, err := postgres.GetTestPostgresDatabaseWithMigrations(cfg.DatabaseConfig, cfg, l)
dbname, _, grm, err := postgres.GetTestPostgresDatabase(cfg.DatabaseConfig, cfg, l)
if err != nil {
return dbname, nil, nil, nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/eigenState/eigenstate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func setup() (

l, _ := logger.NewLogger(&logger.LoggerConfig{Debug: cfg.Debug})

dbname, _, grm, err := postgres.GetTestPostgresDatabaseWithMigrations(cfg.DatabaseConfig, cfg, l)
dbname, _, grm, err := postgres.GetTestPostgresDatabase(cfg.DatabaseConfig, cfg, l)
if err != nil {
return dbname, nil, nil, nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/eigenState/operatorShares/operatorShares_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func setup() (

l, _ := logger.NewLogger(&logger.LoggerConfig{Debug: cfg.Debug})

dbname, _, grm, err := postgres.GetTestPostgresDatabaseWithMigrations(cfg.DatabaseConfig, cfg, l)
dbname, _, grm, err := postgres.GetTestPostgresDatabase(cfg.DatabaseConfig, cfg, l)
if err != nil {
return dbname, nil, nil, nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/eigenState/rewardSubmissions/rewardSubmissions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func setup() (

l, _ := logger.NewLogger(&logger.LoggerConfig{Debug: cfg.Debug})

dbname, _, grm, err := postgres.GetTestPostgresDatabaseWithMigrations(cfg.DatabaseConfig, cfg, l)
dbname, _, grm, err := postgres.GetTestPostgresDatabase(cfg.DatabaseConfig, cfg, l)
if err != nil {
return dbname, nil, nil, nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/eigenState/stakerDelegations/stakerDelegations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func setup() (

l, _ := logger.NewLogger(&logger.LoggerConfig{Debug: cfg.Debug})

dbname, _, grm, err := postgres.GetTestPostgresDatabaseWithMigrations(cfg.DatabaseConfig, cfg, l)
dbname, _, grm, err := postgres.GetTestPostgresDatabase(cfg.DatabaseConfig, cfg, l)
if err != nil {
return dbname, nil, nil, nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/eigenState/stakerShares/stakerShares_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func setup() (

l, _ := logger.NewLogger(&logger.LoggerConfig{Debug: cfg.Debug})

dbname, _, grm, err := postgres.GetTestPostgresDatabaseWithMigrations(cfg.DatabaseConfig, cfg, l)
dbname, _, grm, err := postgres.GetTestPostgresDatabase(cfg.DatabaseConfig, cfg, l)
if err != nil {
return dbname, nil, nil, nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/eigenState/stateManager/stateManager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func setup() (

l, _ := logger.NewLogger(&logger.LoggerConfig{Debug: cfg.Debug})

dbname, _, grm, err := postgres.GetTestPostgresDatabaseWithMigrations(cfg.DatabaseConfig, cfg, l)
dbname, _, grm, err := postgres.GetTestPostgresDatabase(cfg.DatabaseConfig, cfg, l)
if err != nil {
return dbname, nil, nil, nil, err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func setup() (

l, _ := logger.NewLogger(&logger.LoggerConfig{Debug: cfg.Debug})

dbname, _, grm, err := postgres.GetTestPostgresDatabaseWithMigrations(cfg.DatabaseConfig, cfg, l)
dbname, _, grm, err := postgres.GetTestPostgresDatabase(cfg.DatabaseConfig, cfg, l)
if err != nil {
return dbname, nil, nil, nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/indexer/restakedStrategies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func setup() (

l, _ := logger.NewLogger(&logger.LoggerConfig{Debug: cfg.Debug})

dbname, _, grm, err := postgres.GetTestPostgresDatabaseWithMigrations(cfg.DatabaseConfig, cfg, l)
dbname, _, grm, err := postgres.GetTestPostgresDatabase(cfg.DatabaseConfig, cfg, l)
if err != nil {
return dbname, nil, nil, nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/pipeline/pipelineIntegration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func setup(ethConfig *ethereum.EthereumClientConfig) (
ethConfig.BaseUrl = rpcUrl
client := ethereum.NewClient(ethConfig, l)

dbname, _, grm, err := postgres.GetTestPostgresDatabaseWithMigrations(cfg.DatabaseConfig, cfg, l)
dbname, _, grm, err := postgres.GetTestPostgresDatabase(cfg.DatabaseConfig, cfg, l)
if err != nil {
log.Fatal(err)
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/postgres/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ type Postgres struct {
Db *sql.DB
}

func GetTestPostgresDatabaseWithMigrations(cfg config.DatabaseConfig, gCfg *config.Config, l *zap.Logger) (
func GetTestPostgresDatabase(cfg config.DatabaseConfig, gCfg *config.Config, l *zap.Logger) (
string,
*sql.DB,
*gorm.DB,
error,
) {
testDbName, pg, grm, err := GetTestPostgresDatabase(cfg, l)
testDbName, pg, grm, err := GetTestPostgresDatabaseWithoutMigrations(cfg, l)
if err != nil {
return testDbName, nil, nil, err
}
Expand All @@ -48,7 +48,7 @@ func GetTestPostgresDatabaseWithMigrations(cfg config.DatabaseConfig, gCfg *conf
return testDbName, pg, grm, nil
}

func GetTestPostgresDatabase(cfg config.DatabaseConfig, l *zap.Logger) (
func GetTestPostgresDatabaseWithoutMigrations(cfg config.DatabaseConfig, l *zap.Logger) (
string,
*sql.DB,
*gorm.DB,
Expand Down
2 changes: 1 addition & 1 deletion pkg/rewards/combinedRewards_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func setupCombinedRewards() (

l, _ := logger.NewLogger(&logger.LoggerConfig{Debug: cfg.Debug})

dbname, _, grm, err := postgres.GetTestPostgresDatabaseWithMigrations(cfg.DatabaseConfig, cfg, l)
dbname, _, grm, err := postgres.GetTestPostgresDatabase(cfg.DatabaseConfig, cfg, l)
if err != nil {
return dbname, nil, nil, nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/rewards/operatorAvsRegistrationSnaphots_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func setupOperatorAvsRegistrationSnapshot() (

l, _ := logger.NewLogger(&logger.LoggerConfig{Debug: cfg.Debug})

dbname, _, grm, err := postgres.GetTestPostgresDatabaseWithMigrations(cfg.DatabaseConfig, cfg, l)
dbname, _, grm, err := postgres.GetTestPostgresDatabase(cfg.DatabaseConfig, cfg, l)
if err != nil {
return dbname, nil, nil, nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/rewards/operatorAvsStrategySnapshots_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func setupOperatorAvsStrategyWindows() (

l, _ := logger.NewLogger(&logger.LoggerConfig{Debug: cfg.Debug})

dbname, _, grm, err := postgres.GetTestPostgresDatabaseWithMigrations(cfg.DatabaseConfig, cfg, l)
dbname, _, grm, err := postgres.GetTestPostgresDatabase(cfg.DatabaseConfig, cfg, l)
if err != nil {
return dbname, nil, nil, nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/rewards/operatorShareSnapshots_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func setupOperatorShareSnapshot() (

l, _ := logger.NewLogger(&logger.LoggerConfig{Debug: cfg.Debug})

dbname, _, grm, err := postgres.GetTestPostgresDatabaseWithMigrations(cfg.DatabaseConfig, cfg, l)
dbname, _, grm, err := postgres.GetTestPostgresDatabase(cfg.DatabaseConfig, cfg, l)
if err != nil {
return dbname, nil, nil, nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/rewards/operatorShares_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func setupOperatorShares() (

l, _ := logger.NewLogger(&logger.LoggerConfig{Debug: cfg.Debug})

dbname, _, grm, err := postgres.GetTestPostgresDatabaseWithMigrations(cfg.DatabaseConfig, cfg, l)
dbname, _, grm, err := postgres.GetTestPostgresDatabase(cfg.DatabaseConfig, cfg, l)
if err != nil {
return dbname, nil, nil, nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/rewards/rewards_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func setupRewards() (

l, _ := logger.NewLogger(&logger.LoggerConfig{Debug: cfg.Debug})

dbname, _, grm, err := postgres.GetTestPostgresDatabaseWithMigrations(cfg.DatabaseConfig, cfg, l)
dbname, _, grm, err := postgres.GetTestPostgresDatabase(cfg.DatabaseConfig, cfg, l)
if err != nil {
return dbname, nil, nil, nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/rewards/stakerDelegationSnapshots_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func setupStakerDelegationSnapshot() (

l, _ := logger.NewLogger(&logger.LoggerConfig{Debug: cfg.Debug})

dbname, _, grm, err := postgres.GetTestPostgresDatabaseWithMigrations(cfg.DatabaseConfig, cfg, l)
dbname, _, grm, err := postgres.GetTestPostgresDatabase(cfg.DatabaseConfig, cfg, l)
if err != nil {
return dbname, nil, nil, nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/rewards/stakerShareSnapshots_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func setupStakerShareSnapshot() (

l, _ := logger.NewLogger(&logger.LoggerConfig{Debug: cfg.Debug})

dbname, _, grm, err := postgres.GetTestPostgresDatabaseWithMigrations(cfg.DatabaseConfig, cfg, l)
dbname, _, grm, err := postgres.GetTestPostgresDatabase(cfg.DatabaseConfig, cfg, l)
if err != nil {
return dbname, nil, nil, nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/rewards/stakerShares_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func setupStakerShares() (

l, _ := logger.NewLogger(&logger.LoggerConfig{Debug: cfg.Debug})

dbname, _, grm, err := postgres.GetTestPostgresDatabaseWithMigrations(cfg.DatabaseConfig, cfg, l)
dbname, _, grm, err := postgres.GetTestPostgresDatabase(cfg.DatabaseConfig, cfg, l)
if err != nil {
return dbname, nil, nil, nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/snapshot/snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func TestCreateAndRestoreSnapshot(t *testing.T) {
}

t.Run("Create snapshot from a database with migrations", func(t *testing.T) {
dbName, _, dbGrm, dbErr := postgres.GetTestPostgresDatabaseWithMigrations(cfg.DatabaseConfig, cfg, l)
dbName, _, dbGrm, dbErr := postgres.GetTestPostgresDatabase(cfg.DatabaseConfig, cfg, l)
if dbErr != nil {
t.Fatal(dbErr)
}
Expand Down Expand Up @@ -188,7 +188,7 @@ func TestCreateAndRestoreSnapshot(t *testing.T) {
})

t.Run("Restore snapshot to a new database", func(t *testing.T) {
dbName, _, dbGrm, dbErr := postgres.GetTestPostgresDatabase(cfg.DatabaseConfig, l)
dbName, _, dbGrm, dbErr := postgres.GetTestPostgresDatabaseWithoutMigrations(cfg.DatabaseConfig, l)
if dbErr != nil {
t.Fatal(dbErr)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/postgres/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func setup() (

l, _ := logger.NewLogger(&logger.LoggerConfig{Debug: cfg.Debug})

dbname, _, grm, err := postgres.GetTestPostgresDatabaseWithMigrations(cfg.DatabaseConfig, cfg, l)
dbname, _, grm, err := postgres.GetTestPostgresDatabase(cfg.DatabaseConfig, cfg, l)
if err != nil {
return dbname, nil, nil, nil, err
}
Expand Down

0 comments on commit 7449213

Please sign in to comment.