testutils

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2025 License: BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllLogfilesKinds = map[LogfilesKind]struct{}{
	LogfilesKindAllFromDir: {},
	LogfilesKindJournalctl: {},
}

Functions

func CopyFile added in v1.8.2

func CopyFile(srcPath, destPath string) error

func GetTestCaseDirs added in v1.8.2

func GetTestCaseDirs(testCasesDir string, testDescrFname string) ([]string, error)

GetTestCaseDirs scans the dir recursively and returns relative paths to all the dirs which contain the file "test_case.yaml". For example:

[]string{"mytest1_foo", "some_group/mytest1", "some_group/mytest2"}

func Slug

func Slug(input string) string

Slug takes a human-readable string and returns a filename-friendly slug.

Types

type LogfilesKind added in v1.8.2

type LogfilesKind string
const (
	LogfilesKindAllFromDir LogfilesKind = "all_from_dir"
	LogfilesKindJournalctl LogfilesKind = "journalctl"
)

type MyTime

type MyTime struct {
	time.Time
}

func (*MyTime) UnmarshalYAML

func (mt *MyTime) UnmarshalYAML(unmarshal func(interface{}) error) error

type ProvisionedLogFiles added in v1.8.2

type ProvisionedLogFiles struct {
	LogfileLast, LogfilePrev string

	// extraEnv contains extra env vars in the format "VARIABLE=VALUE"
	ExtraEnv []string
}

func ProvisionLogFiles added in v1.8.2

func ProvisionLogFiles(resolved *ResolvedLogFiles, testOutputDir, repoRoot string) (*ProvisionedLogFiles, error)

type ResolvedLogFiles added in v1.8.2

type ResolvedLogFiles struct {
	// If files is not empty, we need to use these files.
	Files []string

	// If journalctlDataFile is not empty, we need to use that file
	// as the data for mocked journalctl.
	JournalctlDataFile string
}

func ResolveLogfiles added in v1.8.2

func ResolveLogfiles(
	testCaseDir string, logfilesDescr *TestCaseLogfiles,
) (*ResolvedLogFiles, error)

type TestCaseLogfiles added in v1.8.2

type TestCaseLogfiles struct {
	Kind LogfilesKind `yaml:"kind"`

	// Dir is only relevant for LogfilesKindAllFromDir
	Dir string `yaml:"dir"`

	// JournalctlDataFile is only relevant for LogfilesKindJournalctl
	JournalctlDataFile string `yaml:"journalctl_data_file"`
}

Jump to

Keyboard shortcuts

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