clienttest

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 13 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

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

View Source
const Model = "mock-8b-instruct"

Model is the mock model the daemon serves.

View Source
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.

func New

func New(t testing.TB, o Options) *Daemon

New starts a daemon and stops it when the test ends.

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.

Jump to

Keyboard shortcuts

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