test

package
v1.24.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockedSingleFlight

type BlockedSingleFlight[T any] struct {
	// contains filtered or unexported fields
}

BlockedSingleFlight holds an in-flight SingleFlightGroup.Do call until Release.

func StartBlockedSingleFlight

func StartBlockedSingleFlight[T any](
	g *sync.SingleFlightGroup[T],
	key string,
	fn func() (T, error),
) *BlockedSingleFlight[T]

StartBlockedSingleFlight starts a SingleFlightGroup.Do call and waits until Release before invoking fn.

func (*BlockedSingleFlight[T]) Release

func (b *BlockedSingleFlight[T]) Release()

Release unblocks the SingleFlightGroup.Do function.

func (*BlockedSingleFlight[T]) Result

func (b *BlockedSingleFlight[T]) Result() SingleFlightResult[T]

Result returns the completed SingleFlightGroup.Do result.

func (*BlockedSingleFlight[T]) WaitStarted

func (b *BlockedSingleFlight[T]) WaitStarted()

WaitStarted blocks until the SingleFlightGroup.Do function has started.

type SingleFlightResult

type SingleFlightResult[T any] struct {
	Value  T
	Err    error
	Shared bool
}

SingleFlightResult captures the values returned by SingleFlightGroup.Do.

func DoSingleFlight

func DoSingleFlight[T any](g *sync.SingleFlightGroup[T], key string, fn func() (T, error)) SingleFlightResult[T]

DoSingleFlight calls SingleFlightGroup.Do and returns the results as a single value.

type WorkerScheduleProbe

type WorkerScheduleProbe struct {
	// contains filtered or unexported fields
}

WorkerScheduleProbe coordinates worker scheduling tests.

func NewWorkerScheduleProbe

func NewWorkerScheduleProbe(limit int32, total int) *WorkerScheduleProbe

NewWorkerScheduleProbe creates a probe for a concurrency limit and total schedule attempts.

func (*WorkerScheduleProbe) ReleaseAll

func (p *WorkerScheduleProbe) ReleaseAll()

ReleaseAll unblocks all handlers currently held by the probe.

func (*WorkerScheduleProbe) RequireLimitReached

func (p *WorkerScheduleProbe) RequireLimitReached(t *testing.T)

RequireLimitReached waits for the configured concurrency limit and verifies the peak.

func (*WorkerScheduleProbe) RequireNeverExceeded

func (p *WorkerScheduleProbe) RequireNeverExceeded(t *testing.T)

RequireNeverExceeded verifies the worker never exceeded its configured limit.

func (*WorkerScheduleProbe) RequireScheduled

func (p *WorkerScheduleProbe) RequireScheduled(t *testing.T)

RequireScheduled verifies every schedule attempt returned nil.

func (*WorkerScheduleProbe) Schedule

func (p *WorkerScheduleProbe) Schedule(ctx context.Context, worker *sync.Worker)

Schedule starts one scheduling attempt against worker.

Jump to

Keyboard shortcuts

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