testutil

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitGitRepoWithOrigin added in v0.0.10

func InitGitRepoWithOrigin(t *testing.T, dir string)

InitGitRepoWithOrigin git-inits dir, makes an initial (empty) commit, and adds an origin remote so it satisfies `project add`'s upstream_url capture requirement (see docs/plans/git-gateway-cutover.md PR2: a project with no git origin remote is now rejected at registration time). The origin URL is a fixed placeholder — tests exercising this helper only need `project add` / `project reload` to see *some* origin, never a real fetchable remote.

The initial commit exists so `git rev-parse --abbrev-ref HEAD` (used by orchestrator.ExpandBaseBranch's ${current_branch} expansion) resolves: a freshly `git init`'d repo with zero commits has an unborn HEAD, which rev-parse rejects with exit 128 ("ambiguous argument 'HEAD'"). That was invisible for non-canonical task behaviors before the git gateway cutover closed the gap where they could keep an empty base_branch — see internal/api/task_create.go's CreateTask comment. -c user.name/user.email are passed explicitly rather than relying on ambient git config, which a bare CI runner may not have.

func NewTestDB

func NewTestDB(t *testing.T) *db.DB

Types

type MockSandbox

type MockSandbox struct {
	SetupCalled bool
	Config      sandbox.SandboxConfig
	ShellCalls  []string
	CleanedUp   bool
}

func (*MockSandbox) Cleanup

func (m *MockSandbox) Cleanup() error

func (*MockSandbox) Setup

func (m *MockSandbox) Setup(cfg sandbox.SandboxConfig) error

func (*MockSandbox) Shell

func (m *MockSandbox) Shell(windowName string, cmd string) (string, error)

type TestServer

type TestServer struct {
	Server *server.Server
	Client *client.Client
}

TestServer wraps a running server for testing.

func NewTestServer

func NewTestServer(t *testing.T) *TestServer

NewTestServer starts a server with a temp UNIX socket and in-memory DB.

Jump to

Keyboard shortcuts

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