rpc

package
v0.0.0-...-b5d9cbe Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package rpc provides gRPC utilities for Tast tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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) (*Client, error)

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

The context passed in must remain valid for as long as the gRPC connection. I.e. Don't use the context from within a testing.Poll function.

Example:

cl, err := rpc.Dial(ctx, d, s.RPCHint())
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, opts ...ssh.RunOption) error

Close closes the connection. TODO(b/3042409): Remove ctx param from this method.

Jump to

Keyboard shortcuts

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