pbflagstest

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package pbflagstest provides test helpers for pbflags consumers. It implements the FlagEvaluatorServiceHandler interface backed by an in-memory override map, removing the need for consumers to hand-roll Connect-RPC stubs or construct raw JSON.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(v bool) *pbflagsv1.FlagValue

Bool wraps a bool in a *pbflagsv1.FlagValue.

func BoolList

func BoolList(v ...bool) *pbflagsv1.FlagValue

BoolList wraps a []bool in a *pbflagsv1.FlagValue.

func Double

func Double(v float64) *pbflagsv1.FlagValue

Double wraps a float64 in a *pbflagsv1.FlagValue.

func DoubleList

func DoubleList(v ...float64) *pbflagsv1.FlagValue

DoubleList wraps a []float64 in a *pbflagsv1.FlagValue.

func Int64

func Int64(v int64) *pbflagsv1.FlagValue

Int64 wraps an int64 in a *pbflagsv1.FlagValue.

func Int64List

func Int64List(v ...int64) *pbflagsv1.FlagValue

Int64List wraps a []int64 in a *pbflagsv1.FlagValue.

func String

func String(v string) *pbflagsv1.FlagValue

String wraps a string in a *pbflagsv1.FlagValue.

func StringList

func StringList(v ...string) *pbflagsv1.FlagValue

StringList wraps a []string in a *pbflagsv1.FlagValue.

Types

type InMemoryEvaluator

type InMemoryEvaluator struct {
	pbflagsv1connect.UnimplementedFlagEvaluatorServiceHandler
	// contains filtered or unexported fields
}

InMemoryEvaluator implements pbflagsv1connect.FlagEvaluatorServiceHandler backed by an in-memory override map. Flags without overrides return an empty response, causing generated clients to fall back to compiled defaults.

It is safe for concurrent use.

func NewInMemoryEvaluator

func NewInMemoryEvaluator() *InMemoryEvaluator

NewInMemoryEvaluator returns a new InMemoryEvaluator with no overrides and Health returning EVALUATOR_STATUS_SERVING.

func (*InMemoryEvaluator) BulkEvaluate

BulkEvaluate implements FlagEvaluatorServiceHandler.

func (*InMemoryEvaluator) Evaluate

Evaluate implements FlagEvaluatorServiceHandler.

func (*InMemoryEvaluator) Health

Health implements FlagEvaluatorServiceHandler.

func (*InMemoryEvaluator) Reset

func (e *InMemoryEvaluator) Reset()

Reset clears all overrides and restores status to SERVING.

func (*InMemoryEvaluator) Set

func (e *InMemoryEvaluator) Set(flagID string, value *pbflagsv1.FlagValue)

Set registers a global override for a flag.

func (*InMemoryEvaluator) SetForEntity

func (e *InMemoryEvaluator) SetForEntity(flagID, entityID string, value *pbflagsv1.FlagValue)

SetForEntity registers an entity-scoped override.

func (*InMemoryEvaluator) SetStatus

func (e *InMemoryEvaluator) SetStatus(status pbflagsv1.EvaluatorStatus)

SetStatus overrides the status returned by the Health RPC.

Jump to

Keyboard shortcuts

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