test

package
v0.0.0-...-3b23420 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrFakeClient is an error that is returned when a
	// fake test client is configured to return an error.
	ErrFakeClient = errors.New("fake client err")
)

Functions

func NewFakeConn

func NewFakeConn() *grpc.ClientConn

NewFakeConn returns a gRPC client connection that can be used for testing, since the mock will need to return a connection that gets closed.

func NewFakeGRPCClientV3

func NewFakeGRPCClientV3() synse.V3PluginClient

NewFakeGRPCClientV3 creates a new fake gRPC client whose methods will never return an error.

func NewFakeGRPCClientV3Err

func NewFakeGRPCClientV3Err() synse.V3PluginClient

NewFakeGRPCClientV3Err creates a new fake gRPC client whose methods will always return an error.

func NewFakeHTTPClientV3

func NewFakeHTTPClientV3() synse.Client

NewFakeHTTPClientV3 creates a new fake client whose methods will never return an error.

func NewFakeHTTPClientV3Err

func NewFakeHTTPClientV3Err() synse.Client

NewFakeHTTPClientV3Err creates a new fake client whose methods will always return an error.

Types

type Builder

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

func Cmd

func Cmd(cmd *cobra.Command) *Builder

func (*Builder) Args

func (b *Builder) Args(args ...string) *Builder

func (*Builder) Run

func (b *Builder) Run(t *testing.T) (result *Result)

func (*Builder) WithRoot

func (b *Builder) WithRoot(root string) *Builder

type FakeClientStream

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

func (*FakeClientStream) CloseSend

func (f *FakeClientStream) CloseSend() error

func (*FakeClientStream) Context

func (f *FakeClientStream) Context() context.Context

func (*FakeClientStream) Header

func (f *FakeClientStream) Header() (metadata.MD, error)

func (*FakeClientStream) RecvMsg

func (f *FakeClientStream) RecvMsg(m interface{}) error

func (*FakeClientStream) SendMsg

func (f *FakeClientStream) SendMsg(m interface{}) error

func (*FakeClientStream) Trailer

func (f *FakeClientStream) Trailer() metadata.MD

type FakeDevicesClient

type FakeDevicesClient struct {
	FakeClientStream
}

func (*FakeDevicesClient) Recv

func (f *FakeDevicesClient) Recv() (*synse.V3Device, error)

type FakeGRPCClientV3

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

FakeGRPCClientV3 implements the synse.V3PluginClient interface to allow for basic testing of gRPC-based commands without dependencies on external services.

func (*FakeGRPCClientV3) Devices

func (*FakeGRPCClientV3) Health

func (f *FakeGRPCClientV3) Health(ctx context.Context, in *synse.Empty, opts ...grpc.CallOption) (*synse.V3Health, error)

func (*FakeGRPCClientV3) Metadata

func (f *FakeGRPCClientV3) Metadata(ctx context.Context, in *synse.Empty, opts ...grpc.CallOption) (*synse.V3Metadata, error)

func (*FakeGRPCClientV3) Read

func (*FakeGRPCClientV3) ReadCache

func (*FakeGRPCClientV3) ReadStream

func (*FakeGRPCClientV3) Test

func (*FakeGRPCClientV3) Transaction

func (*FakeGRPCClientV3) Transactions

func (*FakeGRPCClientV3) Version

func (f *FakeGRPCClientV3) Version(ctx context.Context, in *synse.Empty, opts ...grpc.CallOption) (*synse.V3Version, error)

func (*FakeGRPCClientV3) WriteAsync

func (*FakeGRPCClientV3) WriteSync

type FakeHTTPClientV3

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

FakeHTTPClientV3 implements the synse.Client interface to allow for basic testing without dependencies on external services.

func (*FakeHTTPClientV3) Close

func (c *FakeHTTPClientV3) Close() error

func (*FakeHTTPClientV3) Config

func (c *FakeHTTPClientV3) Config() (*scheme.Config, error)

func (*FakeHTTPClientV3) GetOptions

func (c *FakeHTTPClientV3) GetOptions() *synse.Options

func (*FakeHTTPClientV3) Info

func (c *FakeHTTPClientV3) Info(string) (*scheme.Info, error)

func (*FakeHTTPClientV3) Open

func (c *FakeHTTPClientV3) Open() error

func (*FakeHTTPClientV3) Plugin

func (c *FakeHTTPClientV3) Plugin(string) (*scheme.Plugin, error)

func (*FakeHTTPClientV3) PluginHealth

func (c *FakeHTTPClientV3) PluginHealth() (*scheme.PluginHealth, error)

func (*FakeHTTPClientV3) Plugins

func (c *FakeHTTPClientV3) Plugins() ([]*scheme.PluginMeta, error)

func (*FakeHTTPClientV3) Read

func (*FakeHTTPClientV3) ReadCache

func (c *FakeHTTPClientV3) ReadCache(opts scheme.ReadCacheOptions, readings chan<- *scheme.Read) error

func (*FakeHTTPClientV3) ReadDevice

func (c *FakeHTTPClientV3) ReadDevice(string) ([]*scheme.Read, error)

func (*FakeHTTPClientV3) ReadStream

func (c *FakeHTTPClientV3) ReadStream(options scheme.ReadStreamOptions, readings chan<- *scheme.Read, quit chan struct{}) error

func (*FakeHTTPClientV3) Scan

func (*FakeHTTPClientV3) Status

func (c *FakeHTTPClientV3) Status() (*scheme.Status, error)

func (*FakeHTTPClientV3) Tags

func (*FakeHTTPClientV3) Transaction

func (c *FakeHTTPClientV3) Transaction(string) (*scheme.Transaction, error)

func (*FakeHTTPClientV3) Transactions

func (c *FakeHTTPClientV3) Transactions() ([]string, error)

func (*FakeHTTPClientV3) Version

func (c *FakeHTTPClientV3) Version() (*scheme.Version, error)

func (*FakeHTTPClientV3) WriteAsync

func (c *FakeHTTPClientV3) WriteAsync(string, []scheme.WriteData) ([]*scheme.Write, error)

func (*FakeHTTPClientV3) WriteSync

type FakeReadClient

type FakeReadClient struct {
	FakeClientStream
}

func (*FakeReadClient) Recv

func (f *FakeReadClient) Recv() (*synse.V3Reading, error)

type FakeTransactionsClient

type FakeTransactionsClient struct {
	FakeClientStream
}

func (*FakeTransactionsClient) Recv

type FakeWriteClient

type FakeWriteClient struct {
	FakeClientStream
}

func (*FakeWriteClient) Recv

type Result

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

func (*Result) AssertErr

func (r *Result) AssertErr()

func (*Result) AssertExited

func (r *Result) AssertExited()

func (*Result) AssertGolden

func (r *Result) AssertGolden(filename string)

func (*Result) AssertNoErr

func (r *Result) AssertNoErr()

Jump to

Keyboard shortcuts

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