package ydbtest

import "github.com/ydb-platform/ydb-go-sdk/v3/internal/ydbtest"

Package ydbtest provides tools for stubbing ydb server up.

Index

Functions

func SplitHostPort

func SplitHostPort(addr string) (host string, port int, err error)

Types

type Balancer

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

func (*Balancer) Addr

func (b *Balancer) Addr() net.Addr

func (*Balancer) Close

func (b *Balancer) Close() error

func (*Balancer) DialContext

func (b *Balancer) DialContext(ctx context.Context) (net.Conn, error)

type Endpoint

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

func (*Endpoint) Close

func (e *Endpoint) Close()

func (*Endpoint) DialContext

func (e *Endpoint) DialContext(ctx context.Context) (net.Conn, error)

func (*Endpoint) ServerConn

func (e *Endpoint) ServerConn() <-chan net.Conn

type Handler

type Handler func(ctx context.Context, req RequestParser) (res interface{}, err error)

func SuccessHandler

func SuccessHandler(f ResponseMapper) Handler

type Handlers

type Handlers map[trace.Method]Handler

type Listener

type Listener struct {
	Client chan net.Conn
	Server chan net.Conn
	Closed chan struct{}
	// contains filtered or unexported fields
}

func NewListener

func NewListener() *Listener

func (*Listener) Accept

func (ln *Listener) Accept() (net.Conn, error)

func (*Listener) Addr

func (ln *Listener) Addr() net.Addr

func (*Listener) Close

func (ln *Listener) Close() error

func (*Listener) DialContext

func (ln *Listener) DialContext(ctx context.Context) (net.Conn, error)

func (*Listener) DialGRPC

func (ln *Listener) DialGRPC() (*grpc.ClientConn, error)

func (*Listener) HostPort

func (ln *Listener) HostPort() (host string, port int, err error)

type RequestParser

type RequestParser func(interface{})

type ResponseMapper

type ResponseMapper func(RequestParser) proto.Message

func Ident

func Ident(res proto.Message) ResponseMapper

type YDB

type YDB struct {
	Database string
	Handlers Handlers
	T        testing.TB
	// contains filtered or unexported fields
}

func (*YDB) DialContext

func (s *YDB) DialContext(ctx context.Context, addr string) (_ net.Conn, err error)

func (*YDB) StartBalancer

func (s *YDB) StartBalancer() *Balancer

StartBalancer starts to provide a discovery service on some local address.

func (*YDB) StartEndpoint

func (s *YDB) StartEndpoint() *Endpoint

StartEndpoint starts to provide a YDB service on some local address.

Source Files

ydbtest.go

Version
v3.0.2
Published
Oct 22, 2021
Platform
js/wasm
Imports
16 packages
Last checked
18 minutes ago

Tools for package owners.