spacefixture

package
v0.19.2 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package spacefixture builds throwaway git space fixtures for tests: a bare "origin" repo (the space's remote, simulating a git host with zero network) plus one working clone per simulated system, seeded with the §4.2 tree. internal/space and internal/host tests use this instead of hand-rolling git plumbing per test file (rails pre-flight #6). P10 extends this builder for full e2e (three-system) scenarios; this phase ships the minimal version its own tests need.

Every fixture is t.TempDir-based and never touches the network — all git operations run against local paths.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fixture

type Fixture struct {
	// Dir is the fixture's root temp directory.
	Dir string
	// OriginDir is the bare repo's path — usable directly as a git remote
	// URL (git accepts local filesystem paths).
	OriginDir string
	// Clones maps system-id -> that system's working clone directory.
	Clones map[string]string
	// contains filtered or unexported fields
}

Fixture is one throwaway space: a bare origin repo plus a working clone per seeded system.

func New

func New(t testing.TB, systems ...string) *Fixture

New creates a bare origin repo on branch "main", seeds it with a minimal space.yaml (participants = the given systems) and the §4.2 tree for each system (provides/requires/consumes.yaml/exchanges/events/docs, plus the space-level decisions/ and vendored/ directories), pushes that seed to origin, then clones origin once per system. t.Helper(); cleanup is automatic via t.TempDir().

func (*Fixture) Clone

func (f *Fixture) Clone(system string) string

Clone returns the working clone directory for system, failing the test if system was not part of the fixture.

func (*Fixture) HeadSHA

func (f *Fixture) HeadSHA(dir, ref string) string

HeadSHA returns the current HEAD commit SHA of the origin's main branch, as seen from a fresh fetch in dir (any clone of the fixture).

func (*Fixture) RemoteURL

func (f *Fixture) RemoteURL() string

RemoteURL returns the fixture origin's push/clone URL (a local filesystem path — no network involved).

Jump to

Keyboard shortcuts

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