repotest

package
v0.0.0-...-fba66bf Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

repotest implements a fake implementation of api.VersionControlSystem.

Index

Constants

View Source
const DefaultWorkUnitName = "root"

Variables

This section is empty.

Functions

func NewVCS

func NewVCS(dir string, repos ...RepoConfig) api.VersionControlSystem

NewVCS creates a new, fake VersionControlSystem that requires all repositories to be in the given directory.

func RepoTests

func RepoTests(t *testing.T, ctor func(context.Context, *testing.T, string) (api.Repository, error), opts Options)

Types

type ListWorkUnitTestCase

type ListWorkUnitTestCase struct {
	Prefix string
	Want   []string
}

type Options

type Options struct {
	// It's okay for noop renames to succeed. The CLI command will likely fail
	// because the tmux session already exists.
	NoopRenameIsOK bool
	// i.e. when asked to create a work unit and the name is already used, the
	// VCS will implicitly drop the name on the old work unit and use the new
	// name implicitly.
	// Similar to noop rename, this is okay because the CLI command will likely
	// fail because the tmux session already exists.
	ImplicitlyRenamesWorkUnits bool

	ExtraListWorkUnitNames    []string
	ExtraListWorkUnitPrefixes []ListWorkUnitTestCase

	Parallel bool

	// The deadline to use for test cases.
	// Defaults to 5s.
	Deadline time.Duration
}

type RepoConfig

type RepoConfig struct {
	// Name is the name of the repo.
	Name string
	// WorkUnits is a map of work units keyed by parent work unit.
	// You must have a DefaultWorkUnitName entry so we know where to start making
	// work units from.
	WorkUnits map[string][]string
}

Jump to

Keyboard shortcuts

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