testclient

package
v9.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package testclient contains test helpers that reference the SDK-related packages. These are in sharedtest/testclient rather than just sharedtest so that sharedtest can be used by those packages without a circular reference.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientFactoryThatFails

func ClientFactoryThatFails(err error) sdks.ClientFactoryFunc

func CreateDummyClient

func CreateDummyClient(sdkKey config.SDKKey, sdkConfig ld.Config, timeout time.Duration) (sdks.LDClientContext, error)

func FakeHashForContext

func FakeHashForContext(context ldcontext.Context) string

func FakeLDClientFactory

func FakeLDClientFactory(shouldBeInitialized bool) sdks.ClientFactoryFunc

func FakeLDClientFactoryWithChannel

func FakeLDClientFactoryWithChannel(shouldBeInitialized bool, createdCh chan<- *FakeLDClient, changeSetCh <-chan subsystems.ChangeSet) sdks.ClientFactoryFunc

func FakeLDClientFactoryWithStore

func FakeLDClientFactoryWithStore(shouldBeInitialized bool, store *FakeStore) sdks.ClientFactoryFunc

FakeLDClientFactoryWithStore is FakeLDClientFactory with a store of the caller's choosing instead of one preloaded with the standard test data. FakeStore serves whatever collections it is given, so this is how a test reaches behavior the standard fixtures cannot express: a deletion placeholder, an item of the wrong type, or a data kind Relay does not recognize.

func RealLDClientFactoryWithChannel

func RealLDClientFactoryWithChannel(shouldBeInitialized bool, createdCh chan<- CapturedLDClient) sdks.ClientFactoryFunc

Types

type CapturedLDClient

type CapturedLDClient struct {
	Key    config.SDKKey
	Client sdks.LDClientContext
}

type FakeDataDestination

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

func NewFakeDataDestination

func NewFakeDataDestination(store *FakeStore) *FakeDataDestination

func (*FakeDataDestination) Apply

func (d *FakeDataDestination) Apply(changeSet subsystems.ChangeSet)

func (*FakeDataDestination) ApplyDelta

func (d *FakeDataDestination) ApplyDelta(changes []subsystems.Change, selector subsystems.Selector, persist bool)

func (*FakeDataDestination) Selector

func (d *FakeDataDestination) Selector() subsystems.Selector

func (*FakeDataDestination) SetBasis

func (d *FakeDataDestination) SetBasis(changes []subsystems.Change, selector subsystems.Selector, persist bool)

type FakeLDClient

type FakeLDClient struct {
	Key     config.SDKKey
	CloseCh chan struct{}

	// LDRelayApplySDKKeyErr, if non-nil, is what LDRelayApplySDKKey returns instead of applying the
	// new key. Tests set it to exercise the path where the SDK rejects a key.
	LDRelayApplySDKKeyErr error
	// contains filtered or unexported fields
}

func (*FakeLDClient) AwaitClose

func (c *FakeLDClient) AwaitClose(t *testing.T, timeout time.Duration)

func (*FakeLDClient) Close

func (c *FakeLDClient) Close() error

func (*FakeLDClient) CurrentSDKKey

func (c *FakeLDClient) CurrentSDKKey() config.SDKKey

CurrentSDKKey returns the key the client is currently using.

func (*FakeLDClient) GetDataSourceStatus

func (c *FakeLDClient) GetDataSourceStatus() interfaces.DataSourceStatus

func (*FakeLDClient) GetDataStoreStatus

func (c *FakeLDClient) GetDataStoreStatus() sdks.DataStoreStatusInfo

func (*FakeLDClient) Initialized

func (c *FakeLDClient) Initialized() bool

func (*FakeLDClient) LDRelayApplySDKKey

func (c *FakeLDClient) LDRelayApplySDKKey(sdkKey string) error

func (*FakeLDClient) SDKKeys

func (c *FakeLDClient) SDKKeys() []config.SDKKey

SDKKeys returns the keys LDRelayApplySDKKey accepted, in order.

func (*FakeLDClient) SecureModeHash

func (c *FakeLDClient) SecureModeHash(context ldcontext.Context) string

func (*FakeLDClient) SetDataSourceStatus

func (c *FakeLDClient) SetDataSourceStatus(newStatus interfaces.DataSourceStatus)

type FakeStore

type FakeStore struct {

	// SnapshotHook, if non-nil, is called at the start of every Snapshot call, before the
	// store's lock is taken. Tests set it (before sharing the store across goroutines) to
	// observe or block concurrent snapshot reads.
	SnapshotHook func()

	// GetAllHook is SnapshotHook for GetAll calls.
	GetAllHook func()
	// contains filtered or unexported fields
}

func NewFakeStore

func NewFakeStore(collections []ldstoretypes.Collection) *FakeStore

func (*FakeStore) Apply

func (s *FakeStore) Apply(changeSet subsystems.ChangeSet)

func (*FakeStore) Close

func (s *FakeStore) Close() error

func (*FakeStore) Get

func (*FakeStore) GetAll

func (*FakeStore) InvalidateClientSideState

func (s *FakeStore) InvalidateClientSideState()

func (*FakeStore) IsInitialized

func (s *FakeStore) IsInitialized() bool

func (*FakeStore) Selector

func (s *FakeStore) Selector() subsystems.Selector

Jump to

Keyboard shortcuts

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