conformance

package
v4.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package conformance provides a Plugin API conformance suite that third-party plugin authors can run against their plugin to prove it meets the host contract defined by the plugin package.

Usage:

result := conformance.Verify(myPlugin)
if !result.OK() {
    for _, f := range result.Failures() {
        fmt.Println(f.Name, ":", f.Detail)
    }
}

Or, from a test:

func TestMyPluginConforms(t *testing.T) {
    conformance.VerifyT(t, myPlugin)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VerifyT

func VerifyT(parseT testingTB, parsePlugin plugin.Plugin)

VerifyT is a testing helper that runs Verify(parsePlugin) and calls parseT.Errorf for each failing check. It is intended for use inside *testing.T test functions.

func TestMyPlugin(t *testing.T) {
    conformance.VerifyT(t, myPlugin)
}

Types

type Check

type Check struct {
	// Name is a short, stable identifier for the assertion (e.g. "manifest/id").
	Name string
	// Passed reports whether the assertion succeeded.
	Passed bool
	// Detail carries a human-readable explanation; non-empty on failure, may
	// also carry a success summary.
	Detail string
}

Check holds the outcome of a single conformance assertion.

type Result

type Result struct {
	Checks []Check
}

Result aggregates the outcome of all conformance checks produced by Verify.

func Verify

func Verify(parsePlugin plugin.Plugin) Result

Verify runs parsePlugin through a real plugin.Host and returns the result of all conformance checks. The plugin is not required to be registered on any external host; Verify constructs its own isolated host for each phase.

Checks performed:

  1. Manifest validity — non-empty ID and Version, recognised Tier, well-formed Requires (no blank or unknown capabilities, no duplicates).
  2. Registration — registering onto a fresh Host succeeds without error, and if Setup returns a CleanupFunc, that func is non-nil.
  3. Contributions observable — whatever the plugin contributes (devtools sections, route guards, panels, etc.) is visible on the Host after registration.
  4. Teardown — calling Host.Close returns nil error; contributions are gone afterwards; calling Close a second time does not return an error.
  5. No panic — the full register→observe→teardown cycle does not panic.

func (Result) Failures

func (parseResult Result) Failures() []Check

Failures returns the subset of checks that did not pass.

func (Result) OK

func (parseResult Result) OK() bool

OK returns true when every check in the result passed.

Jump to

Keyboard shortcuts

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