coordinatorfake

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: GPL-3.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package coordinatorfake provides a configurable fake coordinator.Service for tests.

It lives in its own package (rather than internal/testutil) because it imports pkg/coordinator; keeping it separate avoids an import cycle for pkg/coordinator's own in-package tests, which depend on the base testutil fakes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeCoordinator

type FakeCoordinator struct {
	ProcessCalls       int
	ConsolidationCalls int

	StartErr error
	StopErr  error

	// ProcessFn / ProcessExternalScanFn / RunConsolidationFn override the default behavior
	// when set; the call counters are still incremented for Process and RunConsolidation.
	ProcessFn             func(transformation models.Transformation, direction coordinator.Direction)
	ProcessExternalScanFn func(modelID, scanType string)
	RunConsolidationFn    func(ctx context.Context)

	TriggerBoundsRefreshFn func(ctx context.Context, modelID string) error
	TriggerScheduledRunFn  func(ctx context.Context, modelID string) error
	// contains filtered or unexported fields
}

FakeCoordinator is a configurable fake implementing coordinator.Service for tests.

The zero value is a no-op coordinator that counts Process and RunConsolidation calls. StartErr / StopErr are returned from Start / Stop. ProcessCalls and ConsolidationCalls are guarded by an internal mutex so they are safe to read from assertions after concurrent processing.

func (*FakeCoordinator) ConsolidationCallCount

func (f *FakeCoordinator) ConsolidationCallCount() int

ConsolidationCallCount returns the number of RunConsolidation calls in a race-safe way.

func (*FakeCoordinator) Process

func (f *FakeCoordinator) Process(transformation models.Transformation, direction coordinator.Direction)

Process increments ProcessCalls and invokes ProcessFn when set.

func (*FakeCoordinator) ProcessCallCount

func (f *FakeCoordinator) ProcessCallCount() int

ProcessCallCount returns the number of Process calls in a race-safe way.

func (*FakeCoordinator) ProcessExternalScan

func (f *FakeCoordinator) ProcessExternalScan(modelID, scanType string)

ProcessExternalScan invokes ProcessExternalScanFn when set, otherwise is a no-op.

func (*FakeCoordinator) RunConsolidation

func (f *FakeCoordinator) RunConsolidation(ctx context.Context)

RunConsolidation increments ConsolidationCalls and invokes RunConsolidationFn when set.

func (*FakeCoordinator) Start

func (f *FakeCoordinator) Start(_ context.Context) error

Start returns StartErr.

func (*FakeCoordinator) Stop

func (f *FakeCoordinator) Stop() error

Stop returns StopErr.

func (*FakeCoordinator) TriggerBoundsRefresh

func (f *FakeCoordinator) TriggerBoundsRefresh(ctx context.Context, modelID string) error

TriggerBoundsRefresh returns nil by default.

func (*FakeCoordinator) TriggerScheduledRun

func (f *FakeCoordinator) TriggerScheduledRun(ctx context.Context, modelID string) error

TriggerScheduledRun returns nil by default.

Jump to

Keyboard shortcuts

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