Skip to content

Commit

Permalink
#4911: use root cmd instance not package var for migrate tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sreuland committed Jul 12, 2024
1 parent 50fef11 commit b1573d0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions services/horizon/internal/integration/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -873,12 +873,13 @@ func TestMigrateIngestIsTrueByDefault(t *testing.T) {
newDB := dbtest.Postgres(t)
freshHorizonPostgresURL := newDB.DSN

horizoncmd.RootCmd.SetArgs([]string{
rootCmd := horizoncmd.NewRootCmd()
rootCmd.SetArgs([]string{
// ingest is set to true by default
"--db-url", freshHorizonPostgresURL,
"db", "migrate", "up",
})
tt.NoError(horizoncmd.RootCmd.Execute())
tt.NoError(rootCmd.Execute())

dbConn, err := db.Open("postgres", freshHorizonPostgresURL)
tt.NoError(err)
Expand All @@ -894,12 +895,13 @@ func TestMigrateChecksIngestFlag(t *testing.T) {
newDB := dbtest.Postgres(t)
freshHorizonPostgresURL := newDB.DSN

horizoncmd.RootCmd.SetArgs([]string{
rootCmd := horizoncmd.NewRootCmd()
rootCmd.SetArgs([]string{
"--ingest=false",
"--db-url", freshHorizonPostgresURL,
"db", "migrate", "up",
})
tt.NoError(horizoncmd.RootCmd.Execute())
tt.NoError(rootCmd.Execute())

dbConn, err := db.Open("postgres", freshHorizonPostgresURL)
tt.NoError(err)
Expand Down

0 comments on commit b1573d0

Please sign in to comment.