mirror of
https://github.com/netbirdio/netbird.git
synced 2026-07-22 00:11:29 +02:00
minor changes and linter
This commit is contained in:
@@ -238,8 +238,6 @@ func connectDBforTest(ctx context.Context, dsn string) (*pgxpool.Pool, error) {
|
||||
pool.Close()
|
||||
return nil, fmt.Errorf("unable to ping database: %w", err)
|
||||
}
|
||||
|
||||
fmt.Println("Successfully connected to the database!")
|
||||
return pool, nil
|
||||
}
|
||||
|
||||
@@ -269,7 +267,10 @@ func setupBenchmarkDB(b testing.TB) (*SqlStore, func(), string) {
|
||||
}
|
||||
|
||||
for i := len(models) - 1; i >= 0; i-- {
|
||||
db.Migrator().DropTable(models[i])
|
||||
err := db.Migrator().DropTable(models[i])
|
||||
if err != nil {
|
||||
b.Fatalf("failed to drop table: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
err = db.AutoMigrate(models...)
|
||||
|
||||
@@ -468,6 +468,9 @@ func getSqlStoreEngine(ctx context.Context, store *SqlStore, kind types.Engine)
|
||||
closeConnection := func() {
|
||||
cleanup()
|
||||
store.Close(ctx)
|
||||
if store.pool != nil {
|
||||
store.pool.Close()
|
||||
}
|
||||
}
|
||||
|
||||
return store, closeConnection, nil
|
||||
|
||||
Reference in New Issue
Block a user