Documentation
¶
Overview ¶
Package wiring checks a wiring directory (BACKPLANE_WIRING_DIR: bindings and rules as YAML) against the declarations of the services it wires, as backplane does when it keeps the directory in force. A test of an installation runs it, so a binding backplane would reject fails CI instead of the stand:
violations, err := wiring.Check("deployments/wiring", []*backplanev1.Manifest{
coreHarness.Manifest(), relayHarness.Manifest(),
})
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotManifest = errors.New("wiring: not a manifest")
ErrNotManifest: a file LoadManifests reads is JSON but no manifest.
Functions ¶
func LoadManifests ¶ added in v0.6.116
func LoadManifests(paths ...string) ([]*backplanev1.Manifest, error)
LoadManifests reads manifests "<binary> manifest" printed (backplane.ManifestCommand): a service's binary or image run with an installation's configuration declares what it does there, the manifest to check that installation's wiring against.
Types ¶
type Option ¶
type Option func(*settings)
Option configures Check.
func DirectRuntime ¶
func DirectRuntime() Option
DirectRuntime checks the definitions that name no runtime as the direct runtime's: an installation whose BACKPLANE_WIRING_RUNTIME resolves to direct. Without it they are checked as Temporal's.
type Violation ¶
type Violation struct {
// File is the YAML file, relative to the directory.
File string
// Kind is "binding" or "rule"; Name is the binding's hook or the rule's name.
Kind, Name string
// Path is the JSON Pointer of the place in the definition
// ("/steps/send/input/to"); empty for the whole definition.
Path string
// Code is the stable code of the violation (backplane's console shows the same).
Code string
Message string
}
Violation is what backplane refuses in one binding or rule.
func Check ¶
Check validates every binding and rule of dir against manifests, the declarations of every service the wiring names (a backplanetest Harness's Manifest). A service missing from manifests is a violation, as it is a binding waiting for its service on a stand. The error is a directory that does not read: a YAML or unknown-field error, a duplicate.