testutil

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 23 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LocationLockIndex

func LocationLockIndex(lines []string, locationID string) int

LocationLockIndex returns the index of the first UPDATE of storage_locations bound to locationID, or -1.

func NewFilesystemAdapter

func NewFilesystemAdapter(t testing.TB) *storage.FilesystemAdapter

func NewSQLiteClient

func NewSQLiteClient(t testing.TB) (context.Context, *ent.Client)

func RequireLocationLockedBeforeCacheEntryWrites

func RequireLocationLockedBeforeCacheEntryWrites(t testing.TB, lines []string, locationID string)

RequireLocationLockedBeforeCacheEntryWrites asserts that locationID's row lock (an UPDATE of storage_locations) precedes the first cache_entries write. Lines have ent's debug format, e.g. "Tx(<id>).Exec: query=UPDATE `storage_locations` SET ... args=[1 <locationID>]".

func ShutdownCacheServiceOnCleanup

func ShutdownCacheServiceOnCleanup(tb testing.TB, service cacheService)

ShutdownCacheServiceOnCleanup stops the service's background writers before the database and temp dirs are torn down.

Types

type JWKS

type JWKS struct {
	Server  *httptest.Server
	Handler http.Handler
	Key     *rsa.PrivateKey
	KID     string
}

JWKS is a local JWKS endpoint backed by a single RSA key.

func NewJWKS

func NewJWKS(t testing.TB) *JWKS

func (*JWKS) Sign

func (j *JWKS) Sign(t testing.TB, kid any, claims jwt.MapClaims) string

Sign issues an RS256 token carrying the given kid and claims.

type StatementLog

type StatementLog struct {
	// contains filtered or unexported fields
}

StatementLog records the statements ent's debug driver reports, in order.

func NewRecordingSQLiteClient

func NewRecordingSQLiteClient(t testing.TB) (context.Context, *ent.Client, *StatementLog)

NewRecordingSQLiteClient opens a migrated SQLite database through ent's debug driver so tests can assert statement order.

func (*StatementLog) Lines

func (l *StatementLog) Lines() []string

func (*StatementLog) Reset

func (l *StatementLog) Reset()

Jump to

Keyboard shortcuts

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