testutils

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyExampleConfig

func ApplyExampleConfig(t *testing.T, cmd *exec.Cmd)

func Dedent

func Dedent(in string) string

func DedentYaml

func DedentYaml(in string) string

func GetRepoRoot

func GetRepoRoot(t *testing.T) string

func SetEnv

func SetEnv(t *testing.T, env []string)

func SetEnvFromToEnv

func SetEnvFromToEnv(t *testing.T, toEnver ToEnver)

func StandardBackups

func StandardBackups(t *testing.T, args ...string) *exec.Cmd

Types

type BlockingBackend

type BlockingBackend struct {
	Path string
	// contains filtered or unexported fields
}

BlockingBackend is standard-backups backend meant for testing. When invoked, it blocks waiting for a signal from the testing process. All its actions are logged to a file so that they can be examined later on.

func NewBlockingBackend

func NewBlockingBackend(t *testing.T, name string, logFile string) *BlockingBackend

func (*BlockingBackend) Unblock

func (b *BlockingBackend) Unblock()

type DumpBackend

type DumpBackend struct {
	Path string
	// contains filtered or unexported fields
}

func NewDumpBackend

func NewDumpBackend(t *testing.T) *DumpBackend

func (*DumpBackend) ReadBytes

func (b *DumpBackend) ReadBytes(name string) []byte

func (*DumpBackend) ReadJsonArray

func (b *DumpBackend) ReadJsonArray(name string) []any

func (*DumpBackend) ReadJsonMap

func (b *DumpBackend) ReadJsonMap(name string) map[string]any

func (*DumpBackend) ReadString

func (b *DumpBackend) ReadString(name string) string

type TestConfig

type TestConfig struct {
	ConfigPath  string
	DataDir     string
	BackendsDir string
	RecipesDir  string
	// contains filtered or unexported fields
}

func NewTestConfig

func NewTestConfig(t *testing.T) *TestConfig

func (*TestConfig) AddBackend

func (tc *TestConfig) AddBackend(name string, bin string)

func (*TestConfig) AddBogusRecipe

func (tc *TestConfig) AddBogusRecipe(t *testing.T, name string) string

func (*TestConfig) AddRecipe

func (tc *TestConfig) AddRecipe(name string, content string)

func (*TestConfig) Apply

func (tc *TestConfig) Apply(cmd *exec.Cmd)

func (*TestConfig) WriteConfig

func (tc *TestConfig) WriteConfig(content string)

type ToEnver

type ToEnver interface {
	ToEnv() ([]string, error)
}

Jump to

Keyboard shortcuts

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