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 ¶
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 ¶
SignJWT builds a JWT with sub claim and 24h expiry for tests. It carries no sid, so it authenticates against a guard with no session store; a guard that has one refuses it, which is what forces a real session. Use SignJWTWithSID when the guard checks sessions.
func SignJWTWithExp ¶
SignJWTWithExp builds a JWT with sub claim and the given expiry offset from now. Use a negative duration to create an already-expired token.
func SignJWTWithSID ¶
SignJWTWithSID builds a JWT carrying both sub and the session id, for tests whose guard checks the session store.
Types ¶
type TestJWTClaims ¶
type TestJWTClaims struct {
jwt.RegisteredClaims
Sub string `json:"sub"`
Sid string `json:"sid,omitempty"`
}
TestJWTClaims is used by SignJWT for test tokens that match the server's sub and sid claims.
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. |