vmtests

package
v1.1.0-pre.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package vmtests includes utilities for running tetragon tests inside VMs. It allows the program that manages the VM to coordinate with the tester, i.e., program that runs the tests (inside the VM). The former will provide a configuration file (TesterConf) to the latter, and the latter will produce a set of results (Result[]) to the former (typically, also as a JSON file).

The tester requires access to a tetragon source directory. The way it works for now is by using the compiled go tests in the go-tests directory. It them and produces a Result for each of them. This can be extended in the future. The configuration file can be used to pass specific options for all or individual tests (e.g., timeouts).

Index

Constants

This section is empty.

Variables

View Source
var (
	ConfFile    = "/etc/tetragon-tester.json" // configuration file for the tester
	TestTimeout = 45 * time.Minute            // timeout for each test

)

Functions

func Run

func Run(cnf *Conf) error

Run is the main function that executes the tests based on the configuration. Results are written in a results.json file in the results directory, one line per result. An error is returned only if something unexpected happen and not if the tests failed.

Types

type Conf

type Conf struct {
	NoPowerOff  bool   `json:"no-poweroff"`  // do not power-off the machine when done
	TetragonDir string `json:"tetragon-dir"` // tetragon source dir
	ResultsDir  string `json:"results-dir"`  // directory to place the results
	TestsFile   string `json:"tests-file"`   // file describing which tests to run
	BTFFile     string `json:"btf-file"`     // btf file to use
	FailFast    bool   `json:"fail-fast"`
	KeepAllLogs bool   `json:"keep-all-logs"`
	KernelVer   string `json:"kernel-ver"` // kernel version
}

Conf configures the tester

type GoTest

type GoTest struct {
	PackageProg, Test string
}

GoTest is a PackageProg and a Test name. If Test is "", then running all the package is implied

func ListTests

func ListTests(
	testDir string,
	packagesOnly bool,
	blacklist []GoTest,
) ([]GoTest, error)

func LoadTestsFromFile

func LoadTestsFromFile(fname string) ([]GoTest, error)

func (*GoTest) ToString

func (t *GoTest) ToString() string

type Result

type Result struct {
	Name       string        `json:"name"`
	Skip       bool          `json:"skip"`
	Error      bool          `json:"error"`
	Outfile    string        `json:"outfile,omitempty"`
	Duration   time.Duration `json:"duration"`
	BugtoolOut string        `json:"bugtool-out,omitempty"`
}

Result is the result of a single test

Jump to

Keyboard shortcuts

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