Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

horizon/integration/test: added test for reingest with --ledgerbackend datastore #5383

Merged
merged 14 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
#4911: use flag config instance not global for test root cmd execution
  • Loading branch information
sreuland committed Jul 12, 2024
commit a3c452e1ab441afec77ccfcadba46f0e60dfebce
12 changes: 6 additions & 6 deletions services/horizon/cmd/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ func requireAndSetFlags(horizonFlags config.ConfigOptions, names ...string) erro
return fmt.Errorf("could not find %s flags", strings.Join(missing, ","))
}

func migrate(dir schema.MigrateDir, count int) error {
if !globalConfig.Ingest {
func migrate(dir schema.MigrateDir, count int, horizonConfig *horizon.Config) error {
if !horizonConfig.Ingest {
log.Println("Skipping migrations because ingest flag is not enabled")
return nil
}

dbConn, err := db.Open("postgres", globalConfig.DatabaseURL)
dbConn, err := db.Open("postgres", horizonConfig.DatabaseURL)
if err != nil {
return err
}
Expand Down Expand Up @@ -335,7 +335,7 @@ func DefineDBCommands(rootCmd *cobra.Command, horizonConfig *horizon.Config, hor
return ErrUsage{cmd}
}

return migrate(schema.MigrateDown, count)
return migrate(schema.MigrateDown, count, horizonConfig)
},
}

Expand All @@ -359,7 +359,7 @@ func DefineDBCommands(rootCmd *cobra.Command, horizonConfig *horizon.Config, hor
return ErrUsage{cmd}
}

return migrate(schema.MigrateRedo, count)
return migrate(schema.MigrateRedo, count, horizonConfig)
},
}

Expand Down Expand Up @@ -417,7 +417,7 @@ func DefineDBCommands(rootCmd *cobra.Command, horizonConfig *horizon.Config, hor
}
}

return migrate(schema.MigrateUp, count)
return migrate(schema.MigrateUp, count, horizonConfig)
},
}

Expand Down
2 changes: 1 addition & 1 deletion services/horizon/internal/integration/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ func TestReingestDBWithFilterRules(t *testing.T) {
fmt.Sprintf("%d", reachedLedger),
))

tt.NoError(horizoncmd.RootCmd.Execute())
tt.NoError(rootCmd.Execute())

// bring up horizon, just the api server no ingestion, to query
// for tx's that should have been repopulated on db from reingestion per
Expand Down
Loading