testutil

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2021 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Overview

Package testutil defines helpers for discovery tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Advertise(ctx *context.T, d discovery.T, visibility []security.BlessingPattern, ads ...*discovery.Advertisement) (func(), error)

func MatchFound

func MatchFound(ctx *context.T, updates []discovery.Update, wants ...discovery.Advertisement) bool

func MatchLost

func MatchLost(ctx *context.T, updates []discovery.Update, wants ...discovery.Advertisement) bool

func Scan

func Scan(ctx *context.T, d discovery.T, query string) (<-chan discovery.Update, func(), error)

func ScanAndMatch

func ScanAndMatch(ctx *context.T, d discovery.T, query string, wants ...discovery.Advertisement) error

func ToEndpoints

func ToEndpoints(addrs ...string) []naming.Endpoint

func UpdateEqual

func UpdateEqual(ctx *context.T, update discovery.Update, ad discovery.Advertisement) bool

func WithPrincipal

func WithPrincipal(ctx *context.T, extension string) (*context.T, error)

WithPrincipal creates a new principal with an extension of the default blessing of the principal in the returned context.

func WithPrivateKey

func WithPrivateKey(ctx *context.T, root *bcrypter.Root, blessing string) (*context.T, error)

WithPrivateKey creates a new principal with the provided blessing and stores the private key of the blessing in the returned context.

Types

type MockServer

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

func NewMockServer

func NewMockServer(eps []naming.Endpoint) *MockServer

func (*MockServer) AddName

func (s *MockServer) AddName(string) error

func (*MockServer) Closed

func (s *MockServer) Closed() <-chan struct{}

func (*MockServer) RemoveName

func (s *MockServer) RemoveName(string)

func (*MockServer) Status

func (s *MockServer) Status() rpc.ServerStatus

func (*MockServer) UpdateNetwork

func (s *MockServer) UpdateNetwork(eps []naming.Endpoint)

Jump to

Keyboard shortcuts

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