From 25d00e3518ee32cd61402513014368d096b65aec Mon Sep 17 00:00:00 2001 From: Egutierrez Date: Mon, 13 Apr 2026 02:07:27 +0200 Subject: [PATCH] fix: rename openTestDB to openMigrationTestDB to avoid redeclaration with job_queue_test.go Co-Authored-By: Claude Opus 4.6 (1M context) --- functions/infra/migration_down_test.go | 8 ++++---- functions/infra/migration_integration_test.go | 2 +- functions/infra/migration_status_test.go | 8 ++++---- functions/infra/migration_up_test.go | 10 +++++----- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/functions/infra/migration_down_test.go b/functions/infra/migration_down_test.go index e38fb869..c2c2e67c 100644 --- a/functions/infra/migration_down_test.go +++ b/functions/infra/migration_down_test.go @@ -6,7 +6,7 @@ import ( func TestMigrationDown(t *testing.T) { t.Run("revertir ultima migracion elimina registro y ejecuta down_sql", func(t *testing.T) { - db := openTestDB(t) + db := openMigrationTestDB(t) dir := t.TempDir() writeMigrationFile(t, dir, "001_create_users.sql", @@ -42,7 +42,7 @@ func TestMigrationDown(t *testing.T) { }) t.Run("revertir n migraciones revierte en orden descendente", func(t *testing.T) { - db := openTestDB(t) + db := openMigrationTestDB(t) dir := t.TempDir() writeMigrationFile(t, dir, "001_create_users.sql", @@ -76,7 +76,7 @@ func TestMigrationDown(t *testing.T) { }) t.Run("n cero no revierte nada", func(t *testing.T) { - db := openTestDB(t) + db := openMigrationTestDB(t) dir := t.TempDir() writeMigrationFile(t, dir, "001_create_users.sql", @@ -96,7 +96,7 @@ func TestMigrationDown(t *testing.T) { }) t.Run("base de datos sin migraciones retorna slice vacio", func(t *testing.T) { - db := openTestDB(t) + db := openMigrationTestDB(t) dir := t.TempDir() // Apply to create _migrations table diff --git a/functions/infra/migration_integration_test.go b/functions/infra/migration_integration_test.go index 95853cc2..d84f05b2 100644 --- a/functions/infra/migration_integration_test.go +++ b/functions/infra/migration_integration_test.go @@ -9,7 +9,7 @@ import ( // TestMigrationIntegration covers the full create -> up -> status -> down -> status cycle. func TestMigrationIntegration(t *testing.T) { t.Run("ciclo completo create up status down status", func(t *testing.T) { - db := openTestDB(t) + db := openMigrationTestDB(t) dir := t.TempDir() // Step 1: Create migration files using MigrationCreate diff --git a/functions/infra/migration_status_test.go b/functions/infra/migration_status_test.go index 064c7e15..a796c8fb 100644 --- a/functions/infra/migration_status_test.go +++ b/functions/infra/migration_status_test.go @@ -6,7 +6,7 @@ import ( func TestMigrationStatus(t *testing.T) { t.Run("migraciones en disco pero no en BD aparecen como pending", func(t *testing.T) { - db := openTestDB(t) + db := openMigrationTestDB(t) dir := t.TempDir() writeMigrationFile(t, dir, "001_create_users.sql", @@ -29,7 +29,7 @@ func TestMigrationStatus(t *testing.T) { }) t.Run("migraciones aplicadas aparecen con Applied=true y AppliedAt", func(t *testing.T) { - db := openTestDB(t) + db := openMigrationTestDB(t) dir := t.TempDir() writeMigrationFile(t, dir, "001_create_users.sql", @@ -59,7 +59,7 @@ func TestMigrationStatus(t *testing.T) { }) t.Run("migraciones aplicadas sin archivo en disco aparecen como orphaned", func(t *testing.T) { - db := openTestDB(t) + db := openMigrationTestDB(t) dir := t.TempDir() writeMigrationFile(t, dir, "001_create_users.sql", @@ -89,7 +89,7 @@ func TestMigrationStatus(t *testing.T) { }) t.Run("base de datos sin tabla _migrations retorna todas como pending", func(t *testing.T) { - db := openTestDB(t) + db := openMigrationTestDB(t) dir := t.TempDir() writeMigrationFile(t, dir, "001_create_users.sql", diff --git a/functions/infra/migration_up_test.go b/functions/infra/migration_up_test.go index f0ea377e..c15dd721 100644 --- a/functions/infra/migration_up_test.go +++ b/functions/infra/migration_up_test.go @@ -9,7 +9,7 @@ import ( _ "github.com/mattn/go-sqlite3" ) -func openTestDB(t *testing.T) *sql.DB { +func openMigrationTestDB(t *testing.T) *sql.DB { t.Helper() db, err := sql.Open("sqlite3", ":memory:") if err != nil { @@ -28,7 +28,7 @@ func writeMigrationFile(t *testing.T, dir, filename, content string) { func TestMigrationUp(t *testing.T) { t.Run("base de datos vacia aplica todas las migraciones", func(t *testing.T) { - db := openTestDB(t) + db := openMigrationTestDB(t) dir := t.TempDir() writeMigrationFile(t, dir, "001_create_users.sql", @@ -58,7 +58,7 @@ func TestMigrationUp(t *testing.T) { }) t.Run("migraciones ya aplicadas se omiten", func(t *testing.T) { - db := openTestDB(t) + db := openMigrationTestDB(t) dir := t.TempDir() writeMigrationFile(t, dir, "001_create_users.sql", @@ -83,7 +83,7 @@ func TestMigrationUp(t *testing.T) { }) t.Run("migracion con SQL invalido retorna error y deja las anteriores aplicadas", func(t *testing.T) { - db := openTestDB(t) + db := openMigrationTestDB(t) dir := t.TempDir() writeMigrationFile(t, dir, "001_create_users.sql", @@ -108,7 +108,7 @@ func TestMigrationUp(t *testing.T) { }) t.Run("directorio sin archivos sql no aplica nada", func(t *testing.T) { - db := openTestDB(t) + db := openMigrationTestDB(t) dir := t.TempDir() applied, err := MigrationUp(db, dir)