treetest

package
v0.0.0-...-0e38fd1 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package treetest implements fake Tree for testing in CV.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeServer

type FakeServer struct {
	tspb.UnimplementedTreeStatusServer
	// contains filtered or unexported fields
}

FakeServer simulates tree status server used in test.

func NewFakeServer

func NewFakeServer(ctx context.Context) *FakeServer

NewFakeServer returns a fake tree status server.

`Shutdown` SHOULD be called after test completes.

func (*FakeServer) GetStatus

func (fs *FakeServer) GetStatus(ctx context.Context, req *tspb.GetStatusRequest) (*tspb.Status, error)

GetStatus implements `tspb.TreeStatusServer`.

func (*FakeServer) Host

func (fs *FakeServer) Host() string

Host returns the address of fake tree status server.

func (*FakeServer) InjectErr

func (fs *FakeServer) InjectErr(treeName string, err error)

InjectErr makes Tree status server return error for the given tree.

Passing nil error will bring the tree back to normal.

func (*FakeServer) ModifyState

func (fs *FakeServer) ModifyState(treeName string, state tspb.GeneralState)

ModifyState sets the state of the given tree.

func (*FakeServer) Shutdown

func (fs *FakeServer) Shutdown()

Shutdown closes the fake tree status server.

Jump to

Keyboard shortcuts

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