testutil

package
v0.7.0-RC1 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: Apache-2.0, MIT Imports: 15 Imported by: ? 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

View Source
const TestLotusAPI = "https://api.node.glif.io/rpc/v1"

TestLotusAPI is the Lotus API endpoint to use for tests Using /rpc/v1 (stable) instead of deprecated /rpc/v0

View Source
const TestPrivateKeyHex = "" /* 160-byte string literal not displayed */
View Source
const TestWalletAddr = "f1fib3pv7jua2ockdugtz7viz3cyy6lkhh7rfx3sa"

Variables

View Source
var SupportedTestDialects = []string{"sqlite", "mysql", "postgres"}
View Source
var TestCid = cid.NewCidV1(cid.Raw, util.Hash([]byte("test")))

Functions

func All added in v0.4.0

func All(t *testing.T, testFunc func(ctx context.Context, t *testing.T, db *gorm.DB))

func EnableDeadlockLogging

func EnableDeadlockLogging(t *testing.T, db *gorm.DB)

EnableDeadlockLogging enables comprehensive deadlock logging for MySQL/MariaDB tests. This should be called early in tests that may encounter deadlocks. It will: - Enable innodb_print_all_deadlocks (logs all deadlocks to error log, not just the last one) - Log the current state of deadlock logging

Note: innodb_print_all_deadlocks requires SUPER privilege and persists until server restart.

func EscapePath added in v0.4.0

func EscapePath(p string) string

func GenerateFixedBytes added in v0.4.0

func GenerateFixedBytes(length int) []byte

func GenerateRandomBytes

func GenerateRandomBytes(n int) []byte

func GenerateUniqueName added in v1.0.0

func GenerateUniqueName(prefix string) string

GenerateUniqueName creates a unique name for testing by combining a prefix with a UUID suffix

func GetFileTimestamp

func GetFileTimestamp(t *testing.T, path string) int64

func One added in v0.4.0

func One(t *testing.T, testFunc func(ctx context.Context, t *testing.T, db *gorm.DB))

func OneWithoutReset added in v0.4.0

func OneWithoutReset(t *testing.T, testFunc func(ctx context.Context, t *testing.T, db *gorm.DB))

func SkipIfNotExternalAPI added in v1.0.0

func SkipIfNotExternalAPI(t *testing.T)

SkipIfNotExternalAPI skips the test if SINGULARITY_TEST_EXTERNAL_API is not set Use this for tests that make external API calls (e.g., Lotus/Filecoin APIs) These are skipped by default because external APIs may be unreliable or rate-limited

Types

type CloserFunc added in v0.4.0

type CloserFunc func() error

func (CloserFunc) Close added in v0.4.0

func (f CloserFunc) Close() error

Jump to

Keyboard shortcuts

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