plugintest

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 6 Imported by: 1 module, 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 is the in-process fake of a plugin process, for tests on either side of the protocol. Its Launcher serves the kinds a test registers over a real go-plugin gRPC connection inside the test binary.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Launcher

type Launcher struct {
	// contains filtered or unexported fields
}

Launcher is a plugin.Launcher that serves registered kinds in-process. Everything it starts is stopped when the test ends.

func NewLauncher

func NewLauncher(t testing.TB) *Launcher

NewLauncher returns a Launcher with no plugin registered.

func (*Launcher) Add

func (l *Launcher) Add(id string, impls map[plugin.Kind]plugin.Impl)

Add registers the kinds the plugin with id serves; a later Launch of a Spec with that ID serves them.

func (*Launcher) Crash

func (l *Launcher) Crash(id string)

Crash ends the last process launched for id as a crash would: its calls fail and it reports Exited.

func (*Launcher) Launch

func (l *Launcher) Launch(_ context.Context, spec plugin.Spec) (plugin.Process, error)

Launch connects to the kinds registered for spec.ID, ignoring spec.Path and spec.Checksum. A kind spec names and the plugin does not serve is dispensed and answers every call with an error, as a real plugin's does.

func (*Launcher) Launches

func (l *Launcher) Launches(id string) int

Launches counts the Launch calls for id.

Jump to

Keyboard shortcuts

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