repotest

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package repotest is the executable contract of the three control repository ports: control.SessionRepository, control.EnvironmentRepository, and control.FleetRepository.

How a host proves its repositories. A host — the self-hosted in-memory store, the self-hosted Postgres store, or a hosted cell's own store — hands Run a Stores value carrying its three ports over ONE backing store plus a way to make a workspace exist there, and Run drives every case of the contract against a fresh, empty store. Passing this suite is what "implements the ports" means; the ports' doc comments say what the behavior is, and these cases are where it is pinned.

The suite is written against two workspaces (Alpha, Beta) and two pools (PoolA, PoolB) because most of what the contract has to say is about scope: a store that treats either pair as the same thing, or that answers a cross-workspace lookup with anything other than "not found", fails here rather than in production. Every expected error is compared with errors.Is against a control sentinel and nothing else — a store may wrap a sentinel with safe context, but the sentinel is the contract.

The package holds no fixture that names a real host, workspace, runner, or person: every identifier is a synthetic opaque one (ws_alpha, pool_a, sess_example, act_a, runner_a) and every hostname is under a reserved test domain.

Index

Constants

View Source
const (
	AgentUser  control.ActorID = "user_example"
	AgentOther control.ActorID = "user_other"
)

The two people every case is written against. They are exported because a store with a foreign key from its credential rows to its user rows (the self-hosted Postgres schema has one) must create these rows before the suite can write against them, and it can only do that if it knows their ids.

View Source
const (
	Alpha control.WorkspaceID = "ws_alpha"
	Beta  control.WorkspaceID = "ws_beta"
	PoolA control.PoolID      = "pool_a"
	PoolB control.PoolID      = "pool_b"
)

The two workspaces and two pools every case is written against. A store that treats either pair as the same thing fails the suite.

Variables

This section is empty.

Functions

func Run

func Run(t *testing.T, open func(t *testing.T) Stores)

Run drives the contract. open is called once per case and must return an empty store each time; Run provisions Alpha and Beta before the case body.

func RunAgentCredentialStore added in v0.0.3

func RunAgentCredentialStore(t *testing.T, open func(t *testing.T) controlapp.AgentCredentialStore)

RunAgentCredentialStore drives the contract. open is called once per case and must return an EMPTY store each time — a store carrying a set from the previous case would pass cases it should fail.

The provider names come from controlapp.AgentProviders() rather than being spelled here, which is the plan's rule everywhere below controlapp: a provider is a string the table defines and everything else merely carries.

Types

type Stores

type Stores struct {
	Sessions     control.SessionRepository
	Environments control.EnvironmentRepository
	Fleet        control.FleetRepository
	Provision    func(ctx context.Context, ws control.WorkspaceID) error
}

Stores is what a host hands the suite: its three repository ports over ONE backing store (a session created through Sessions must be visible to Fleet.SessionsOnRunner), plus the way to make a workspace exist there.

Jump to

Keyboard shortcuts

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