Documentation
¶
Index ¶
- func NewTestDB(t *testing.T) *statedb.StateDB
- func WaitForCondition(t TestingT, timeout, poll time.Duration, desc string, condition func() bool)
- func WaitForPaneContent(t TestingT, inst *session.Instance, contains string, timeout time.Duration)
- func WaitForStatus(t TestingT, inst *session.Instance, status session.Status, ...)
- type InstanceBuilder
- func (b *InstanceBuilder) Build() *statedb.InstanceRow
- func (b *InstanceBuilder) BuildSlice() []*statedb.InstanceRow
- func (b *InstanceBuilder) WithCommand(cmd string) *InstanceBuilder
- func (b *InstanceBuilder) WithGroup(path string) *InstanceBuilder
- func (b *InstanceBuilder) WithParent(id string) *InstanceBuilder
- func (b *InstanceBuilder) WithProject(path string) *InstanceBuilder
- func (b *InstanceBuilder) WithStatus(s string) *InstanceBuilder
- func (b *InstanceBuilder) WithTool(tool string) *InstanceBuilder
- type TestingT
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTestDB ¶
NewTestDB creates an isolated SQLite database in a temp directory. Migrate is called automatically. The database is closed via t.Cleanup.
func WaitForCondition ¶
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 ¶
WaitForPaneContent polls the tmux pane output until it contains the expected string. Uses a 200ms poll interval. Handles nil tmux session gracefully (keeps polling).
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.