testutil

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package testutil is a collection of supporting code to run bldr integration tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDockerAvailable

func IsDockerAvailable(t *testing.T) error

IsDockerAvailable returns nil if docker buildx is ready to use.

Types

type CommandRunner

type CommandRunner struct {
	ExpectStdout *string
	Expect       string
}

CommandRunner is an abstract runner mix-in which processes command result.

type DockerRunner

type DockerRunner struct {
	CommandRunner
	Target   string
	Platform string
}

DockerRunner runs bldr 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 bldr eval.

func (EvalRunner) Run

func (runner EvalRunner) Run(t *testing.T)

Run implements Run interface.

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 Run

type Run interface {
	Run(t *testing.T)
}

Run the integration test.

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.

func (*TestCollection) Each

func (collection *TestCollection) Each(f func(string, func(t *testing.T)))

Each iterates over collection providing runner for each test.

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 bldr validate.

func (ValidateRunner) Run

func (runner ValidateRunner) Run(t *testing.T)

Run implements Run interface.

Jump to

Keyboard shortcuts

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