Documentation ¶
Overview ¶
Package service implements a skylab.Client using calls to BuildBucket.
Index ¶
- type ArgsCollectingClientWrapper
- func (c *ArgsCollectingClientWrapper) FetchResults(ctx context.Context, t TaskReference) (*FetchResultsResponse, error)
- func (c *ArgsCollectingClientWrapper) LaunchTask(ctx context.Context, args *request.Args) (TaskReference, error)
- func (c *ArgsCollectingClientWrapper) SwarmingTaskID(t TaskReference) string
- func (c *ArgsCollectingClientWrapper) URL(t TaskReference) string
- func (c *ArgsCollectingClientWrapper) ValidateArgs(ctx context.Context, args *request.Args) (bool, []types.TaskDimKeyVal, error)
- type BotsAwareFakeClient
- type CallCountingClientWrapper
- func (c *CallCountingClientWrapper) FetchResults(ctx context.Context, t TaskReference) (*FetchResultsResponse, error)
- func (c *CallCountingClientWrapper) LaunchTask(ctx context.Context, args *request.Args) (TaskReference, error)
- func (c *CallCountingClientWrapper) SwarmingTaskID(t TaskReference) string
- func (c *CallCountingClientWrapper) URL(t TaskReference) string
- func (c *CallCountingClientWrapper) ValidateArgs(ctx context.Context, args *request.Args) (bool, []types.TaskDimKeyVal, error)
- type Client
- type FetchResultsResponse
- type StubClient
- func (c StubClient) FetchResults(context.Context, TaskReference) (*FetchResultsResponse, error)
- func (c StubClient) LaunchTask(context.Context, *request.Args) (TaskReference, error)
- func (c StubClient) SwarmingTaskID(TaskReference) string
- func (c StubClient) URL(TaskReference) string
- func (c StubClient) ValidateArgs(context.Context, *request.Args) (bool, []types.TaskDimKeyVal, error)
- type StubClientWithCannedResults
- type TaskReference
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArgsCollectingClientWrapper ¶
type ArgsCollectingClientWrapper struct { // Name the wrapped client to avoid accidental forwarding of method calls // without counting. Client Client // Calls is a POD that contains the arguments to all Client method calls // through a ArgsCollectingClientWrapper. Calls struct { ValidateArgs []struct { Args *request.Args } LaunchTask []struct { Args *request.Args } FetchResults []struct { T TaskReference } SwarmingTaskID []struct { T TaskReference } URL []struct { T TaskReference } } }
ArgsCollectingClientWrapper collects arguments provided to the Client method calls before forwarding them to the wrapped Client.
func (*ArgsCollectingClientWrapper) FetchResults ¶
func (c *ArgsCollectingClientWrapper) FetchResults(ctx context.Context, t TaskReference) (*FetchResultsResponse, error)
FetchResults implements Client interface.
func (*ArgsCollectingClientWrapper) LaunchTask ¶
func (c *ArgsCollectingClientWrapper) LaunchTask(ctx context.Context, args *request.Args) (TaskReference, error)
LaunchTask implements Client interface.
func (*ArgsCollectingClientWrapper) SwarmingTaskID ¶
func (c *ArgsCollectingClientWrapper) SwarmingTaskID(t TaskReference) string
SwarmingTaskID implements Client interface.
func (*ArgsCollectingClientWrapper) URL ¶
func (c *ArgsCollectingClientWrapper) URL(t TaskReference) string
URL implements Client interface.
func (*ArgsCollectingClientWrapper) ValidateArgs ¶
func (c *ArgsCollectingClientWrapper) ValidateArgs(ctx context.Context, args *request.Args) (bool, []types.TaskDimKeyVal, error)
ValidateArgs implements Client interface.
type BotsAwareFakeClient ¶
type BotsAwareFakeClient struct { StubClient // List of dimensions for each available bot. // Dimensions for each bot must be supplied as "key:value" strings. Bots []stringset.Set }
BotsAwareFakeClient implements a fake Client which is aware of the available bots.
BotsAwareFakeClient implements ValidateArgs to be consistent with available bots, buts stubs out the other methods.
func NewBotsAwareFakeClient ¶
func NewBotsAwareFakeClient(bots ...stringset.Set) BotsAwareFakeClient
NewBotsAwareFakeClient creates a new BotsAwareFakeClient with some defaults.
func (BotsAwareFakeClient) ValidateArgs ¶
func (c BotsAwareFakeClient) ValidateArgs(ctx context.Context, args *request.Args) (bool, []types.TaskDimKeyVal, error)
ValidateArgs implements Client interface.
type CallCountingClientWrapper ¶
type CallCountingClientWrapper struct { // Name the wrapped client to avoid accidental forwarding of method calls // without counting. Client Client // CallCounts is a POD value that contains the number of each time each method // in Client was called. CallCounts struct { ValidateArgs int LaunchTask int FetchResults int SwarmingTaskID int URL int } }
CallCountingClientWrapper is a Client wrapper that additionally counts the number of times each Client method is called.
func (*CallCountingClientWrapper) FetchResults ¶
func (c *CallCountingClientWrapper) FetchResults(ctx context.Context, t TaskReference) (*FetchResultsResponse, error)
FetchResults implements Client interface.
func (*CallCountingClientWrapper) LaunchTask ¶
func (c *CallCountingClientWrapper) LaunchTask(ctx context.Context, args *request.Args) (TaskReference, error)
LaunchTask implements Client interface.
func (*CallCountingClientWrapper) SwarmingTaskID ¶
func (c *CallCountingClientWrapper) SwarmingTaskID(t TaskReference) string
SwarmingTaskID implements Client interface.
func (*CallCountingClientWrapper) URL ¶
func (c *CallCountingClientWrapper) URL(t TaskReference) string
URL implements Client interface.
func (*CallCountingClientWrapper) ValidateArgs ¶
func (c *CallCountingClientWrapper) ValidateArgs(ctx context.Context, args *request.Args) (bool, []types.TaskDimKeyVal, error)
ValidateArgs implements Client interface.
type Client ¶
type Client interface { // ValidateArgs validates that a test_runner build can be created with // the give arguments. ValidateArgs(context.Context, *request.Args) (bool, []types.TaskDimKeyVal, error) // LaunchTask creates a new test_runner task with the given arguments. LaunchTask(context.Context, *request.Args) (TaskReference, error) // FetchResults fetches results for a previously launched test_runner task. FetchResults(context.Context, TaskReference) (*FetchResultsResponse, error) // SwarmingTaskID returns the swarming task ID for a test_runner build. SwarmingTaskID(TaskReference) string // URL returns a canonical URL for a test_runner build. URL(TaskReference) string }
Client defines an interface used to interact with test_runner as a service.
type FetchResultsResponse ¶
type FetchResultsResponse struct { Result *skylab_test_runner.Result LifeCycle test_platform.TaskState_LifeCycle }
FetchResultsResponse is an implementation-independent container for information about running and finished tasks.
type StubClient ¶
type StubClient struct{}
StubClient implements a noop Client with "reasonable" default behavior for all methods.
func (StubClient) FetchResults ¶
func (c StubClient) FetchResults(context.Context, TaskReference) (*FetchResultsResponse, error)
FetchResults implements Client interface.
func (StubClient) LaunchTask ¶
func (c StubClient) LaunchTask(context.Context, *request.Args) (TaskReference, error)
LaunchTask implements Client interface.
func (StubClient) SwarmingTaskID ¶
func (c StubClient) SwarmingTaskID(TaskReference) string
SwarmingTaskID implements Client interface.
func (StubClient) URL ¶
func (c StubClient) URL(TaskReference) string
URL implements Client interface.
func (StubClient) ValidateArgs ¶
func (c StubClient) ValidateArgs(context.Context, *request.Args) (bool, []types.TaskDimKeyVal, error)
ValidateArgs implements Client interface.
type StubClientWithCannedResults ¶
type StubClientWithCannedResults struct { StubClient CannedResponses []FetchResultsResponse }
StubClientWithCannedResults is a stub Client that always returns canned result for the FetchResults method.
func NewStubClientWithCannedIncompleteTasks ¶
func NewStubClientWithCannedIncompleteTasks(lifeCycle test_platform.TaskState_LifeCycle) *StubClientWithCannedResults
NewStubClientWithCannedIncompleteTasks returns a new StubWithCannedResultsClient where all tasks are deemed incomplete with the given lifeCycle.
In particular, this means that no detailed test_runner response is available in the response for FetchResults.
func NewStubClientWithFailedTasks ¶
func NewStubClientWithFailedTasks() *StubClientWithCannedResults
NewStubClientWithFailedTasks returns a new StubWithCannedResultsClient where all tasks are deemed to have completed, but unsuccessfully.
func NewStubClientWithSuccessfulTasks ¶
func NewStubClientWithSuccessfulTasks() *StubClientWithCannedResults
NewStubClientWithSuccessfulTasks returns a new StubWithCannedResultsClient where all tasks are deemed to have completed successfully.
func (*StubClientWithCannedResults) FetchResults ¶
func (c *StubClientWithCannedResults) FetchResults(ctx context.Context, t TaskReference) (*FetchResultsResponse, error)
FetchResults implements Client interface.
type TaskReference ¶
type TaskReference string
TaskReference is an implementation-independent way to identify test_runner tasks.
func NewTaskReference ¶
func NewTaskReference() TaskReference
NewTaskReference creates a unique task reference.