locatetest

package
v0.4.101 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLocateServerV2

func NewLocateServerV2(loc *LocatorV2) *httptest.Server

NewLocateServerV2 creates an httptest.Server that can respond to Locate API V2 requests using a LocatorV2. Uselful for unit testing.

Types

type LocatorV2

type LocatorV2 struct {
	heartbeat.StatusTracker
	Servers []string
	Err     error
}

LocatorV2 is a fake LocatorV2 implementation that returns the configured Servers or Err.

func (*LocatorV2) Nearest

func (l *LocatorV2) Nearest(service string, lat, lon float64, opts *heartbeat.NearestOptions) (*heartbeat.TargetInfo, error)

Nearest returns the pre-configured LocatorV2 Servers or Err.

type Signer

type Signer struct{}

Signer implements the Signer interface for unit tests.

func (*Signer) Sign

func (s *Signer) Sign(cl jwt.Claims) (string, error)

Sign creates a fake signature using the given claims.

Jump to

Keyboard shortcuts

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