mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 16:59:12 +00:00
chore(database): remove unused test func (#1465)
chore(database): Remove unused func
This commit is contained in:
parent
56aa7dd5cb
commit
575944de1e
1 changed files with 0 additions and 41 deletions
|
@ -24,47 +24,6 @@ func getDbs() []string {
|
||||||
|
|
||||||
var testDBs map[string]*DB
|
var testDBs map[string]*DB
|
||||||
|
|
||||||
func setupDatabaseForTest(t *testing.T, dbType string) *DB {
|
|
||||||
if d, ok := testDBs[dbType]; ok {
|
|
||||||
return d
|
|
||||||
}
|
|
||||||
|
|
||||||
err := os.Setenv("IS_TEST_ENV", "true")
|
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("Could not set env variable: %v", err)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
cfg := &domain.Config{
|
|
||||||
LogLevel: "INFO",
|
|
||||||
DatabaseType: dbType,
|
|
||||||
PostgresHost: "localhost",
|
|
||||||
PostgresPort: 5437,
|
|
||||||
PostgresDatabase: "autobrr",
|
|
||||||
PostgresUser: "testdb",
|
|
||||||
PostgresPass: "testdb",
|
|
||||||
PostgresSSLMode: "disable",
|
|
||||||
}
|
|
||||||
|
|
||||||
// Init a new logger
|
|
||||||
log := logger.New(cfg)
|
|
||||||
|
|
||||||
// Initialize a new DB connection
|
|
||||||
db, err := NewDB(cfg, log)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("Could not create database: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Open the database connection
|
|
||||||
if err := db.Open(); err != nil {
|
|
||||||
t.Fatalf("Could not open db connection: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
testDBs[dbType] = db
|
|
||||||
|
|
||||||
return db
|
|
||||||
}
|
|
||||||
|
|
||||||
func setupPostgresForTest() *DB {
|
func setupPostgresForTest() *DB {
|
||||||
dbtype := "postgres"
|
dbtype := "postgres"
|
||||||
if d, ok := testDBs[dbtype]; ok {
|
if d, ok := testDBs[dbtype]; ok {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue