Documentation
¶
Overview ¶
Package dbtest is the database conformance suite: the same schema, ORM, transaction and migration checks run against every dialect (SQLite in core, Postgres and others in their driver modules).
func TestConformance(t *testing.T) {
db := open(t) // *database.DB for the dialect under test
dbtest.Run(t, db)
}
Run creates and drops its own tables (prefixed "dbt_"), so point it at a throwaway database.
See https://github.com/AlexGalhardo/vukem/blob/main/docs/database.md.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
Run executes the conformance suite against db. Subtests run in order and share tables, so they are not parallel.
Example ¶
A driver module runs the suite from a test against a throwaway database.
package main
import (
"testing"
"github.com/AlexGalhardo/vukem/database"
"github.com/AlexGalhardo/vukem/database/dbtest"
)
func main() {
_ = func(t *testing.T) {
t.Helper()
db, err := database.Open(t.Context(), ":memory:")
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() { _ = db.Close() })
dbtest.Run(t, db)
}
}
Output:
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.