plugintest

package
v1.9.4 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 11 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option is plugin test option

func CaptureConfigureError

func CaptureConfigureError(errp *error) Option

CaptureLoadError captures the error encountered during configuration. If configuration fails, and this option is not provided, the test will fail.

func CaptureLoadError

func CaptureLoadError(errp *error) Option

CaptureLoadError captures the error encountered during loading. If loading fails, and this option is not provided, the test will fail.

func Configure

func Configure(plainConfig string) Option

Configure provides raw configuration to the plugin for configuration.

func ConfigureJSON

func ConfigureJSON(jsonConfig any) Option

ConfigureJSON marshals the given object and passes the resulting JSON to the plugin for configuration.

func Configuref

func Configuref(format string, args ...any) Option

Configuref provides a formatted string to the plugin for configuration.

func CoreConfig

func CoreConfig(coreConfig catalog.CoreConfig) Option

CoreConfig provides the core configuration passed to the plugin when configured.

func HostServices

func HostServices(hostServices ...pluginsdk.ServiceServer) Option

HostServices sets the host services the host will offer to the plugin.

func Log

func Log(log logrus.FieldLogger) Option

Log sets the logger for the plugin.

func Services

func Services(serviceFacades ...catalog.Facade) Option

Services sets the services also implemented by the plugin.

type Plugin

type Plugin interface {
	catalog.Configurer
	io.Closer
}

func Load

func Load(t *testing.T, builtIn catalog.BuiltIn, pluginFacade catalog.Facade, options ...Option) Plugin

Load loads a built-in plugin for testing with the given options. The plugin facade can be nil. If one of the Configure* options is given, the plugin will also be configured. The plugin will unload when the test is over. The function returns a plugin interface that can be closed to unload the built-in before the test is finished or used to reconfigure the plugin, but can otherwise be ignored.

Jump to

Keyboard shortcuts

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