...

Package testhelpers

import "github.com/launchdarkly/go-server-sdk/v6/testhelpers"
Overview
Index
Subdirectories

Overview ▾

Package testhelpers contains types and functions that may be useful in testing SDK functionality or custom integrations.

It contains two subpackages:

The APIs in this package and its subpackages are supported as part of the SDK.

func WithMockLoggingContext

func WithMockLoggingContext(t Fallible, action func(subsystems.ClientContext))

WithMockLoggingContext creates a ClientContext that writes to a MockLogger, executes the specified action, and then dumps the captured output to the console only if there's been a test failure.

type Fallible

Fallible is a general interface for anything with a Failed method. This is used by test helpers to generalize between *testing.T, assert.T, etc. when all that we care about is detecting test failure.

type Fallible interface {
    Failed() bool
}

Subdirectories

Name Synopsis
..
ldservices Package ldservices provides HTTP handlers that simulate the behavior of LaunchDarkly service endpoints.
ldtestdata Package ldtestdata provides a mechanism for providing dynamically updatable feature flag state in a simplified form to an SDK client in test scenarios.
storetest Package storetest contains the standard test suite for persistent data store implementations.