Documentation
¶
Overview ¶
Package clienttest stands up a real localapi.Server on an httptest listener — the generated router, the mock runtime, a governor with fake signal sources, the event hub and the log ring — so client, CLI, TUI and `tera mcp` tests talk to the actual API contract rather than a hand-rolled fake that could drift from it.
Index ¶
Constants ¶
const Model = "mock-8b-instruct"
Model is the mock model the daemon serves.
const Token = "flock_testtoken"
Token is the bearer token the fake daemon accepts.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Daemon ¶
type Daemon struct {
*httptest.Server
Token string
Governor *governor.Governor
Idle *governor.FakeIdleSource
Power *governor.FakePowerSource
Events *events.Hub
// Log is the daemon's logger; lines logged through it land in LogRing
// (GET /api/v1/logs, `log` events) the way the real daemon's do.
Log *slog.Logger
LogRing *logging.Ring
Engine *engine.Engine
}
Daemon is the running fake: URL and Token feed client.Options; the sources let a test flip the governor mid-run.
type Options ¶
type Options struct {
// ServePolicy is the governor policy: "always" (default) serves;
// "idle-only" with the fake idle source at 0 refuses inference with
// 503, the way a node does while the operator is at the keyboard.
ServePolicy string
// TokensPerSec throttles the mock runtime (0 = unthrottled).
TokensPerSec float64
// ReasoningTokens makes chat emit chain-of-thought deltas first.
ReasoningTokens int
}
Options tunes the fake daemon.