diff --git a/tests/clickhouse/clickhouse_test.go b/tests/clickhouse/clickhouse_test.go index 42d087e..2ccfbe9 100644 --- a/tests/clickhouse/clickhouse_test.go +++ b/tests/clickhouse/clickhouse_test.go @@ -1,6 +1,8 @@ package clickhouse_test import ( + "log" + "os" "path/filepath" "testing" "time" @@ -10,6 +12,13 @@ import ( "github.com/pressly/goose/v3/internal/testdb" ) +func TestMain(m *testing.M) { + if err := goose.SetDialect("clickhouse"); err != nil { + log.Fatal(err) + } + os.Exit(m.Run()) +} + func TestClickUpDownAll(t *testing.T) { t.Parallel() @@ -18,8 +27,6 @@ func TestClickUpDownAll(t *testing.T) { check.NoError(t, err) t.Cleanup(cleanup) - check.NoError(t, goose.SetDialect("clickhouse")) - /* This test applies all up migrations, asserts we have all the entries in the versions table, applies all down migration and asserts we have zero @@ -70,8 +77,6 @@ func TestClickHouseFirstThree(t *testing.T) { check.NoError(t, err) t.Cleanup(cleanup) - check.NoError(t, goose.SetDialect("clickhouse")) - err = goose.Up(db, migrationDir) check.NoError(t, err) @@ -140,8 +145,6 @@ func TestRemoteImportMigration(t *testing.T) { check.NoError(t, err) t.Cleanup(cleanup) - check.NoError(t, goose.SetDialect("clickhouse")) - err = goose.Up(db, migrationDir) check.NoError(t, err) _, err = goose.GetDBVersion(db)