Skip to content

Commit

Permalink
fix: switch tests
Browse files Browse the repository at this point in the history
  • Loading branch information
avallete committed Nov 20, 2024
1 parent 2cdee7c commit 48cea10
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions internal/db/branch/switch_/switch__test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ func TestSwitchCommand(t *testing.T) {
Reply("ALTER DATABASE").
Query(fmt.Sprintf(utils.TerminateDbSqlFmt, "postgres")).
Reply("DO").
Query("ALTER DATABASE _supabase ALLOW_CONNECTIONS false;").
Reply("ALTER DATABASE").
Query(fmt.Sprintf(utils.TerminateDbSqlFmt, "_supabase")).
Reply("DO").
Query("ALTER DATABASE postgres RENAME TO main;").
Reply("ALTER DATABASE").
Query("ALTER DATABASE " + branch + " RENAME TO postgres;").
Expand Down Expand Up @@ -238,6 +242,10 @@ func TestSwitchDatabase(t *testing.T) {
Reply("ALTER DATABASE").
Query(fmt.Sprintf(utils.TerminateDbSqlFmt, "postgres")).
Reply("DO").
Query("ALTER DATABASE _supabase ALLOW_CONNECTIONS false;").
Reply("ALTER DATABASE").
Query(fmt.Sprintf(utils.TerminateDbSqlFmt, "_supabase")).
Reply("DO").
Query("ALTER DATABASE postgres RENAME TO main;").
ReplyError(pgerrcode.DuplicateDatabase, `database "main" already exists`)
// Setup mock docker
Expand All @@ -264,6 +272,10 @@ func TestSwitchDatabase(t *testing.T) {
Reply("ALTER DATABASE").
Query(fmt.Sprintf(utils.TerminateDbSqlFmt, "postgres")).
Reply("DO").
Query("ALTER DATABASE _supabase ALLOW_CONNECTIONS false;").
Reply("ALTER DATABASE").
Query(fmt.Sprintf(utils.TerminateDbSqlFmt, "_supabase")).
Reply("DO").
Query("ALTER DATABASE postgres RENAME TO main;").
Reply("ALTER DATABASE").
Query("ALTER DATABASE target RENAME TO postgres;").
Expand Down

0 comments on commit 48cea10

Please sign in to comment.