testing

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestFramework added in v1.15.0

type TestFramework = interface{ Name() string }

UsingFlags sets flags for the scope of a test

type TestProvider

type TestProvider struct {
	openfeature.NoopProvider
	// contains filtered or unexported fields
}

TestProvider is the recommended way to defined flags within the scope of a test. It uses the InMemoryProvider, with flags scoped per test. Before executing a test, specify the flag values to be used for the specific test using the UsingFlags function

func NewTestProvider

func NewTestProvider() TestProvider

NewTestProvider creates a new `TestAwareProvider`

func (TestProvider) BooleanEvaluation

func (tp TestProvider) BooleanEvaluation(ctx context.Context, flag string, defaultValue bool, flCtx openfeature.FlattenedContext) openfeature.BoolResolutionDetail

func (TestProvider) Cleanup

func (tp TestProvider) Cleanup()

Cleanup deletes the flags provider bound to the current test and should be executed after each test execution e.g. using a defer statement.

func (TestProvider) FloatEvaluation

func (tp TestProvider) FloatEvaluation(ctx context.Context, flag string, defaultValue float64, flCtx openfeature.FlattenedContext) openfeature.FloatResolutionDetail

func (TestProvider) Hooks

func (tp TestProvider) Hooks() []openfeature.Hook

func (TestProvider) IntEvaluation

func (tp TestProvider) IntEvaluation(ctx context.Context, flag string, defaultValue int64, flCtx openfeature.FlattenedContext) openfeature.IntResolutionDetail

func (TestProvider) Metadata

func (tp TestProvider) Metadata() openfeature.Metadata

func (TestProvider) ObjectEvaluation

func (tp TestProvider) ObjectEvaluation(ctx context.Context, flag string, defaultValue any, flCtx openfeature.FlattenedContext) openfeature.InterfaceResolutionDetail

func (TestProvider) StringEvaluation

func (tp TestProvider) StringEvaluation(ctx context.Context, flag string, defaultValue string, flCtx openfeature.FlattenedContext) openfeature.StringResolutionDetail

func (TestProvider) UsingFlags

func (tp TestProvider) UsingFlags(test TestFramework, flags map[string]memprovider.InMemoryFlag)

Jump to

Keyboard shortcuts

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