testutils

package
v0.0.0-...-b0b99f2 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: BSD-3-Clause Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestClient

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

func NewTestClient

func NewTestClient() *TestClient

func (*TestClient) BatchGetResult

These aren't used by our tests.

func (*TestClient) CancelTask

func (*TestClient) CountBots

func (*TestClient) CountTasks

func (*TestClient) DeleteBot

func (c *TestClient) DeleteBot(_ context.Context, in *apipb.BotRequest, opts ...grpc.CallOption) (*apipb.DeleteResponse, error)

func (*TestClient) DeleteBots

func (c *TestClient) DeleteBots(_ context.Context, bots []string) error

func (*TestClient) DoMockTasks

func (c *TestClient) DoMockTasks(f func(*apipb.TaskRequestMetadataResponse))

DoMockTasks calls f for each mocked task, allowing goroutine-safe updates. f must not call any other method on c.

func (*TestClient) GetBot

func (c *TestClient) GetBot(_ context.Context, in *apipb.BotRequest, opts ...grpc.CallOption) (*apipb.BotInfo, error)

func (*TestClient) GetBotDimensions

func (c *TestClient) GetBotDimensions(_ context.Context, in *apipb.BotsDimensionsRequest, opts ...grpc.CallOption) (*apipb.BotsDimensions, error)

func (*TestClient) GetRequest

func (*TestClient) GetResult

func (*TestClient) GetStdout

func (*TestClient) ListBotEvents

func (*TestClient) ListBotTasks

func (*TestClient) ListBots

func (*TestClient) ListTaskRequests

func (c *TestClient) ListTaskRequests(_ context.Context, in *apipb.TasksRequest, opts ...grpc.CallOption) (*apipb.TaskRequestsResponse, error)

func (*TestClient) ListTaskStates

func (c *TestClient) ListTaskStates(_ context.Context, in *apipb.TaskStatesRequest, opts ...grpc.CallOption) (*apipb.TaskStates, error)

func (*TestClient) ListTasks

func (*TestClient) MockBots

func (c *TestClient) MockBots(bots []*apipb.BotInfo)

func (*TestClient) MockTasks

func (c *TestClient) MockTasks(tasks []*apipb.TaskRequestMetadataResponse)

MockTasks sets the tasks that can be returned from ListTasks, ListSkiaTasks, GetTaskMetadata, and GetTask. Replaces any previous tasks, including those automatically added by TriggerTask.

func (*TestClient) MockTriggerTaskDeduped

func (c *TestClient) MockTriggerTaskDeduped(tags []string, extraTags ...string)

MockTriggerTaskDeduped forces the next call to TriggerTask which matches the given tags to result in a deduplicated task. The optional extraTags are added to the TaskResult in the TaskRequestMetadata returned by TriggerTask and are intended to help test unexpected behavior in deduplicated tasks.

func (*TestClient) MockTriggerTaskFailure

func (c *TestClient) MockTriggerTaskFailure(tags []string)

MockTriggerTaskFailure forces the next call to TriggerTask which matches the given tags to fail.

func (*TestClient) MockTriggerTaskNoResource

func (c *TestClient) MockTriggerTaskNoResource(tags []string)

MockTriggerTaskNoResource forces the next call to TriggerTask which matches the given tags to have NO_RESOURCE state.

func (*TestClient) NewTask

NewTask automatically appends its result to the mocked tasks set by MockTasks.

func (*TestClient) TerminateBot

Jump to

Keyboard shortcuts

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