register

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Tests = map[string]*Test{}

Registered tests that run as part of `kola run` live here. Mapping of names to tests.

View Source
var UpgradeTests = map[string]*Test{}

Registered tests that run as part of `kola run-upgrade` live here. Mapping of names to tests.

Functions

func Register

func Register(m map[string]*Test, t *Test)

Register is usually called via init() functions and is how kola test harnesses knows which tests it can choose from. Panics if existing name is registered

func RegisterTest

func RegisterTest(t *Test)

func RegisterUpgradeTest

func RegisterUpgradeTest(t *Test)

Types

type DepDirMap

type DepDirMap map[string]string

func (*DepDirMap) Add

func (mp *DepDirMap) Add(name string, depDir string, destination string)

func (*DepDirMap) DirFromKey

func (mp *DepDirMap) DirFromKey(key string) string

func (*DepDirMap) Get

func (mp *DepDirMap) Get(name string, depDir string) string

type Flag

type Flag int
const (
	NoSSHKeyInUserData    Flag = iota // don't inject SSH key into Ignition/cloud-config
	NoSSHKeyInMetadata                // don't add SSH key to platform metadata
	NoInstanceCreds                   // don't grant credentials (AWS instance profile, GCP service account) to the instance
	NoEmergencyShellCheck             // don't check console output for emergency shell invocation
	AllowConfigWarnings               // ignore Ignition and Butane warnings instead of failing
)

type NativeFuncWrap

type NativeFuncWrap struct {
	NativeFunc func() error
	Exclusions []string
}

NativeFuncWrap is a wrapper for the NativeFunc which includes an optional string of arches and/or distributions to exclude for each native test.

func CreateNativeFuncWrap

func CreateNativeFuncWrap(f func() error, exclusions ...string) NativeFuncWrap

CreateNativeFuncWrap is a simple constructor for returning NativeFuncWrap structure. exclusions can be architectures and/or distributions.

type Test

type Test struct {
	Name                 string // should be unique
	Subtests             []string
	Run                  func(cluster.TestCluster)
	NativeFuncs          map[string]NativeFuncWrap
	UserData             *conf.UserData
	ClusterSize          int
	Platforms            []string      // allowlist of platforms to run test against -- defaults to all
	Firmwares            []string      // allowlist of firmwares to run test against -- defaults to all
	ExcludePlatforms     []string      // denylist of platforms to ignore -- defaults to none
	ExcludeFirmwares     []string      // denylist of firmwares to ignore -- defaults to none
	Distros              []string      // allowlist of distributions to run test against -- defaults to all
	ExcludeDistros       []string      // denylist of distributions to ignore -- defaults to none
	Architectures        []string      // allowlist of machine architectures supported -- defaults to all
	ExcludeArchitectures []string      // denylist of architectures to ignore -- defaults to none
	Flags                []Flag        // special-case options for this test
	Tags                 []string      // list of tags that can be matched against -- defaults to none
	Timeout              time.Duration // the duration for which a test will be allowed to run
	RequiredTag          string        // if specified, test is filtered by default unless tag is provided -- defaults to none
	Description          string        // test description

	// Whether the primary disk is multipathed.
	MultiPathDisk bool

	// Sizes of additional empty disks to attach to the node, followed by
	// comma-separated list of optional options (e.g. ["1G",
	// "5G:mpath,foo,bar"]) -- defaults to none.
	AdditionalDisks []string

	// InjectContainer will cause the ostree base image to be injected into the target
	InjectContainer bool

	// Minimum amount of memory in MB required for test.
	MinMemory int

	// Minimum amount of primary disk in GB required for test.
	MinDiskSize int

	// Additional amount of NICs required for test.
	AdditionalNics int

	// Additional kernel arguments to append to the defaults.
	AppendKernelArgs string

	// Additional first boot kernel arguments to append to the defaults.
	AppendFirstbootKernelArgs string

	// ExternalTest is a path to a binary that will be uploaded
	ExternalTest string
	// DependencyDir is a path to directory that will be uploaded, normally used by external tests
	DependencyDir DepDirMap

	// FailFast skips any sub-test that occurs after a sub-test has
	// failed.
	FailFast bool

	// If true, this test will be run along with other NonExclusive tests in one VM
	// Otherwise, it is run in its own VM
	NonExclusive bool

	// Conflicts is non-empty iff nonexclusive is true
	// Contains the tests that conflict with this particular test
	Conflicts []string
}

Test provides the main test abstraction for kola. The run function is the actual testing function while the other fields provide ways to statically declare state of the platform.TestCluster before the test function is run.

func (*Test) HasFlag

func (t *Test) HasFlag(flag Flag) bool

Jump to

Keyboard shortcuts

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