multi: remove DefaultQueryConfig

And always make use of either the new DefaultSQLiteConfig or
DefaultPostgresConfig.
This commit is contained in:
Elle Mouton committed 2025-08-13 14:43:31 +02:00
1 parent 1082eaaeb3
commit b1deddec44
10 files changed
+95 -92

No files matched your search

+16 -12
View File
@@ -333,9 +333,7 @@ func TestMigrateGraphToSQL(t *testing.T) {
require.True(t, ok)
// Run the migration.
err := MigrateGraphToSQL(
ctx, kvDB.db, sql.db, testChain,
)
err := MigrateGraphToSQL(ctx, sql.cfg, kvDB.db, sql.db)
require.NoError(t, err)
// Validate that the two databases are now in sync.
@@ -753,6 +751,18 @@ func TestMigrationWithChannelDB(t *testing.T) {
// bbolt channel.db file, set this to "channel.db".
const fileName = "channel.sqlite"
cfg := &SQLStoreConfig{
ChainHash: chain,
QueryCfg: sqldb.DefaultPostgresConfig(),
}
// Determine if we are using a SQLite file or a Bolt DB file.
var isSqlite bool
if strings.HasSuffix(fileName, ".sqlite") {
isSqlite = true
cfg.QueryCfg = sqldb.DefaultSQLiteConfig()
}
// Set up logging for the test.
UseLogger(btclog.NewSLogger(btclog.NewDefaultHandler(os.Stdout)))
@@ -763,7 +773,7 @@ func TestMigrationWithChannelDB(t *testing.T) {
err := graphStore.ExecTx(
ctx, sqldb.WriteTxOpt(), func(tx SQLQueries) error {
return MigrateGraphToSQL(
ctx, kvBackend, tx, chain,
ctx, cfg, kvBackend, tx,
)
}, sqldb.NoOpReset,
)
@@ -825,12 +835,6 @@ func TestMigrationWithChannelDB(t *testing.T) {
},
}
// Determine if we are using a SQLite file or a Bolt DB file.
var isSqlite bool
if strings.HasSuffix(fileName, ".sqlite") {
isSqlite = true
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
chanDBPath := path.Join(test.dbPath, fileName)
@@ -1125,7 +1129,7 @@ func runTestMigration(t *testing.T, populateKV func(t *testing.T, db *KVStore),
// Run the migration.
err := MigrateGraphToSQL(
ctx, kvDB.db, sql.db, testChain,
ctx, sql.cfg, kvDB.db, sql.db,
)
require.NoError(t, err)
@@ -1312,7 +1316,7 @@ func testMigrateGraphToSQLRapidOnce(t *testing.T, rt *rapid.T,
}
// Run the migration.
err := MigrateGraphToSQL(ctx, kvDB.db, sql.db, testChain)
err := MigrateGraphToSQL(ctx, sql.cfg, kvDB.db, sql.db)
require.NoError(t, err)
// Create a slice of all nodes.