Help us shape the future of Go! Take the 2026 Go Developer Survey

lltest

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package lltest provides test doubles for the leyline daemon wire: an in-process fake speaking the line-delimited JSON UDS protocol, and a gated spawner for the SHA-pinned real binary. Tests point mache at either via t.Setenv("LEYLINE_SOCKET", sock) — leyline.DiscoverOrStart honors that env var before any spawn/download logic runs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FakeDaemon

func FakeDaemon(t *testing.T, handler Handler) string

FakeDaemon starts a Unix-domain-socket server that speaks the daemon's line-delimited JSON protocol, answering every request via handler. It returns the socket path; callers wire it up with t.Setenv("LEYLINE_SOCKET", sock). The server tolerates probe connections that close without sending (DiscoverOrStart's liveness check does exactly that). Shutdown is registered via t.Cleanup.

func IngestSourceViaLeyline

func IngestSourceViaLeyline(t *testing.T, engine *ingest.Engine, srcPath string)

IngestSourceViaLeyline is the test-side equivalent of the serve/mount source path after in-process tree-sitter removal (mache-37ae8b, ADR-0012 step 4): it parses srcPath with the pinned leyline binary into an `_ast` db, attaches an ASTWalker to engine, and ingests. Tests that previously did `engine.Ingest(sourceFileOrDir)` — which now errors because the Engine has no in-process parser — call this instead.

srcPath may be a file or a directory (leyline parse wants a directory, so a single file is staged into a temp dir first). The binary is resolved with ResolveBinary(false), so the test SKIPS rather than downloading when the pinned leyline isn't cached — mirroring every other leyline e2e test.

func StartPinnedDaemon

func StartPinnedDaemon(t *testing.T) string

StartPinnedDaemon spawns the SHA-pinned leyline binary from ~/.mache/bin/leyline as a PRIVATE daemon (own arena/control/socket in a short-lived temp dir — no interference with the shared ~/.mache arena) and returns its socket path.

Gated, never downloads: the test SKIPS when the binary is absent or its --version does not match leyline.PinnedBinaryVersion(). It deliberately does NOT fall back to a leyline on PATH — an unpinned binary produces different wire behavior than CI's SHA-verified release (mache-608a3c).

func UsePinnedDaemon

func UsePinnedDaemon(t *testing.T)

UsePinnedDaemon spawns a private pinned daemon (see StartPinnedDaemon) and points LEYLINE_SOCKET at it for the remainder of the test, which is how every gated e2e consumer wires the daemon into mache's discovery path.

Types

type Handler

type Handler func(req map[string]any) any

Handler produces the response object for one decoded request. The returned value is JSON-marshalled and written back as a single line.

Jump to

Keyboard shortcuts

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