testserver

package
v16.11.10 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: MIT Imports: 50 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunGitalyServer

func RunGitalyServer(tb testing.TB, cfg config.Cfg, registrar func(srv *grpc.Server, deps *service.Dependencies), opts ...GitalyServerOpt) string

RunGitalyServer starts gitaly server based on the provided cfg and returns a connection address. It accepts addition Registrar to register all required service instead of calling service.RegisterAll explicitly because it creates a circular dependency when the function is used in on of internal/gitaly/service/... packages.

func StructErrStreamInterceptor added in v16.1.0

func StructErrStreamInterceptor(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error

StructErrStreamInterceptor is an interceptor for streaming RPC calls that injects error metadata as detailed error. This is only supposed to be used for testing purposes as error metadata is considered to be a server-side detail. No clients should start to rely on it.

func StructErrUnaryInterceptor added in v16.1.0

func StructErrUnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

StructErrUnaryInterceptor is an interceptor for unary RPC calls that injects error metadata as detailed error. This is only supposed to be used for testing purposes as error metadata is considered to be a server-side detail. No clients should start to rely on it.

Types

type GitalyServer

type GitalyServer struct {
	Server *grpc.Server
	// contains filtered or unexported fields
}

GitalyServer is a helper that carries additional info and functionality about gitaly (+praefect) server.

func StartGitalyServer

func StartGitalyServer(tb testing.TB, cfg config.Cfg, registrar func(srv *grpc.Server, deps *service.Dependencies), opts ...GitalyServerOpt) GitalyServer

StartGitalyServer creates and runs gitaly (and praefect as a proxy) server.

func (GitalyServer) Address

func (gs GitalyServer) Address() string

Address returns address of the running gitaly (or praefect) service.

func (GitalyServer) Shutdown

func (gs GitalyServer) Shutdown()

Shutdown terminates running gitaly (+praefect) server.

type GitalyServerOpt

type GitalyServerOpt func(gitalyServerDeps) gitalyServerDeps

GitalyServerOpt is a helper type to shorten declarations.

func WithBackchannelRegistry

func WithBackchannelRegistry(backchannelReg *backchannel.Registry) GitalyServerOpt

WithBackchannelRegistry sets backchannel.Registry instance that will be used for gitaly services initialisation.

func WithBackupLocator added in v16.2.0

func WithBackupLocator(backupLocator backup.Locator) GitalyServerOpt

WithBackupLocator sets the backup.Locator that will be used for Gitaly services

func WithBackupSink added in v16.2.0

func WithBackupSink(backupSink backup.Sink) GitalyServerOpt

WithBackupSink sets the backup.Sink that will be used for Gitaly services

func WithDisablePraefect

func WithDisablePraefect() GitalyServerOpt

WithDisablePraefect disables setup and usage of the praefect as a proxy before the gitaly service.

func WithDiskCache

func WithDiskCache(diskCache cache.Cache) GitalyServerOpt

WithDiskCache sets the cache.Cache instance that will be used for gitaly services initialisation.

func WithGitCommandFactory

func WithGitCommandFactory(gitCmdFactory git.CommandFactory) GitalyServerOpt

WithGitCommandFactory sets a git.CommandFactory instance that will be used for gitaly services initialisation.

func WithGitLabClient

func WithGitLabClient(gitlabClient gitlab.Client) GitalyServerOpt

WithGitLabClient sets gitlab.Client instance that will be used for gitaly services initialisation.

func WithHookManager

func WithHookManager(hookMgr hook.Manager) GitalyServerOpt

WithHookManager sets hook.Manager instance that will be used for gitaly services initialisation.

func WithHousekeepingManager

func WithHousekeepingManager(manager housekeepingmgr.Manager) GitalyServerOpt

WithHousekeepingManager sets the housekeeping.Manager that will be used for Gitaly services initialization.

func WithLocator

func WithLocator(locator storage.Locator) GitalyServerOpt

WithLocator sets a storage.Locator instance that will be used for gitaly services initialisation.

func WithLogger

func WithLogger(logger log.Logger) GitalyServerOpt

WithLogger sets a log.Logger instance that will be used for gitaly services initialisation.

func WithPackObjectsLimiter

func WithPackObjectsLimiter(limiter *limiter.ConcurrencyLimiter) GitalyServerOpt

WithPackObjectsLimiter sets the PackObjectsLimiter that will be used for gitaly services initialization.

func WithProcReceiveRegistry added in v16.8.0

func WithProcReceiveRegistry(registry *hook.ProcReceiveRegistry) GitalyServerOpt

WithProcReceiveRegistry sets the proc receive registry that will be used for Gitaly services.

func WithRepositoryCounter added in v16.3.0

func WithRepositoryCounter(repositoryCounter *counter.RepositoryCounter) GitalyServerOpt

WithRepositoryCounter sets the counter.RepositoryCounter instance that will be used for gitaly services initialisation.

func WithSigningKey added in v16.2.0

func WithSigningKey(signingKey string) GitalyServerOpt

WithSigningKey sets the signing key path that will be used for Gitaly services.

func WithTransactionManager

func WithTransactionManager(txMgr transaction.Manager) GitalyServerOpt

WithTransactionManager sets transaction.Manager instance that will be used for gitaly services initialisation.

func WithTransactionRegistry added in v16.6.0

func WithTransactionRegistry(registry *storagemgr.TransactionRegistry) GitalyServerOpt

WithTransactionRegistry sets the transaction registry that will be used for Gitaly services.

type PraefectServer

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

PraefectServer encapsulates information of a running Praefect server.

func StartPraefect

func StartPraefect(tb testing.TB, cfg config.Config) PraefectServer

StartPraefect creates and runs a Praefect proxy. This server is created by running the external Praefect executable.

func (PraefectServer) Address

func (ps PraefectServer) Address() string

Address is the address of the Praefect server.

func (PraefectServer) Shutdown

func (ps PraefectServer) Shutdown()

Shutdown shuts the Praefect server down. This function is synchronous and waits for the server to exit.

Jump to

Keyboard shortcuts

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