testing

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package testing provides test utilities and helpers for llm-compiler tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Assertions

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

Assertions provides test assertion helpers

func NewAssertions

func NewAssertions(t *testing.T, result *TestResult) *Assertions

NewAssertions creates a new assertions helper

func (*Assertions) Completed

func (a *Assertions) Completed() *Assertions

Completed asserts the workflow completed successfully

func (*Assertions) ContextHasValue

func (a *Assertions) ContextHasValue(workflow, key, expected string) *Assertions

ContextHasValue asserts a context variable has an expected value

func (*Assertions) DurationLessThan

func (a *Assertions) DurationLessThan(d time.Duration) *Assertions

DurationLessThan asserts the execution took less than the specified duration

func (*Assertions) ExitCode

func (a *Assertions) ExitCode(expected int) *Assertions

ExitCode asserts the exit code

func (*Assertions) NoRuntimeErrors

func (a *Assertions) NoRuntimeErrors() *Assertions

NoRuntimeErrors asserts no llama/ggml runtime errors occurred

func (*Assertions) SignalHasValue

func (a *Assertions) SignalHasValue(key, expected string) *Assertions

SignalHasValue asserts a signal has an expected value

func (*Assertions) StdoutContains

func (a *Assertions) StdoutContains(expected string) *Assertions

StdoutContains asserts stdout contains a string

func (*Assertions) StdoutNotContains

func (a *Assertions) StdoutNotContains(unexpected string) *Assertions

StdoutNotContains asserts stdout does not contain a string

type TestFixture

type TestFixture struct {
	Name        string
	YAMLPath    string
	Description string
}

TestFixture represents a test workflow fixture

type TestResult

type TestResult struct {
	ExitCode    int
	Stdout      string
	Stderr      string
	Duration    time.Duration
	Contexts    map[string]map[string]string
	Signals     map[string]map[string]string
	FmtOutput   string
	LlamaOutput string
}

TestResult holds the results of running a compiled workflow

type TestRunner

type TestRunner struct {
	RepoRoot    string
	FixturesDir string
	OutputDir   string
	// contains filtered or unexported fields
}

TestRunner provides utilities for running workflow tests

func NewTestRunner

func NewTestRunner(t *testing.T) (*TestRunner, error)

NewTestRunner creates a new test runner with isolated output directory

func (*TestRunner) BuildWorkflow

func (r *TestRunner) BuildWorkflow(sourcePath string, binaryName string) (string, error)

BuildWorkflow builds a compiled Go program

func (*TestRunner) CompileAndRun

func (r *TestRunner) CompileAndRun(fixture TestFixture, timeout time.Duration, env ...string) (*TestResult, error)

CompileAndRun is a convenience method that compiles and runs a fixture

func (*TestRunner) CompileWorkflow

func (r *TestRunner) CompileWorkflow(fixture TestFixture, outputName string) (string, error)

CompileWorkflow compiles a workflow YAML to an executable binary

func (*TestRunner) GetFixture

func (r *TestRunner) GetFixture(name string) TestFixture

GetFixture returns a test fixture by name

func (*TestRunner) ListFixtures

func (r *TestRunner) ListFixtures() ([]TestFixture, error)

ListFixtures returns all available fixtures

func (*TestRunner) RunWorkflow

func (r *TestRunner) RunWorkflow(binaryPath string, timeout time.Duration, env ...string) (*TestResult, error)

RunWorkflow runs a compiled workflow binary and returns results

Jump to

Keyboard shortcuts

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