testclient

package
v9.0.0-rc.6 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

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{}
	// 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) 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) 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