runner

package
v1.0.0-alpha.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	CommandFnEval   string = "eval"
	CommandFnRender string = "render"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EvalTestCaseConfig

type EvalTestCaseConfig struct {
	// ExecPath is a path to the executable file that will be run as function
	// Mutually exclusive with Image.
	// The path should be separated by slash '/'
	ExecPath string `json:"execPath,omitempty" yaml:"execPath,omitempty"`

	// Image is the image name for the function
	Image string `json:"image,omitempty" yaml:"image,omitempty"`
	// Args are the arguments that will be passed into function.
	// Args will be passed as 'key=value' format after the '--' in command.
	Args map[string]string `json:"args,omitempty" yaml:"args,omitempty"`
	// Network indicates is network accessible from the function container. Default: false
	Network bool `json:"network,omitempty" yaml:"network,omitempty"`
	// IncludeMetaResources enables including meta resources, like Kptfile,
	// in the function input. Default: false
	IncludeMetaResources bool `json:"includeMetaResources,omitempty" yaml:"includeMetaResources,omitempty"`
	// FnConfig is the path to the function config file.
	// The path should be separated by slash '/'
	FnConfig string `json:"fnConfig,omitempty" yaml:"fnConfig,omitempty"`
	// contains filtered or unexported fields
}

EvalTestCaseConfig contains the config only for imperative function run

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

Runner runs an e2e test

func NewRunner

func NewRunner(t *testing.T, testCase TestCase, c string) (*Runner, error)

NewRunner returns a new runner for pkg

func (*Runner) Run

func (r *Runner) Run() error

Run runs the test.

func (*Runner) Skip

func (r *Runner) Skip() bool

type TestCase

type TestCase struct {
	Path   string
	Config TestCaseConfig
}

TestCase contains the information needed to run a test. Each test case run by this driver is described by a `TestCase`.

type TestCaseConfig

type TestCaseConfig struct {
	// ExitCode is the expected exit code from the kpt commands. Default: 0
	ExitCode int `json:"exitCode,omitempty" yaml:"exitCode,omitempty"`

	// StdErr is the expected standard error output and should be checked
	// when a nonzero exit code is expected. Default: ""
	StdErr string `json:"stdErr,omitempty" yaml:"stdErr,omitempty"`

	// StdOut is the expected standard output from running the command.
	// Default: ""
	StdOut string `json:"stdOut,omitempty" yaml:"stdOut,omitempty"`

	// NonIdempotent indicates if the test case is not idempotent.
	// By default, tests are assumed to be idempotent, so it defaults to false.
	NonIdempotent bool `json:"nonIdempotent,omitempty" yaml:"nonIdempotent,omitempty"`

	// Skip means should this test case be skipped. Default: false
	Skip bool `json:"skip,omitempty" yaml:"skip,omitempty"`

	// Debug means will the debug behavior be enabled. Default: false
	// Debug behavior:
	//  1. Keep the temporary directory used to run the test cases
	//    after test.
	Debug bool `json:"debug,omitempty" yaml:"debug,omitempty"`

	// TestType is the type of the test case. Possible value: ['render', 'eval']
	// Default: 'eval'
	TestType string `json:"testType,omitempty" yaml:"testType,omitempty"`

	// DisableOutputTruncate indicates should error output be truncated
	DisableOutputTruncate bool `json:"disableOutputTruncate,omitempty" yaml:"disableOutputTruncate,omitempty"`

	// EvalConfig is the configs for eval tests
	EvalConfig *EvalTestCaseConfig `json:",inline" yaml:",inline"`
}

TestCaseConfig contains the config information for the test case

func (*TestCaseConfig) RunCount

func (c *TestCaseConfig) RunCount() int

type TestCases

type TestCases []TestCase

TestCases contains a list of TestCase.

func ScanTestCases

func ScanTestCases(path string) (*TestCases, error)

ScanTestCases will recursively scan the directory `path` and return a list of TestConfig found

Jump to

Keyboard shortcuts

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