github.com/kubecost/golang-migrate-duckdb/v4@v4.17.0-duckdb.1/database/testing/migrate_testing.go (about)

     1  // Package testing has the database tests.
     2  // All database drivers must pass the Test function.
     3  // This lives in it's own package so it stays a test dependency.
     4  package testing
     5  
     6  import (
     7  	"testing"
     8  )
     9  
    10  import (
    11  	"github.com/golang-migrate/migrate/v4"
    12  )
    13  
    14  // TestMigrate runs integration-tests between the Migrate layer and database implementations.
    15  func TestMigrate(t *testing.T, m *migrate.Migrate) {
    16  	TestMigrateUp(t, m)
    17  	TestMigrateDrop(t, m)
    18  }
    19  
    20  // Regression test for preventing a regression for #164 https://github.com/golang-migrate/migrate/pull/173
    21  // Similar to TestDrop(), but tests the dropping mechanism through the Migrate logic instead, to check for
    22  // double-locking during the Drop logic.
    23  func TestMigrateDrop(t *testing.T, m *migrate.Migrate) {
    24  	if err := m.Drop(); err != nil {
    25  		t.Fatal(err)
    26  	}
    27  }
    28  
    29  func TestMigrateUp(t *testing.T, m *migrate.Migrate) {
    30  	t.Log("UP")
    31  	if err := m.Up(); err != nil {
    32  		t.Fatal(err)
    33  	}
    34  }