testserver

package
v1.36.3 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const TestResolverScheme = "test"

Variables

View Source
var DefaultTestServerConfig = ServerConfig{
	MaxUpdatesPerWrite:              1000,
	MaxPreconditionsCount:           1000,
	StreamingAPITimeout:             30 * time.Second,
	MaxRelationshipContextSize:      25000,
	UseExperimentalLookupResources2: false,
}

Functions

func NewTestServer

func NewTestServer(require *require.Assertions,
	revisionQuantization time.Duration,
	gcWindow time.Duration,
	schemaPrefixRequired bool,
	dsInitFunc func(datastore.Datastore, *require.Assertions) (datastore.Datastore, datastore.Revision),
) (*grpc.ClientConn, func(), datastore.Datastore, datastore.Revision)

NewTestServer creates a new test server, using defaults for the config.

func NewTestServerWithConfig added in v1.12.0

func NewTestServerWithConfig(require *require.Assertions,
	revisionQuantization time.Duration,
	gcWindow time.Duration,
	schemaPrefixRequired bool,
	config ServerConfig,
	dsInitFunc func(datastore.Datastore, *require.Assertions) (datastore.Datastore, datastore.Revision),
) (*grpc.ClientConn, func(), datastore.Datastore, datastore.Revision)

NewTestServerWithConfig creates as new test server with the specified config.

func NewTestServerWithConfigAndDatastore added in v1.35.0

func NewTestServerWithConfigAndDatastore(require *require.Assertions,
	revisionQuantization time.Duration,
	gcWindow time.Duration,
	schemaPrefixRequired bool,
	config ServerConfig,
	emptyDS datastore.Datastore,
	dsInitFunc func(datastore.Datastore, *require.Assertions) (datastore.Datastore, datastore.Revision),
) (*grpc.ClientConn, func(), datastore.Datastore, datastore.Revision)

func TestClusterWithDispatch added in v1.6.0

func TestClusterWithDispatch(t testing.TB, size uint, ds datastore.Datastore, additionalServerOptions ...server.ConfigOption) ([]*grpc.ClientConn, func())

TestClusterWithDispatch creates a cluster with `size` nodes The cluster has a real dispatch stack that uses bufconn grpc connections

func TestClusterWithDispatchAndCacheConfig added in v1.11.0

func TestClusterWithDispatchAndCacheConfig(t testing.TB, size uint, ds datastore.Datastore, additionalServerOptions ...server.ConfigOption) ([]*grpc.ClientConn, func())

TestClusterWithDispatchAndCacheConfig creates a cluster with `size` nodes and with cache toggled.

Types

type SafeManualResolver added in v1.6.0

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

SafeManualResolver is the resolver type that SafeManualResolverBuilder builds it returns a static list of addresses

func (*SafeManualResolver) Close added in v1.6.0

func (r *SafeManualResolver) Close()

Close implements the resolver.Resolver interface

func (*SafeManualResolver) ResolveNow added in v1.6.0

ResolveNow implements the resolver.Resolver interface It sends the static list of addresses to the underlying resolver.ClientConn

type SafeManualResolverBuilder added in v1.6.0

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

SafeManualResolverBuilder is a resolver builder that builds SafeManualResolvers it is similar to manual.Resolver in grpc, but is thread safe

func (*SafeManualResolverBuilder) Build added in v1.6.0

func (*SafeManualResolverBuilder) ResolveNow added in v1.6.0

func (b *SafeManualResolverBuilder) ResolveNow(prefix string)

func (*SafeManualResolverBuilder) Scheme added in v1.6.0

func (b *SafeManualResolverBuilder) Scheme() string

func (*SafeManualResolverBuilder) SetAddrs added in v1.6.0

func (b *SafeManualResolverBuilder) SetAddrs(prefix string, addrs []resolver.Address)

type ServerConfig added in v1.12.0

type ServerConfig struct {
	MaxUpdatesPerWrite              uint16
	MaxPreconditionsCount           uint16
	MaxRelationshipContextSize      int
	StreamingAPITimeout             time.Duration
	UseExperimentalLookupResources2 bool
}

ServerConfig is configuration for the test server.

type TempError added in v1.6.0

type TempError struct{}

func (TempError) Error added in v1.6.0

func (t TempError) Error() string

func (TempError) Temporary added in v1.6.0

func (t TempError) Temporary() bool

Jump to

Keyboard shortcuts

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