Files
upstream-golang-migrate/database/testing/migrate_testing.go
upstream-mirror 9f3bffc2d3
Some checks failed
CI / test (1.26.x) (push) Failing after 5s
CI / Check coverage (push) Has been skipped
CI / lint (push) Failing after 41s
CI / test (1.25.x) (push) Failing after 54s
CI / Release a new version (push) Has been skipped
snapshot of https://github.com/golang-migrate/migrate.git (master, 2026-09-15; blobs > 131072B omitted)
2026-09-15 21:52:57 +05:00

35 lines
934 B
Go

// Package testing has the database tests.
// All database drivers must pass the Test function.
// This lives in it's own package so it stays a test dependency.
package testing
import (
"testing"
)
import (
"github.com/golang-migrate/migrate/v4"
)
// TestMigrate runs integration-tests between the Migrate layer and database implementations.
func TestMigrate(t *testing.T, m *migrate.Migrate) {
TestMigrateUp(t, m)
TestMigrateDrop(t, m)
}
// Regression test for preventing a regression for #164 https://github.com/golang-migrate/migrate/pull/173
// Similar to TestDrop(), but tests the dropping mechanism through the Migrate logic instead, to check for
// double-locking during the Drop logic.
func TestMigrateDrop(t *testing.T, m *migrate.Migrate) {
if err := m.Drop(); err != nil {
t.Fatal(err)
}
}
func TestMigrateUp(t *testing.T, m *migrate.Migrate) {
t.Log("UP")
if err := m.Up(); err != nil {
t.Fatal(err)
}
}