flagtest

package
v0.0.0-...-12a2a41 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package flagtest provides an in-memory flag.Store and a contract test suite that every flag.Store implementation must pass.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunContract

func RunContract(t *testing.T, newStore func(t *testing.T) flag.Store)

RunContract checks behavior every flag.Store must share. newStore must return an empty store with environments dev, staging, and prod, with only prod protected.

Types

type Memory

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

func NewMemory

func NewMemory() *Memory

NewMemory returns an empty store with the default environments.

func (*Memory) ApproveChangeRequest

func (m *Memory) ApproveChangeRequest(_ context.Context, actor string, id int64, comment string) (flag.ChangeRequest, error)

func (*Memory) ArchiveFlag

func (m *Memory) ArchiveFlag(_ context.Context, actor, key string) error

func (*Memory) CancelChangeRequest

func (m *Memory) CancelChangeRequest(_ context.Context, actor string, id int64) (flag.ChangeRequest, error)

func (*Memory) CreateChangeRequest

func (m *Memory) CreateChangeRequest(_ context.Context, actor, key, env string, cfg flag.EnvConfig, reason string, expiresAt time.Time) (flag.ChangeRequest, error)

func (*Memory) CreateEnvironment

func (m *Memory) CreateEnvironment(_ context.Context, actor string, env flag.Environment) (flag.Environment, error)

func (*Memory) CreateFlag

func (m *Memory) CreateFlag(_ context.Context, actor, key, name, description, steward string) (flag.Flag, error)

func (*Memory) EvalConfig

func (m *Memory) EvalConfig(_ context.Context, key, env string) (eval.Flag, error)

func (*Memory) ExpireChangeRequests

func (m *Memory) ExpireChangeRequests(context.Context) (int, error)

func (*Memory) GetChangeRequest

func (m *Memory) GetChangeRequest(_ context.Context, id int64) (flag.ChangeRequest, error)

func (*Memory) GetEnvironment

func (m *Memory) GetEnvironment(_ context.Context, key string) (flag.Environment, error)

func (*Memory) GetFlag

func (m *Memory) GetFlag(_ context.Context, key string) (flag.Flag, error)

func (*Memory) ListAuditEvents

func (m *Memory) ListAuditEvents(_ context.Context, flagKey string) ([]audit.Event, error)

func (*Memory) ListChangeRequests

func (m *Memory) ListChangeRequests(_ context.Context, filter flag.RequestFilter) ([]flag.ChangeRequest, error)

func (*Memory) ListEnvironmentAuditEvents

func (m *Memory) ListEnvironmentAuditEvents(_ context.Context, env string) ([]audit.Event, error)

func (*Memory) ListEnvironments

func (m *Memory) ListEnvironments(context.Context) ([]flag.Environment, error)

func (*Memory) ListFlags

func (m *Memory) ListFlags(context.Context) ([]flag.Flag, error)

func (*Memory) MarkStaleNotified

func (m *Memory) MarkStaleNotified(_ context.Context, keys []string, at time.Time) error

func (*Memory) RecordEvaluations

func (m *Memory) RecordEvaluations(_ context.Context, seen []flag.Evaluation) error

func (*Memory) RejectChangeRequest

func (m *Memory) RejectChangeRequest(_ context.Context, actor string, id int64, comment string) (flag.ChangeRequest, error)

func (*Memory) SetPermanent

func (m *Memory) SetPermanent(_ context.Context, actor, key, reason string) (flag.Flag, error)

func (*Memory) SetSteward

func (m *Memory) SetSteward(_ context.Context, actor, key, steward string) (flag.Flag, error)

func (*Memory) UpdateEnvironment

func (m *Memory) UpdateEnvironment(_ context.Context, actor, key, env string, cfg flag.EnvConfig, reason string) (flag.Flag, error)

func (*Memory) UpdateEnvironmentSettings

func (m *Memory) UpdateEnvironmentSettings(_ context.Context, actor string, env flag.Environment) (flag.Environment, error)

func (*Memory) UpdateFlag

func (m *Memory) UpdateFlag(_ context.Context, actor, key, name, description string) (flag.Flag, error)

Jump to

Keyboard shortcuts

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