Documentation ¶
Overview ¶
Package option customizes how tests are run.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Modifier ¶
type Modifier interface {
// contains filtered or unexported methods
}
Modifier modifies an Option.
It is not intended to be implemented by code outside this package. It is created to provide the flexibility to pass more things to option.New in the future without the need to update its signature.
func Env ¶
Env specifies the environment variables to be used during testing. It has the same format as Cmd.Env in os/exec.
func WithNerdctlVersion ¶ added in v0.9.1
WithNerdctlVersion denotes the underlying nerdctl version.
This is useful for tests whose expectations change based on the underlying nerdctl version.
func WithNoEnvironmentVariablePassthrough ¶ added in v0.9.0
func WithNoEnvironmentVariablePassthrough() Modifier
WithNoEnvironmentVariablePassthrough denotes the option does not support environment variable passthrough.
This is useful for disabling tests that require this feature.
type Option ¶
type Option struct {
// contains filtered or unexported fields
}
Option customizes how tests are run.
If a testing function needs special customizations other than the ones specified in Option, we can use composition to extend it. For example, to test login functionality, we may create a struct named LoginOption that embeds Option and contains additional fields like Username and Password.
func New ¶
New does some sanity checks on the arguments before initializing an Option.
subject specifies the subject to be tested. It is intentionally not designed as an (optional) Modifier because it must contain at least one element. Essentially it is used as a prefix when invoking all the binaries during testing.
For example, if subject is ["foo", "bar"], then to test pulling a image, the command name would be "foo", and the command args would be something like ["bar", "pull", "alpine"].
func (*Option) DeleteEnv ¶ added in v0.7.23
DeleteEnv deletes the environment variable for the key name of the input.
func (*Option) IsNerdctlV1 ¶ added in v0.9.1
IsNerdctlV1 is used by tests to check if the option supports [feature.nerdctlVersion] == nerdctl1xx.
func (*Option) IsNerdctlV2 ¶ added in v0.9.1
IsNerdctlV2 is used by tests to check if the option supports [feature.nerdctlVersion] == nerdctl2xx.
func (*Option) SupportsEnvVarPassthrough ¶ added in v0.9.0
SupportsEnvVarPassthrough is used by tests to check if the option supports [feature.environmentVariablePassthrough].