testutil

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: MIT Imports: 10 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. 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'"). -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

func SeedWorkspace added in v0.0.13

func SeedWorkspace(t *testing.T, ts *TestServer, slug string)

SeedWorkspace upserts an empty workspaces table row for slug directly via the daemon's DB, bypassing both the CLI and the HTTP API (which exposes no creation endpoint). Tests that assign a project to a workspace slug other than orchestrator.DefaultWorkspaceSlug must call this first: ProjectAppService.SetProjectWorkspace rejects assignment to a slug with no corresponding row.

Types

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.

Directories

Path Synopsis
Package homeenv isolates a test binary from the real developer machine's persistent boid state — $HOME, the XDG base directories, and the docker engine — and lets a test assert that the isolation is actually in place.
Package homeenv isolates a test binary from the real developer machine's persistent boid state — $HOME, the XDG base directories, and the docker engine — and lets a test assert that the isolation is actually in place.

Jump to

Keyboard shortcuts

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