Documentation
¶
Overview ¶
Package conformance provides a reusable test suite that plugin authors run against their sdk.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.
Types ¶
type Config ¶
type Config struct {
// Module is the module under test. Required.
Module sdk.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 sdk.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.