testhelper

package
v0.0.0-weekly-f4-test-... Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneProto

func CloneProto[T proto.Message](t *testing.T, in T) T

CloneProto clones a protobuf message.

func EqualProto

func EqualProto(t *testing.T, expected, actual interface{})

Equal compares two protobuf messages ignoring extra generated proto fields.

func NewMockRing

func NewMockRing(ingesters []ring.InstanceDesc, replicationFactor uint32) ring.ReadRing

Types

type FakePoolClient

type FakePoolClient struct{}

func (FakePoolClient) Close

func (f FakePoolClient) Close() error

type InMemoryServer

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

InMemoryServer is an HTTP server that uses in-memory pipes instead of TCP. It supports HTTP/2 and has TLS enabled.

The Go Playground panics if we try to start a TCP-backed server. If you're not familiar with the Playground's behavior, it looks like our examples are broken. This server lets us write examples that work in the playground without abstracting over HTTP.

func NewInMemoryServer

func NewInMemoryServer(handler http.Handler) *InMemoryServer

NewInMemoryServer constructs and starts an inMemoryServer.

func (*InMemoryServer) Client

func (s *InMemoryServer) Client() *http.Client

Client returns an HTTP client configured to trust the server's TLS certificate and use HTTP/2 over an in-memory pipe. Automatic HTTP-level gzip compression is disabled. It closes its idle connections when the server is closed.

func (*InMemoryServer) Close

func (s *InMemoryServer) Close()

Close shuts down the server, blocking until all outstanding requests have completed.

func (*InMemoryServer) URL

func (s *InMemoryServer) URL() string

URL is the server's URL.

type MockRing

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

func (MockRing) CleanupShuffleShardCache

func (r MockRing) CleanupShuffleShardCache(identifier string)

func (MockRing) Get

func (r MockRing) Get(key uint32, op ring.Operation, buf []ring.InstanceDesc, _ []string, _ []string) (ring.ReplicationSet, error)

func (MockRing) GetAllHealthy

func (r MockRing) GetAllHealthy(op ring.Operation) (ring.ReplicationSet, error)

func (MockRing) GetInstanceState

func (r MockRing) GetInstanceState(instanceID string) (ring.InstanceState, error)

func (MockRing) GetReplicationSetForOperation

func (r MockRing) GetReplicationSetForOperation(op ring.Operation) (ring.ReplicationSet, error)

func (MockRing) HasInstance

func (r MockRing) HasInstance(instanceID string) bool

func (MockRing) InstancesCount

func (r MockRing) InstancesCount() int

func (MockRing) ReplicationFactor

func (r MockRing) ReplicationFactor() int

func (MockRing) ShuffleShard

func (r MockRing) ShuffleShard(identifier string, size int) ring.ReadRing

func (MockRing) ShuffleShardWithLookback

func (r MockRing) ShuffleShardWithLookback(identifier string, size int, lookbackPeriod time.Duration, now time.Time) ring.ReadRing

func (MockRing) Subring

func (r MockRing) Subring(key uint32, n int) ring.ReadRing

Jump to

Keyboard shortcuts

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