testutil

package
v1.18.14 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package testutil provides shared test helpers for ent client setup.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupClient

func SetupClient(t testing.TB) *ent.Client

SetupClient creates an in-memory SQLite-backed ent client for testing. Each call gets an isolated database so parallel tests do not conflict. The client is automatically closed when the test completes via t.Cleanup.

Accepts testing.TB so benchmarks can reuse the same setup as tests; any *testing.T or *testing.B value satisfies the interface.

func SetupClientWithDB

func SetupClientWithDB(t testing.TB) (*ent.Client, *sql.DB)

SetupClientWithDB creates an in-memory SQLite-backed ent client for testing and also returns the underlying *sql.DB for raw SQL operations (e.g. sync_status table). Each call gets an isolated database so parallel tests do not conflict. Both the client and the DB are automatically closed via t.Cleanup.

Accepts testing.TB for the same reason as SetupClient above.

Types

This section is empty.

Directories

Path Synopsis
Package parity holds upstream-ported fixture data for the Phase 72 parity regression test suite.
Package parity holds upstream-ported fixture data for the Phase 72 parity regression test suite.
Package seed provides deterministic test data seeding for PeeringDB entity types.
Package seed provides deterministic test data seeding for PeeringDB entity types.

Jump to

Keyboard shortcuts

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