integration

package
v1.7.21 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTestDB

func NewTestDB(t *testing.T) *statedb.StateDB

NewTestDB creates an isolated SQLite database in a temp directory. Migrate is called automatically. The database is closed via t.Cleanup.

func WaitForCondition

func WaitForCondition(t TestingT, timeout, poll time.Duration, desc string, condition func() bool)

WaitForCondition polls condition at the given interval until it returns true or the timeout expires. On timeout, it calls t.Fatalf with a descriptive message including the timeout duration and description.

func WaitForPaneContent

func WaitForPaneContent(t TestingT, inst *session.Instance, contains string, timeout time.Duration)

WaitForPaneContent polls the tmux pane output until it contains the expected string. Uses a 200ms poll interval. Handles nil tmux session gracefully (keeps polling).

func WaitForStatus

func WaitForStatus(t TestingT, inst *session.Instance, status session.Status, timeout time.Duration)

WaitForStatus polls until the instance reaches the expected status. Uses a 200ms poll interval.

Types

type InstanceBuilder

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

InstanceBuilder provides a fluent API for constructing statedb.InstanceRow values with sensible defaults for testing.

func NewInstanceBuilder

func NewInstanceBuilder(id, title string) *InstanceBuilder

NewInstanceBuilder creates a builder with defaults: ProjectPath="/tmp/test", GroupPath="test-group", Tool="shell", Status="idle", CreatedAt=time.Now(), ToolData="{}".

func (*InstanceBuilder) Build

func (b *InstanceBuilder) Build() *statedb.InstanceRow

Build returns the constructed InstanceRow.

func (*InstanceBuilder) BuildSlice

func (b *InstanceBuilder) BuildSlice() []*statedb.InstanceRow

BuildSlice returns the constructed InstanceRow wrapped in a single-element slice. Convenience for db.SaveInstances().

func (*InstanceBuilder) WithCommand

func (b *InstanceBuilder) WithCommand(cmd string) *InstanceBuilder

WithCommand sets the command field.

func (*InstanceBuilder) WithGroup

func (b *InstanceBuilder) WithGroup(path string) *InstanceBuilder

WithGroup sets the group path.

func (*InstanceBuilder) WithParent

func (b *InstanceBuilder) WithParent(id string) *InstanceBuilder

WithParent sets the parent session ID.

func (*InstanceBuilder) WithProject

func (b *InstanceBuilder) WithProject(path string) *InstanceBuilder

WithProject sets the project path.

func (*InstanceBuilder) WithStatus

func (b *InstanceBuilder) WithStatus(s string) *InstanceBuilder

WithStatus sets the status field.

func (*InstanceBuilder) WithTool

func (b *InstanceBuilder) WithTool(tool string) *InstanceBuilder

WithTool sets the tool field.

type TestingT

type TestingT interface {
	Helper()
	Fatalf(format string, args ...any)
}

TestingT is the subset of *testing.T used by polling helpers. This allows testing the timeout path without killing the real test.

Jump to

Keyboard shortcuts

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