testutils

package
v0.23.2 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package testutils helpers for testing the config retrievial.

Index

Constants

View Source
const FakeCredentialPayLoad = "some-secret"

FakeCredentialPayLoad the hardcoded payload for all devices.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeCloudServer

type FakeCloudServer struct {
	pb.UnimplementedRobotServiceServer
	// contains filtered or unexported fields
}

FakeCloudServer fake implementation of the Viam Cloud RobotService.

func NewFakeCloudServer

func NewFakeCloudServer(ctx context.Context, logger logging.Logger) (*FakeCloudServer, error)

NewFakeCloudServer creates and starts a new grpc server for the Viam Cloud.

func (*FakeCloudServer) Addr

func (s *FakeCloudServer) Addr() net.Addr

Addr returns the listeners address.

func (*FakeCloudServer) Certificate

Certificate impl.

func (*FakeCloudServer) Clear

func (s *FakeCloudServer) Clear()

Clear resets the fake servers state, does not restart the server.

func (*FakeCloudServer) Config

Config impl.

func (*FakeCloudServer) FailOnConfigAndCerts

func (s *FakeCloudServer) FailOnConfigAndCerts(failure bool)

FailOnConfigAndCerts if `failure` is true the server will return an Internal error on all certficate and config requests.

func (*FakeCloudServer) FailOnConfigAndCertsWith added in v0.23.0

func (s *FakeCloudServer) FailOnConfigAndCertsWith(err error)

FailOnConfigAndCertsWith will cause the server to return a given `error` on all certficate and config requests. If `error == nil` then certficate and config requests will succeed.

func (*FakeCloudServer) Log

Log impl.

func (*FakeCloudServer) NeedsRestart

NeedsRestart impl.

func (*FakeCloudServer) Shutdown

func (s *FakeCloudServer) Shutdown() error

Shutdown will stop the server.

func (*FakeCloudServer) StoreDeviceConfig

func (s *FakeCloudServer) StoreDeviceConfig(id string, cfg *pb.RobotConfig, cert *pb.CertificateResponse)

StoreDeviceConfig store config and cert data for the device id.

Jump to

Keyboard shortcuts

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