Files
kontor/kontor-gin/internal/tests/testutils/db_test_helper.go
T
Thomas Peetz 980eda29af
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s
add tests for repository
2026-10-06 17:11:42 +02:00

40 lines
695 B
Go

package testutils
import (
"log/slog"
"os"
"testing"
)
func SetupTestDatabase() {
slog.Info("SetupTestDatabase")
}
func PatchDatabase() {
slog.Info("PatchDatabase")
}
func TearDownTestDatabase() {
slog.Info("TearDownTestDatabase")
}
func UnpatchDatabase() {
slog.Info("UnpatchDatabase")
}
func InitializeTestSuite(m *testing.M) {
slog.Info("InitializeTestSuite")
// Initialize the test database
SetupTestDatabase()
// Patch the global database.DB to use the TestDB
PatchDatabase()
// Run all tests
code := m.Run()
// Teardown the database connection
TearDownTestDatabase()
// Unpatch the database
UnpatchDatabase()
// Exit with the test run status code
os.Exit(code)
}