Documentation
¶
Overview ¶
Package stacktest provides an in-memory stack backend for tests. Branch creation and checkout happen in the real temporary repository; the graph lives in memory.
Index ¶
- func RestoreGraph(s stack.Snapshot) (*stack.Graph, error)
- func SnapshotGraph(g *stack.Graph) (stack.Snapshot, error)
- type Backend
- func (b *Backend) AddTop(ctx context.Context, repo git.Repo, name string) error
- func (b *Backend) Graph() *stack.Graph
- func (b *Backend) ImportStack(_ context.Context, _ git.Repo, target string) error
- func (b *Backend) InitStack(ctx context.Context, repo git.Repo, trunk string, branches []string) error
- func (b *Backend) Link(_ context.Context, _ git.Repo, o stack.LinkOptions) (stack.SubmitResult, error)
- func (b *Backend) Load(context.Context, git.Repo) (*stack.Graph, error)
- func (b *Backend) Restore(_ context.Context, _ git.Repo, s stack.Snapshot) error
- func (b *Backend) SetGraph(g *stack.Graph)
- func (b *Backend) Snapshot(context.Context, git.Repo) (stack.Snapshot, error)
- func (b *Backend) Submit(_ context.Context, _ git.Repo, o stack.SubmitOptions) (stack.SubmitResult, error)
- func (b *Backend) Unstack(_ context.Context, _ git.Repo, number int) error
- func (b *Backend) Update(_ context.Context, _ git.Repo, fn func(*stack.Graph) error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RestoreGraph ¶ added in v0.4.0
RestoreGraph is an in-memory backend's Restore: the graph SnapshotGraph copied.
Types ¶
type Backend ¶
type Backend struct {
// Submits records submit options; SubmitFn, when set, runs on submit.
Submits []stack.SubmitOptions
SubmitFn func(o stack.SubmitOptions) error
// Links records link options.
Links []stack.LinkOptions
// Unstacked records every Unstack call; UnstackFn, when set, decides
// its result.
Unstacked []int
UnstackFn func(number int) error
// Imports records every ImportStack target; ImportFn, when set, does
// the import (it may call SetGraph). Without it every target is in no
// stack on the forge.
Imports []string
ImportFn func(target string) error
// contains filtered or unexported fields
}
Backend implements every stack port in memory.
func (*Backend) ImportStack ¶ added in v0.5.0
func (*Backend) Link ¶ added in v0.3.0
func (b *Backend) Link(_ context.Context, _ git.Repo, o stack.LinkOptions) (stack.SubmitResult, error)
func (*Backend) Submit ¶
func (b *Backend) Submit(_ context.Context, _ git.Repo, o stack.SubmitOptions) (stack.SubmitResult, error)