- flare: send region run by TestDocsNotifyReply against a loopback TLS push service; blogSubscriptions and the publish-source region run by TestDocsSubscriptionSource on a Postgres container (skips under -short) - kiosk: write, newest and client regions run by TestDocsWriteManifest (a copy of the literal fixture), ExampleVersionsResponse and TestDocsBlogReleases (httptest registry); the CheckT fence reuses TestPluginManifest - lagoon: new open region run by TestDocsOpenFromApp (DocsDSN added to export_docs_test.go); the model, create-post, on-database, publish and migrations fences reuse the Database pages' targets
31 lines
802 B
Go
31 lines
802 B
Go
package lagoon
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// DocsDB returns a GORM handle on a fresh database named name in this
|
|
// package's Postgres harness, for the database-backed docs examples in
|
|
// example_test.go. It skips under -short and fails when the harness has no
|
|
// database, like the package's other database tests.
|
|
func DocsDB(t *testing.T, name string) *gorm.DB {
|
|
t.Helper()
|
|
db, _ := dedicatedDB(t, name)
|
|
gdb, err := Use(t.Context(), db)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
return gdb
|
|
}
|
|
|
|
// DocsDSN returns the DSN of a fresh database named name in this package's
|
|
// Postgres harness, for the docs example that opens the pool from config.
|
|
// It skips under -short like DocsDB.
|
|
func DocsDSN(t *testing.T, name string) string {
|
|
t.Helper()
|
|
_, dsn := dedicatedDB(t, name)
|
|
return dsn
|
|
}
|