testhelpers

package
v0.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestDataDir = "../testhelper/test_data"
)

Variables

View Source
var TestDBFiles = []string{
	filepath.Join(TestDataDir, "GeoLite2-City.tar.gz"),
	filepath.Join(TestDataDir, "GeoLite2-Country.tar.gz"),
	filepath.Join(TestDataDir, "GeoLite2-ASN.tar.gz"),
}
View Source
var TestDBSHA256Files = []string{
	filepath.Join(TestDataDir, "GeoLite2-City.tar.gz.sha256"),
	filepath.Join(TestDataDir, "GeoLite2-Country.tar.gz.sha256"),
	filepath.Join(TestDataDir, "GeoLite2-ASN.tar.gz.sha256"),
}

Functions

func LoadTestDB

func LoadTestDB() error

func PopulateSeeds

func PopulateSeeds(tx *gorm.DB) error

PopulateSeeds populates the test database with seed data from SQL files. This data is used by tests and provides a consistent baseline for testing.

func SetupSharedTestDB

func SetupSharedTestDB(t *testing.T) *commonDB.DB

SetupSharedTestDB creates a shared test database that persists across all tests. The database is created once and reused for all tests in the package. This is more efficient than creating a new database for each test.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL