testsupport

package
v0.2.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package testsupport holds helpers that exist only for tests.

Separate from internal/util because of what it contains: nearly every production package imports util, which put a JWT minter in every shipped binary. internal/architecture keeps this package out of production code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunWithIsolatedHome

func RunWithIsolatedHome(m *testing.M) int

RunWithIsolatedHome runs a package's tests against a throwaway BUILDMAX_HOME and removes it afterwards.

config.DataDir refuses to fall back to the real ~/.buildmax under `go test`, so a package whose code reaches it needs a home of its own. Setting it for the whole test binary is what `./make test` already does globally; doing it here too means a narrow `go test ./internal/x` behaves the same, and a test added later does not have to know the requirement exists.

func SignJWT

func SignJWT(sub, secret string) string

SignJWT builds a JWT with sub claim and 24h expiry for tests.

func SignJWTWithExp

func SignJWTWithExp(sub, secret string, expiresIn time.Duration) string

SignJWTWithExp builds a JWT with sub claim and the given expiry offset from now. Use a negative duration to create an already-expired token.

Types

type TestJWTClaims

type TestJWTClaims struct {
	jwt.RegisteredClaims
	Sub string `json:"sub"`
}

TestJWTClaims is used by SignJWT for test tokens that match the server's sub claim.

Directories

Path Synopsis
Package mockllm serves scripted model replies over the three wire protocols BuildMax speaks, so an end-to-end suite can drive a real run without a provider, a key, or a paid call.
Package mockllm serves scripted model replies over the three wire protocols BuildMax speaks, so an end-to-end suite can drive a real run without a provider, a key, or a paid call.

Jump to

Keyboard shortcuts

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