Documentation ¶
Overview ¶
Package testutil is a collection of supporting code to run packer integration tests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsBuildkitAvailable ¶
func IsBuildkitAvailable() error
IsBuildkitAvailable returns nil if buildkit is ready to use.
func IsDockerAvailable ¶
func IsDockerAvailable() error
IsDockerAvailable returns nil if docker buildx is ready to use.
Types ¶
type BuildkitRunner ¶
type BuildkitRunner struct { CommandRunner Target string Platform string }
BuildkitRunner runs packer via buildctl/buildkit.
func (BuildkitRunner) Run ¶
func (runner BuildkitRunner) Run(t *testing.T)
Run implements Run interface.
type CommandRunner ¶
CommandRunner is an abstract runner mix-in which processes command result.
type DockerRunner ¶
type DockerRunner struct { CommandRunner Target string Platform string }
DockerRunner runs packer via docker buildx.
func (DockerRunner) Run ¶
func (runner DockerRunner) Run(t *testing.T)
Run implements Run interface.
type EvalRunner ¶
type EvalRunner struct { CommandRunner Target string Template string }
EvalRunner runs packer eval.
type IntegrationTest ¶
type IntegrationTest struct { Name string Path string Manifest TestManifest }
IntegrationTest describes single integration set (common testdata).
func (IntegrationTest) Run ¶
func (test IntegrationTest) Run(t *testing.T)
Run executes integration test.
type LLBRunner ¶
type LLBRunner struct { CommandRunner Target string Platform string }
LLBRunner runs packer via packer llb | buildctl.
type RunManifest ¶
type RunManifest struct { Name string `yaml:"name"` Runner string `yaml:"runner"` Platform string `yaml:"platform"` Target string `yaml:"target"` Expect string `yaml:"expect"` ExpectStdout *string `yaml:"expectStdout"` CreateFile string `yaml:"createFile"` Template string `yaml:"template"` }
RunManifest describes single run of integration test.
type TestCollection ¶
type TestCollection struct {
Tests []IntegrationTest
}
TestCollection is a set of integration tests.
func CollectTests ¶
func CollectTests() (*TestCollection, error)
CollectTests builds TestCollection from directory structure.
type TestManifest ¶
type TestManifest struct {
Runs []RunManifest `yaml:"run"`
}
TestManifest describes single integration test in test.yaml.
func NewTestManifest ¶
func NewTestManifest(path string) (manifest TestManifest, err error)
NewTestManifest loads TestManifest from test.yaml file.
type ValidateRunner ¶
type ValidateRunner struct {
CommandRunner
}
ValidateRunner runs packer validate.
func (ValidateRunner) Run ¶
func (runner ValidateRunner) Run(t *testing.T)
Run implements Run interface.