reapitest

package
v0.0.0-...-9febfc8 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2025 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Overview

Package reapitest provides fake implementation of reapi for test.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, t *testing.T, fake *Fake) *reapi.Client

New starts new fake reapi grpc server and returns reapi client.

Types

type Fake

type Fake struct {
	CAS *blobstore.ContentAddressableStorage

	ExecuteFunc func(*Fake, *rpb.Action) (*rpb.ActionResult, error)
}

Fake is fake reapi server.

func (*Fake) Execute

func (f *Fake) Execute(action *rpb.Action) (*rpb.ActionResult, error)

Execute runs command on fake reapi.

func (*Fake) Fetch

func (f *Fake) Fetch(ctx context.Context, d *rpb.Digest) ([]byte, error)

Fetch fetches content identified by d from cas.

func (*Fake) FetchProto

func (f *Fake) FetchProto(ctx context.Context, d *rpb.Digest, m proto.Message) error

FetchProto fetches proto message identified by d from cas.

func (*Fake) Put

func (f *Fake) Put(ctx context.Context, data []byte) (*rpb.Digest, error)

Put puts data in CAS (for output of exec).

type InputTree

type InputTree struct {
	CAS  *blobstore.ContentAddressableStorage
	Root *rpb.Digest
}

func (InputTree) Dump

func (t InputTree) Dump(ctx context.Context, w io.Writer) error

func (InputTree) LookupDirectoryNode

func (t InputTree) LookupDirectoryNode(ctx context.Context, name string) (*rpb.DirectoryNode, error)

LookupDirectoryNode looks up a directory node by name from the tree.

func (InputTree) LookupFileNode

func (t InputTree) LookupFileNode(ctx context.Context, name string) (*rpb.FileNode, error)

LookupFileNode looks up name's file node in tree.

func (InputTree) LookupSymlinkNode

func (t InputTree) LookupSymlinkNode(ctx context.Context, name string) (*rpb.SymlinkNode, error)

LookupSymlinkNode looks up name's symlink node in tree.

Jump to

Keyboard shortcuts

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