Help us shape the future of Go! Take the 2026 Go Developer Survey

contracttest

package
v0.7.2 Latest Latest
Warning

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

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

Documentation

Overview

Package contracttest supplies reusable candidate extension contract suites.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdminBody

func AdminBody(t *testing.T, f AdminBodyFixture)

func Attribution

func Attribution(t *testing.T, p attribution.Policy, v attribution.Value)

Attribution checks every field, explicit absence and defensive context copies. The caller supplies its assembly policy and one valid populated fixture.

func CheckSinkCancellation

func CheckSinkCancellation(ctx context.Context, s event.Sink) error

CheckSinkCancellation invokes each lifecycle operation with an already canceled context. A stalled callback returns sink_nonconforming at the caller deadline. Test goroutines are probes, never the production delivery model.

func Configuration

func Configuration(t *testing.T, registrations []extension.Registration, input []extension.Envelope)

Configuration expects a complete valid runtime configuration and any required environment references supplied by the caller. It checks local validation, persistence failure isolation, concurrent reads and repeated lifecycle close.

func EventSink

func EventSink(t *testing.T, newSink func(context.Context) (event.Sink, error))

EventSink proves cancellation plus FIFO/barrier and exactly-once concurrent close using independently owned sink implementations. Factories must return a fresh sink for each fixture.

func Registry

func Registry(t *testing.T, registrations []extension.Registration)

Registry checks deterministic, pointer-free projection and ownership isolation.

func SecretReferences

func SecretReferences(t *testing.T, registrations []extension.Registration, input []extension.Envelope, variable, secret string)

SecretReferences checks syntax-only validation with an absent/present env variable and reference-preserving manager/store round trips. Input must use a declared env reference to variable; factories own resolution assertions.

Types

type AdminBodyFixture

type AdminBodyFixture struct {
	URL            string
	Method         string
	Body           []byte
	SuccessStatus  int
	Send           func(*http.Request) (*http.Response, error)
	CheckUnchanged func(*testing.T)
}

AdminBody checks the shared HTTP body/CORS contract through a real mount. Send adds deployment credentials and performs the request. URL must identify a write accepting Body with SuccessStatus. CheckUnchanged verifies the domain state after each rejected request; no mutation may occur on trailing oversize.

Jump to

Keyboard shortcuts

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