Documentation ¶
Overview ¶
Package testutils helpers for testing the config retrievial.
Index ¶
- Constants
- type FakeCloudServer
- func (s *FakeCloudServer) Addr() net.Addr
- func (s *FakeCloudServer) Certificate(ctx context.Context, req *pb.CertificateRequest) (*pb.CertificateResponse, error)
- func (s *FakeCloudServer) Clear()
- func (s *FakeCloudServer) Config(ctx context.Context, req *pb.ConfigRequest) (*pb.ConfigResponse, error)
- func (s *FakeCloudServer) FailOnConfigAndCerts(failure bool)
- func (s *FakeCloudServer) FailOnConfigAndCertsWith(err error)
- func (s *FakeCloudServer) Log(ctx context.Context, req *pb.LogRequest) (*pb.LogResponse, error)
- func (s *FakeCloudServer) NeedsRestart(ctx context.Context, req *pb.NeedsRestartRequest) (*pb.NeedsRestartResponse, error)
- func (s *FakeCloudServer) Shutdown() error
- func (s *FakeCloudServer) StoreDeviceConfig(id string, cfg *pb.RobotConfig, cert *pb.CertificateResponse)
Constants ¶
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 ¶
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 ¶
func (s *FakeCloudServer) Certificate(ctx context.Context, req *pb.CertificateRequest) (*pb.CertificateResponse, error)
Certificate impl.
func (*FakeCloudServer) Clear ¶
func (s *FakeCloudServer) Clear()
Clear resets the fake servers state, does not restart the server.
func (*FakeCloudServer) Config ¶
func (s *FakeCloudServer) Config(ctx context.Context, req *pb.ConfigRequest) (*pb.ConfigResponse, error)
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 ¶
func (s *FakeCloudServer) Log(ctx context.Context, req *pb.LogRequest) (*pb.LogResponse, error)
Log impl.
func (*FakeCloudServer) NeedsRestart ¶
func (s *FakeCloudServer) NeedsRestart(ctx context.Context, req *pb.NeedsRestartRequest) (*pb.NeedsRestartResponse, error)
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.