plugintest

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package plugintest makes what a plugin is given, for the plugin's tests: a job, and a job's channel held in memory.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Job

func Job(t testing.TB, allow ...string) *plugin.Job

Job gives a job whose one layer allows the entries given. It has its own scratch directory, finds programs in /usr/bin and /bin, has a Channel, and ends with the test.

Types

type Channel

type Channel struct {
	Variables map[string]string
	// EmitFails, where it is set, is what each emit gives.
	EmitFails error
	// contains filtered or unexported fields
}

Channel is a job's channel held in memory. It keeps what was emitted and the blobs written to it, and gives the variables it was given. It defines no machine and builds no tree.

func (*Channel) BuildTree

func (c *Channel) BuildTree(plugin.Tree, map[string][]byte) ([]plugin.TreeProblem, *blob.Ref, error)

func (*Channel) Define

func (c *Channel) Define(string, map[string]string) (blob.Ref, error)

func (*Channel) Emit

func (c *Channel) Emit(name string, data any) error

func (*Channel) Emitted

func (c *Channel) Emitted() []Emitted

Emitted gives what was emitted, in order.

func (*Channel) Fetched

func (c *Channel) Fetched() (fetches int, bytes, largest int64)

Fetched gives how many reads of a blob were made, the bytes they gave, and the most one read gave.

func (*Channel) Hold

func (c *Channel) Hold(typ string, contents []byte) *plugin.Blob

Hold keeps contents as a blob of a type, as the store would.

func (*Channel) ReadBlob

func (c *Channel) ReadBlob(ref blob.Ref, from, length int64) ([]byte, error)

func (*Channel) Variable

func (c *Channel) Variable(name string) (string, bool, error)

func (*Channel) WriteBlob

func (c *Channel) WriteBlob(typ string, size int64, contents io.Reader) (blob.Ref, error)

type Emitted

type Emitted struct {
	Name string
	Data any
}

Emitted is one emit: a name and its data.

Jump to

Keyboard shortcuts

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