testutils

package
v0.0.0-...-13f153f Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: BSD-3-Clause Imports: 12 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) CancelTask

func (c *TestClient) CancelTask(ctx context.Context, id string, killRunning bool) error

func (*TestClient) DeleteBots

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

func (*TestClient) DoMockTasks

func (c *TestClient) DoMockTasks(f func(*swarming_api.SwarmingRpcsTaskRequestMetadata))

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

func (*TestClient) GetStates

func (c *TestClient) GetStates(ctx context.Context, ids []string) ([]string, error)

func (*TestClient) GetStdoutOfTask

func (c *TestClient) GetStdoutOfTask(ctx context.Context, id string) (*swarming_api.SwarmingRpcsTaskOutput, error)

func (*TestClient) GetTask

func (c *TestClient) GetTask(ctx context.Context, id string, includePerformanceStats bool) (*swarming_api.SwarmingRpcsTaskResult, error)

func (*TestClient) GetTaskMetadata

func (*TestClient) GracefullyShutdownBot

func (c *TestClient) GracefullyShutdownBot(ctx context.Context, id string) (*swarming_api.SwarmingRpcsTerminateResponse, error)

func (*TestClient) ListBotTasks

func (c *TestClient) ListBotTasks(ctx context.Context, botID string, limit int) ([]*swarming_api.SwarmingRpcsTaskResult, error)

func (*TestClient) ListBots

func (c *TestClient) ListBots(ctx context.Context, dimensions map[string]string) ([]*swarming_api.SwarmingRpcsBotInfo, error)

func (*TestClient) ListBotsForDimensions

func (c *TestClient) ListBotsForDimensions(ctx context.Context, dimensions map[string]string) ([]*swarming_api.SwarmingRpcsBotInfo, error)

func (*TestClient) ListBotsForPool

func (c *TestClient) ListBotsForPool(ctx context.Context, pool string) ([]*swarming_api.SwarmingRpcsBotInfo, error)

func (*TestClient) ListDownBots

func (c *TestClient) ListDownBots(ctx context.Context, pool string) ([]*swarming_api.SwarmingRpcsBotInfo, error)

func (*TestClient) ListFreeBots

func (c *TestClient) ListFreeBots(ctx context.Context, pool string) ([]*swarming_api.SwarmingRpcsBotInfo, error)

func (*TestClient) ListSkiaTasks

func (c *TestClient) ListSkiaTasks(ctx context.Context, start, end time.Time) ([]*swarming_api.SwarmingRpcsTaskRequestMetadata, error)

func (*TestClient) ListTaskResults

func (c *TestClient) ListTaskResults(ctx context.Context, start, end time.Time, tags []string, state string, includePerformanceStats bool) ([]*swarming_api.SwarmingRpcsTaskResult, error)

func (*TestClient) ListTasks

func (c *TestClient) ListTasks(ctx context.Context, start, end time.Time, tags []string, state string) ([]*swarming_api.SwarmingRpcsTaskRequestMetadata, error)

func (*TestClient) MockBots

func (c *TestClient) MockBots(bots []*swarming_api.SwarmingRpcsBotInfo)

func (*TestClient) MockTasks

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) SwarmingService

func (c *TestClient) SwarmingService() *swarming_api.Service

func (*TestClient) TriggerTask

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

Jump to

Keyboard shortcuts

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