fake

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package fake provides a conflict.Analyzer that decorates an existing analyzer: it delegates to the wrapped implementation for the happy path, but injects an error when a caller-supplied predicate matches.

Unlike the change-facing fakes, Analyze operates on batches — it never sees change URIs — so error injection is predicate-driven rather than marker-driven. To exercise the analyzer's error path in e2e, route a queue to an analyzer built with a failing predicate (e.g. FailAlways) via the queue wiring. It is intended for examples and tests only, never production.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FailAlways

func FailAlways(entity.Batch, []entity.Batch) bool

FailAlways is a FailOn that injects an error on every Analyze call.

func New

func New(delegate conflict.Analyzer, failOn FailOn) conflict.Analyzer

New returns a conflict.Analyzer that delegates to the given analyzer but returns an error when failOn reports true for the call's inputs. The delegate is the existing analyzer implementation to wrap (e.g. all or none). A nil failOn never injects an error (pure passthrough).

Types

type FailOn

type FailOn func(batch entity.Batch, inFlight []entity.Batch) bool

FailOn decides whether Analyze should inject an error for the given inputs.

Jump to

Keyboard shortcuts

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