conformance

package
v0.14.4 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package conformance provides a reusable test suite that plugin authors run against their plugin.Module to verify it satisfies the Bomly plugin contract before shipping: module and descriptor validity, JSON round-trip stability, construction through a HostContext, the Ready/Applicable lifecycle contract, role-specific capabilities such as the package-updates delta protocol, and (optionally) manifest identity and a real managed-transport probe of the built plugin binary.

Typical usage from a plugin repository:

func TestConformance(t *testing.T) {
	conformance.Test(t, conformance.Config{
		Module:       plugin.Module(),
		ManifestPath: "../bomly-plugin.json",
	})
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProbeBinary

func ProbeBinary(t *testing.T, binaryPath string, opts ...ProbeOption)

ProbeBinary starts binaryPath as a real managed plugin over the HashiCorp go-plugin gRPC transport (exactly as the Bomly host does), fetches the role descriptor over the wire, and validates it. The plugin process is killed in test cleanup.

func Test

func Test(t *testing.T, cfg Config)

Test runs the conformance suite against cfg.Module as a set of subtests.

Types

type Config

type Config struct {
	// Module is the module under test. Required.
	Module plugin.Module
	// ManifestPath optionally points at the plugin's bomly-plugin.json. When
	// set, the suite cross-checks manifest identity against the runtime
	// descriptor (id == descriptor name, kind == module kind, runtime and
	// pluginApiVersion equal the SDK constants).
	ManifestPath string
	// SampleConfig is optionally decoded into the component's configuration
	// via the stub HostContext's DecodeConfig. When empty, "{}" is decoded.
	SampleConfig json.RawMessage
}

Config configures one conformance run.

type ProbeOption

type ProbeOption func(*probeConfig)

ProbeOption customizes a ProbeBinary run.

func WithModule

func WithModule(m plugin.Module) ProbeOption

WithModule supplies the in-process module the probed binary is expected to serve. When set, ProbeBinary fetches the descriptor for the module's kind and asserts it equals the in-process descriptor. Without it, ProbeBinary only asserts that the binary serves exactly one valid role descriptor.

Jump to

Keyboard shortcuts

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