conformance

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package conformance provides a shared contract suite that every Hermod source and sink must satisfy.

Why this exists: the connector layer is the part of Hermod a user actually touches, and it was also the least tested — most connector packages had no tests at all. Per-connector test files would not have fixed that, because the interesting properties are the same for all of them and nobody writes the same six tests forty times.

So the properties live here once, and a connector opts in with a single line in the registry (see connectors_test.go).

SCOPE: these tests run with no live infrastructure. They cover the contract a connector must honour regardless of whether a server is reachable — lifecycle, nil-safety, context deadlines, and behaviour after Close. They deliberately do NOT cover data-path correctness, which needs real infrastructure and lives in the integration tests behind the HERMOD_INTEGRATION build tag.

That boundary is the point: a connector passing this suite is not "verified", it is merely "not obviously broken before it ever reaches the network".

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunSinkSuite

func RunSinkSuite(t *testing.T, name string, newSink func() hermod.Sink, opts ...Options)

RunSinkSuite runs the sink contract against newSink, which must return a fresh sink that has NOT connected to anything. Each property gets its own instance, so one property's Close cannot affect the next.

func RunSourceSuite

func RunSourceSuite(t *testing.T, name string, newSource func() hermod.Source, opts ...Options)

RunSourceSuite runs the source contract against newSource, which must return a fresh source that has NOT connected to anything.

Types

type Options

type Options struct {
	// KnownGaps maps an operation name ("Read", "Ping", "Write") to the reason
	// that operation currently ignores its context deadline.
	//
	// This is a ratchet, modelled on this repository's golangci-lint config: a
	// gate that can never be green is a gate everyone learns to ignore. A listed
	// operation that still fails is reported and skipped rather than failing the
	// build — but an UNLISTED operation that fails is a hard failure, and a
	// LISTED operation that now passes is ALSO a hard failure, telling you to
	// delete the entry.
	//
	// So the list can only shrink. New context leaks cannot get in, and fixed
	// ones cannot sit on the list pretending to still be broken.
	KnownGaps map[string]string
}

Options configures a suite run.

Jump to

Keyboard shortcuts

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