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 (*Runner) IsFnResultExpected ¶
IsFnResultExpected determines if function results are expected for this testcase.
func (*Runner) IsOutOfPlace ¶
IsOutOfPlace determines if command output is saved in a different directory (out-of-place).
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"` // StdErrRegEx is the regular expression to match standard error output and should be checked // when a nonzero exit code is expected. Default: "" StdErrRegEx string `json:"stdErrRegEx,omitempty" yaml:"stdErrRegEx,omitempty"` // StdOut is the expected standard output from running the command. // Default: "" StdOut string `json:"stdOut,omitempty" yaml:"stdOut,omitempty"` // Sequential means should this test case be run sequentially. Default: false Sequential bool `json:"sequential,omitempty" yaml:"sequential,omitempty"` // ImagePullPolicy controls the image pulling behavior. It can be set to one // of `Always`, `IfNotPresent` and `Never`. If unspecified, the default will // be the same as the CLI flag. ImagePullPolicy string `json:"imagePullPolicy,omitempty" yaml:"imagePullPolicy,omitempty"` // Runtimes controls if a test case should be skipped. If the current runtime doesn't match // any of the desired runtimes here, the test case will be skipped. Valid values are `docker` // and `podman`. If unspecified, it will match any runtime. Runtimes []string `json:"runtimes,omitempty" yaml:"runtimes,omitempty"` // AllowExec determines if `fn render` needs to be invoked with `--allow-exec` flag AllowExec bool `json:"allowExec,omitempty" yaml:"allowExec,omitempty"` // AllowWasm determines if `fn render` needs to be invoked with `--allow-alpha-wasm` flag AllowWasm bool `json:"allowWasm,omitempty" yaml:"allowWasm,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: 'render' 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"` // Environment variables to be set for the test case. Env map[string]string `json:"env,omitempty" yaml:"env,omitempty"` }
TestCaseConfig contains the config information for the test case
func (*TestCaseConfig) RunCount ¶
func (c *TestCaseConfig) RunCount() int
Click to show internal directories.
Click to hide internal directories.