testserver

package
v1.53.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package testserver defines a test server.

Index

Constants

View Source
const TestResolverScheme = "test"

Variables

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

Functions

func NewTestServer

func NewTestServer(t testing.TB,
	revisionQuantization time.Duration,
	gcWindow time.Duration,
	schemaPrefixRequired bool,
	dsInitFunc DatastoreInitFunc,
) (*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(t testing.TB,
	revisionQuantization time.Duration,
	gcWindow time.Duration,
	schemaPrefixRequired bool,
	config ServerConfig,
	dsInitFunc DatastoreInitFunc,
) (*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(t testing.TB,
	revisionQuantization time.Duration,
	gcWindow time.Duration,
	schemaPrefixRequired bool,
	config ServerConfig,
	emptyDS datastore.Datastore,
	dsInitFunc DatastoreInitFunc,
) (*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. All Caching is turned off.

Types

type DatastoreInitFunc added in v1.42.0

type DatastoreInitFunc func(testing.TB, datastore.Datastore) (datastore.Datastore, datastore.Revision)

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
	CaveatTypeSet                      *caveattypes.TypeSet
	EnableExperimentalLookupResources3 bool
	DataLayerOpts                      []datalayer.DataLayerOption
}

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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