rpc

package
v0.0.0-...-d046166 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2020 License: BSD-3-Clause Imports: 24 Imported by: 0

Documentation

Overview

Package rpc provides internal gRPC utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunServer

func RunServer(r io.Reader, w io.Writer, svcs []*testing.Service) error

RunServer runs a gRPC server providing svcs on r/w channels. It blocks until the client connection is closed or it encounters an error.

Types

type Client

type Client struct {
	// Conn is the gRPC connection. Use this to create gRPC service stubs.
	Conn *grpc.ClientConn
	// contains filtered or unexported fields
}

Client owns a gRPC connection to the DUT for remote tests to use.

func Dial

func Dial(ctx context.Context, d *dut.DUT, h *testing.RPCHint, bundleName string) (*Client, error)

Dial establishes a gRPC connection to the test bundle executable named bundleName using d and h.

Example:

cl, err := rpc.Dial(ctx, d, s.RPCHint(), "cros")
if err != nil {
	return err
}
defer cl.Close(ctx)

fs := base.NewFileSystemClient(cl.Conn)

res, err := fs.ReadDir(ctx, &base.ReadDirRequest{Dir: "/mnt/stateful_partition"})
if err != nil {
	return err
}

func (*Client) Close

func (c *Client) Close(ctx context.Context) error

Close closes this client.

Jump to

Keyboard shortcuts

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