Documentation
¶
Index ¶
- func AssertBaseConfigPlugin[C plugin.ConfigCloner[C]](tb testing.TB, c BaseConfigPluginContract[C])
- func AssertBlobStoreProvider(tb testing.TB, c BlobStoreProviderContract)
- func AssertCIProvider(tb testing.TB, c CIProviderContract)
- func AssertChangeDetector(tb testing.TB, c ChangeDetectorContract)
- func AssertCommandBinding[T plugin.Plugin](tb testing.TB, c CommandBindingContract[T])
- func AssertInitContributor(tb testing.TB, c InitContributorContract)
- func AssertKVCacheProvider(tb testing.TB, c KVCacheProviderContract)
- func AssertPipelineContributor(tb testing.TB, c PipelineContributorContract)
- func AssertPreflightable(tb testing.TB, c PreflightableContract)
- func AssertRequireEnabled(tb testing.TB, c RequireEnabledContract)
- func AssertRuntimeProvider[T any](tb testing.TB, c RuntimeProviderContract[T])
- func AssertVersionProvider(tb testing.TB, c VersionProviderContract)
- func CaptureLogOutput(t *testing.T, fn func()) string
- func LoadJSONFile[T any](t *testing.T, dir, filename string) T
- func LoadPluginReport(t *testing.T, serviceDir, pluginName string) ci.Report
- func LoadReport(t *testing.T, serviceDir, filename string) ci.Report
- func MustRuntime[T any](t *testing.T, provider plugin.RuntimeProvider, appCtx *plugin.AppContext) T
- func NewAppContext(t *testing.T, workDir string) *plugin.AppContext
- func NewAppContextWithResolver(t *testing.T, workDir string, resolver plugin.Resolver) *plugin.AppContext
- func NewRegistry(t *testing.T, factories ...registry.Factory) *registry.Registry
- func RunBlobStoreContractSuite(t *testing.T, suite BlobStoreContractSuite)
- type BaseConfigPlugin
- type BaseConfigPluginContract
- type BlobStoreContractSuite
- type BlobStoreFactory
- type BlobStoreProviderContract
- type CIProviderContract
- type ChangeDetectorContract
- type CommandBindingContract
- type InitContributorContract
- type KVCacheProviderContract
- type PipelineContributorContract
- type PreflightableContract
- type RequireEnabledContract
- type RuntimeProviderContract
- type StaticCommandLookup
- type StubChangeDetector
- type StubConfig
- type StubConfigPlugin
- type StubPlugin
- type VersionProviderContract
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertBaseConfigPlugin ¶ added in v0.10.5
func AssertBaseConfigPlugin[C plugin.ConfigCloner[C]](tb testing.TB, c BaseConfigPluginContract[C])
AssertBaseConfigPlugin verifies the canonical config behavior external plugin authors rely on: configs are Clone()able, NewConfig returns a fresh default, and Config/SetTypedConfig/DecodeAndSet do not leak mutable state.
func AssertBlobStoreProvider ¶ added in v0.10.5
func AssertBlobStoreProvider(tb testing.TB, c BlobStoreProviderContract)
AssertBlobStoreProvider verifies the public blob store provider lifecycle.
func AssertCIProvider ¶ added in v0.10.5
func AssertCIProvider(tb testing.TB, c CIProviderContract)
AssertCIProvider verifies the focused CI provider contracts without knowing provider-specific YAML or API details.
func AssertChangeDetector ¶ added in v0.10.5
func AssertChangeDetector(tb testing.TB, c ChangeDetectorContract)
AssertChangeDetector verifies the workflow-level change detector boundary.
func AssertCommandBinding ¶ added in v0.10.5
func AssertCommandBinding[T plugin.Plugin](tb testing.TB, c CommandBindingContract[T])
AssertCommandBinding verifies command-scoped lookup, missing context/lookup, wrong type, and typed CommandBindingError reasons for CommandPlugin[T].
func AssertInitContributor ¶ added in v0.10.5
func AssertInitContributor(tb testing.TB, c InitContributorContract)
AssertInitContributor verifies that init groups have stable, usable shape and that BuildInitConfig returns the expected plugin section contract.
func AssertKVCacheProvider ¶ added in v0.10.5
func AssertKVCacheProvider(tb testing.TB, c KVCacheProviderContract)
AssertKVCacheProvider verifies the public KV cache provider lifecycle.
func AssertPipelineContributor ¶ added in v0.10.5
func AssertPipelineContributor(tb testing.TB, c PipelineContributorContract)
AssertPipelineContributor verifies deterministic contribution shape without asserting plugin-specific command/resource details.
func AssertPreflightable ¶ added in v0.10.5
func AssertPreflightable(tb testing.TB, c PreflightableContract)
AssertPreflightable verifies a preflight implementation through the public capability interface without asserting plugin-specific diagnostics.
func AssertRequireEnabled ¶ added in v0.10.5
func AssertRequireEnabled(tb testing.TB, c RequireEnabledContract)
AssertRequireEnabled verifies the stable DisabledPluginError boundary.
func AssertRuntimeProvider ¶ added in v0.10.5
func AssertRuntimeProvider[T any](tb testing.TB, c RuntimeProviderContract[T])
AssertRuntimeProvider verifies lazy RuntimeProvider construction plus RuntimeAs[T] through plugin.BuildRuntime.
func AssertVersionProvider ¶ added in v0.10.5
func AssertVersionProvider(tb testing.TB, c VersionProviderContract)
AssertVersionProvider verifies that version information is stable and does not leak a mutable map across calls.
func CaptureLogOutput ¶
func LoadPluginReport ¶
func MustRuntime ¶
func MustRuntime[T any](t *testing.T, provider plugin.RuntimeProvider, appCtx *plugin.AppContext) T
func NewAppContext ¶
func NewAppContext(t *testing.T, workDir string) *plugin.AppContext
func NewAppContextWithResolver ¶ added in v0.10.0
func NewRegistry ¶ added in v0.10.0
func RunBlobStoreContractSuite ¶ added in v0.9.4
func RunBlobStoreContractSuite(t *testing.T, suite BlobStoreContractSuite)
RunBlobStoreContractSuite executes the shared blob-store backend contract checks.
Types ¶
type BaseConfigPlugin ¶ added in v0.10.5
type BaseConfigPlugin[C plugin.ConfigCloner[C]] interface { plugin.ConfigLoader Config() C SetTypedConfig(C) }
BaseConfigPlugin is the public surface implemented by plugin.BasePlugin[C]. Contract tests use this interface instead of depending on the concrete embedded type, so third-party plugins can wrap BasePlugin in their own plugin struct and still reuse the assertions.
type BaseConfigPluginContract ¶ added in v0.10.5
type BaseConfigPluginContract[C plugin.ConfigCloner[C]] struct { Plugin BaseConfigPlugin[C] Default C Configured C Decoded C Mutate func(C) Equal func(got, want C) bool }
BaseConfigPluginContract describes the fixtures needed to verify the immutable-config contract for a BasePlugin-backed plugin.
type BlobStoreContractSuite ¶ added in v0.9.4
type BlobStoreContractSuite struct {
Factory BlobStoreFactory
Namespace string
AltNamespace string
Key string
AltKey string
Payload []byte
StreamData string
}
BlobStoreContractSuite configures the shared blob-store contract checks.
type BlobStoreFactory ¶ added in v0.9.4
BlobStoreFactory creates a store instance bound to the provided backing id. Backends may interpret the backing id as a root directory, prefix, or another stable locator that allows creating another instance over the same storage.
type BlobStoreProviderContract ¶ added in v0.10.5
type BlobStoreProviderContract struct {
Provider plugin.BlobStoreProvider
AppContext *plugin.AppContext
Context context.Context
Options plugin.BlobStoreOptions
Namespace string
Key string
Value []byte
}
BlobStoreProviderContract describes a minimal blob store provider round trip.
type CIProviderContract ¶ added in v0.10.5
type CIProviderContract struct {
EnvDetector plugin.EnvDetector
InfoProvider plugin.CIInfoProvider
Generator plugin.PipelineGeneratorFactory
CommentFactory plugin.CommentServiceFactory
AppContext *plugin.AppContext
IR *pipeline.IR
ExpectedName string
AssertEnv func(testing.TB, bool)
AssertInfo func(testing.TB, plugin.CIInfoProvider)
AssertReqs func(testing.TB, pipeline.BuildRequirements)
AssertGenerator func(testing.TB, pipeline.Generator)
AssertComment func(testing.TB, ci.CommentService, bool)
}
CIProviderContract describes generic CI provider capability checks. The fields are explicit so test code can verify focused interfaces separately when a provider composes them from different objects.
type ChangeDetectorContract ¶ added in v0.10.5
type ChangeDetectorContract struct {
Detector workflow.ChangeDetector
Request workflow.ChangeDetectionRequest
WantErr bool
AssertResult func(testing.TB, *workflow.ChangeDetectionResult)
}
ChangeDetectorContract describes a generic workflow change detector call.
type CommandBindingContract ¶ added in v0.10.5
type CommandBindingContract[T plugin.Plugin] struct { Name string Plugin T WrongPlugin plugin.Plugin AssertResolved func(testing.TB, T) }
CommandBindingContract describes the fixtures for CommandPlugin[T].
type InitContributorContract ¶ added in v0.10.5
type InitContributorContract struct {
Contributor initwiz.InitContributor
State *initwiz.StateMap
ExpectedPluginKey string
ExpectContribution bool
AssertGroups func(testing.TB, []*initwiz.InitGroupSpec)
AssertContribution func(testing.TB, *initwiz.InitContribution)
DecodeTarget any
}
InitContributorContract describes generic init wizard contribution checks.
type KVCacheProviderContract ¶ added in v0.10.5
type KVCacheProviderContract struct {
Provider plugin.KVCacheProvider
AppContext *plugin.AppContext
Context context.Context
Namespace string
Key string
Value []byte
TTL time.Duration
}
KVCacheProviderContract describes a minimal key/value cache round trip.
type PipelineContributorContract ¶ added in v0.10.5
type PipelineContributorContract struct {
Contributor plugin.PipelineContributor
AppContext *plugin.AppContext
ExpectedJobNames []string
}
PipelineContributorContract describes expected generic contribution shape.
type PreflightableContract ¶ added in v0.10.5
type PreflightableContract struct {
Plugin plugin.Preflightable
AppContext *plugin.AppContext
Context context.Context
WantErr bool
AssertError func(testing.TB, error)
}
PreflightableContract describes the fixtures for a plugin.Preflightable capability check.
type RequireEnabledContract ¶ added in v0.10.5
type RequireEnabledContract struct {
Enabled interface{ IsEnabled() bool }
Disabled interface{ IsEnabled() bool }
Message string
}
RequireEnabledContract describes enabled/disabled fixtures for plugin.RequireEnabled.
type RuntimeProviderContract ¶ added in v0.10.5
type RuntimeProviderContract[T any] struct { Provider plugin.RuntimeProvider AppContext *plugin.AppContext Context context.Context AssertRuntime func(testing.TB, T) }
RuntimeProviderContract describes the fixtures for RuntimeProvider tests.
type StaticCommandLookup ¶ added in v0.10.5
StaticCommandLookup is a minimal command-scoped plugin lookup for CommandPlugin contract tests.
type StubChangeDetector ¶
type StubChangeDetector struct {
StubPlugin
ChangedModules []*discovery.Module
ChangedFiles []string
ChangedLibraries []string
Err error
}
StubChangeDetector implements ChangeDetectionProvider for testing.
func (*StubChangeDetector) DetectChanges ¶ added in v0.10.5
func (d *StubChangeDetector) DetectChanges(_ context.Context, _ workflow.ChangeDetectionRequest) (*workflow.ChangeDetectionResult, error)
type StubConfig ¶
type StubConfig struct {
Enabled bool
}
StubConfig is a minimal config struct for testing.
func (*StubConfig) Clone ¶ added in v0.10.5
func (c *StubConfig) Clone() *StubConfig
Clone returns a defensive copy of the stub config.
type StubConfigPlugin ¶
type StubConfigPlugin struct {
plugin.BasePlugin[*StubConfig]
}
StubConfigPlugin embeds BasePlugin for testing config-aware scenarios.
type StubPlugin ¶
StubPlugin is a minimal Plugin implementation for testing.
func (*StubPlugin) Description ¶
func (p *StubPlugin) Description() string
func (*StubPlugin) Name ¶
func (p *StubPlugin) Name() string
type VersionProviderContract ¶ added in v0.10.5
type VersionProviderContract struct {
Provider plugin.VersionProvider
ExpectedKeys []string
}
VersionProviderContract describes expected generic version information.