robottestutils

package
v0.53.0-rc0 Latest Latest
Warning

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

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

Documentation

Overview

Package robottestutils provides helper functions in testing

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect added in v0.3.0

func Connect(port int) (*grpc.ClientConn, error)

Connect creates a new grpc.ClientConn server running on localhost:port.

func CreateBaseOptionsAndListener added in v0.0.9

func CreateBaseOptionsAndListener(tb testing.TB) (weboptions.Options, net.Listener, string)

CreateBaseOptionsAndListener creates a new web options with random port as listener.

func MakeTempConfig added in v0.3.0

func MakeTempConfig(t *testing.T, cfg *config.Config, logger logging.Logger) (string, error)

MakeTempConfig writes a config.Config object to a temporary file for testing.

func NewRobotClient

func NewRobotClient(tb testing.TB, logger logging.Logger, addr string, dur time.Duration) *client.RobotClient

NewRobotClient creates a new robot client with a certain address.

func ServerAsSeparateProcess added in v0.27.0

func ServerAsSeparateProcess(t *testing.T, cfgFileName string, logger logging.Logger) pexec.ManagedProcess

ServerAsSeparateProcess builds the viam server and returns an unstarted ManagedProcess for the built binary.

func WaitForServing added in v0.21.0

func WaitForServing(observer *observer.ObservedLogs, port int) bool

WaitForServing will scan the logs in the `observer` input until seeing a "serving" or "error serving web" message. For added accuracy, it also checks that the port a test is expecting to start a server on matches the one in the log message.

WaitForServing will return true if the server has started successfully in the allotted time, and false otherwise. nolint

Types

This section is empty.

Jump to

Keyboard shortcuts

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