evalenv

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package evalenv is what the evaluator's integration tests need: the Web UI started for real inside the test process (see package stack), with a scripted agent behind it and a real PostgreSQL, and the way the evaluator starts Chrome.

It needs Docker (for PostgreSQL, see pgenv) and, for tests that open a browser, Node and Chrome.

Index

Constants

View Source
const (
	Email    = "eval@example.com"
	Password = "an-evaluator-password-1"
)

The first user of every environment.

Variables

This section is empty.

Functions

func BrowserOptions

func BrowserOptions(t testing.TB) devtools.Options

BrowserOptions is how the evaluator starts Chrome unless it is told otherwise, so that these tests move with its pinned version.

func RequireBrowser

func RequireBrowser(t testing.TB)

RequireBrowser is for the tests that open Chrome: it asks for npx, and for a node that the pinned package runs on. A missing prerequisite is a failure, not a skip: a run that leaves the browser suites out must say so, or the gate reads as green for what was never run. -short leaves them out on purpose.

Types

type Env

type Env struct {
	// URL is where a browser reaches it, such as http://127.0.0.1:41233.
	URL             string
	Email, Password string
	// Agent is the scripted agent behind the Web UI.
	Agent *stack.Agent
	// Model is the model the agent runs, for assertions on what it saw.
	Model *testagent.Model
	// Logs is what the Web UI logged: one line per request, and its warnings and
	// errors. Print the lines that matter when a test fails.
	Logs *Logs
}

Env is a running Web UI.

func Start

func Start(t testing.TB, modelOptions ...testagent.Option) *Env

Start runs the Web UI and its agent until the test ends. modelOptions set the pace and script of the scripted agent.

type Logs

type Logs struct {
	// contains filtered or unexported fields
}

Logs is a log that a server writes to while a test reads it.

func (*Logs) Lines

func (l *Logs) Lines(words ...string) []string

Lines returns the logged lines that contain every one of the words.

func (*Logs) String

func (l *Logs) String() string

String returns everything logged so far.

func (*Logs) Write

func (l *Logs) Write(p []byte) (int, error)

Write implements io.Writer.

Jump to

Keyboard shortcuts

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