taskcluster-worker: github.com/taskcluster/taskcluster-worker/runtime/client Index | Files

package client

import "github.com/taskcluster/taskcluster-worker/runtime/client"

Index

Package Files

auth.go authorizer.go queue.go

Variables

var PostAnyArtifactRequest = mock.MatchedBy(func(i interface{}) bool {
    _, ok := i.(*queue.PostArtifactRequest)
    return ok
})

PostAnyArtifactRequest matches if queue.PostArtifactRequest is called

var PostS3ArtifactRequest = mock.MatchedBy(func(i interface{}) bool {
    r, ok := i.(*queue.PostArtifactRequest)
    if !ok {
        return false
    }
    var s3req queue.S3ArtifactRequest
    if json.Unmarshal(*r, &s3req) != nil {
        return false
    }
    return s3req.StorageType == "s3"
})

PostS3ArtifactRequest matches if queue.PostS3ArtifactRequest is called with an s3 artifact

type Auth Uses

type Auth interface {
    SentryDSN(project string) (*auth.SentryDSNResponse, error)
    StatsumToken(project string) (*auth.StatsumTokenResponse, error)
}

Auth interface covers parts of the auth.Auth client that we use. This allows us to mock the implementation during tests.

type Authorizer Uses

type Authorizer interface {
    SignHeader(method string, URL *url.URL, payload json.RawMessage) (string, error)
    SignURL(URL *url.URL, expiration time.Duration) (*url.URL, error)
    WithAuthorizedScopes(scopes ...string) Authorizer
}

An Authorizer is an interface for an object that can sign a request with taskcluster credentials.

func NewAuthorizer Uses

func NewAuthorizer(getCredentials func() (clientID string, accessToken string, certificate string, err error)) Authorizer

NewAuthorizer returns an authorizer that signs with credntials from getCredentials

type MockAuth Uses

type MockAuth struct {
    mock.Mock
}

MockAuth is a mock implementation of Auth for testing.

func (*MockAuth) SentryDSN Uses

func (m *MockAuth) SentryDSN(project string) (*auth.SentryDSNResponse, error)

SentryDSN is a mock implementation of SentryDSN that calls into m.Mock

func (*MockAuth) StatsumToken Uses

func (m *MockAuth) StatsumToken(project string) (*auth.StatsumTokenResponse, error)

StatsumToken is a mock implementation of StatsumToken that calls into Mock

type MockQueue Uses

type MockQueue struct {
    mock.Mock
}

MockQueue is a mocked TaskCluster queue client. Calls to methods exposed by the queue client will be recorded for assertion later and will respond with the data that was specified during creation of the mocked object.

For more information about each of these client methods, consult the taskcluster-clieng-go/queue package

func (*MockQueue) CancelTask Uses

func (m *MockQueue) CancelTask(taskID string) (*queue.TaskStatusResponse, error)

CancelTask is a mock implementation of github.com/taskcluster/taskcluster-client-go/queue.CancelTask

func (*MockQueue) ClaimTask Uses

func (m *MockQueue) ClaimTask(taskID, runID string, payload *queue.TaskClaimRequest) (*queue.TaskClaimResponse, error)

ClaimTask is a mock implementation of github.com/taskcluster/taskcluster-client-go/queue.ClaimTask

func (*MockQueue) ClaimWork Uses

func (m *MockQueue) ClaimWork(provisionerID, workerType string, payload *queue.ClaimWorkRequest) (*queue.ClaimWorkResponse, error)

ClaimWork is a mock implementation of github.com/taskcluster/taskcluster-client-go/queue#Queue.ClaimWork

func (*MockQueue) CreateArtifact Uses

func (m *MockQueue) CreateArtifact(taskID, runID, name string, payload *queue.PostArtifactRequest) (*queue.PostArtifactResponse, error)

CreateArtifact is a mock implementation of github.com/taskcluster/taskcluster-client-go/queue.CreateArtifact

func (*MockQueue) ExpectRedirectArtifact Uses

func (m *MockQueue) ExpectRedirectArtifact(taskID string, runID int, name string) <-chan string

ExpectRedirectArtifact will setup m to expect a redirect artifact with given name for taskID and runID to be created. This function returns a channel for the url of the redirect artifact.

func (*MockQueue) ExpectS3Artifact Uses

func (m *MockQueue) ExpectS3Artifact(taskID string, runID int, name string) <-chan []byte

ExpectS3Artifact will setup queue to expect an S3 artifact with given name to be created for taskID and runID using m and returns a channel which will receive the artifact.

func (*MockQueue) GetArtifact_SignedURL Uses

func (m *MockQueue) GetArtifact_SignedURL(taskID, runID, name string, duration time.Duration) (*url.URL, error)

GetArtifact_SignedURL is a mock implementation of github.com/taskcluster/taskcluster-client-go/queue.GetArtifact_SignedURL

func (*MockQueue) PollTaskUrls Uses

func (m *MockQueue) PollTaskUrls(provisionerID, workerType string) (*queue.PollTaskUrlsResponse, error)

PollTaskUrls is a mock implementation of github.com/taskcluster/taskcluster-client-go/queue.PollTaskUrls

func (*MockQueue) ReclaimTask Uses

func (m *MockQueue) ReclaimTask(taskID, runID string) (*queue.TaskReclaimResponse, error)

ReclaimTask is a mock implementation of github.com/taskcluster/taskcluster-client-go/queue.ReclaimTask

func (*MockQueue) ReportCompleted Uses

func (m *MockQueue) ReportCompleted(taskID, runID string) (*queue.TaskStatusResponse, error)

ReportCompleted is a mock implementation of github.com/taskcluster/taskcluster-client-go/queue.ReportCompleted

func (*MockQueue) ReportException Uses

func (m *MockQueue) ReportException(taskID, runID string, payload *queue.TaskExceptionRequest) (*queue.TaskStatusResponse, error)

ReportException is a mock implementation of github.com/taskcluster/taskcluster-client-go/queue.ReportException

func (*MockQueue) ReportFailed Uses

func (m *MockQueue) ReportFailed(taskID, runID string) (*queue.TaskStatusResponse, error)

ReportFailed is a mock implementation of github.com/taskcluster/taskcluster-client-go/queue.ReportFailed

func (*MockQueue) ServeHTTP Uses

func (m *MockQueue) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP handles a queue request by calling the mock implemetation

func (*MockQueue) Status Uses

func (m *MockQueue) Status(taskID string) (*queue.TaskStatusResponse, error)

Status is a mock implementation of github.com/taskcluster/taskcluster-client-go/queue.Status

type Queue Uses

type Queue interface {
    Status(string) (*queue.TaskStatusResponse, error)
    ReportCompleted(string, string) (*queue.TaskStatusResponse, error)
    ReportException(string, string, *queue.TaskExceptionRequest) (*queue.TaskStatusResponse, error)
    ReportFailed(string, string) (*queue.TaskStatusResponse, error)
    ClaimTask(string, string, *queue.TaskClaimRequest) (*queue.TaskClaimResponse, error)
    ClaimWork(provisionerID, workerType string, payload *queue.ClaimWorkRequest) (*queue.ClaimWorkResponse, error)
    ReclaimTask(string, string) (*queue.TaskReclaimResponse, error)
    PollTaskUrls(string, string) (*queue.PollTaskUrlsResponse, error)
    CancelTask(string) (*queue.TaskStatusResponse, error)
    CreateArtifact(string, string, string, *queue.PostArtifactRequest) (*queue.PostArtifactResponse, error)
    GetArtifact_SignedURL(string, string, string, time.Duration) (*url.URL, error) // nolint
}

Queue is an interface to the Queue client provided by the taskcluster-client-go package. Passing around an interface allows the queue client to be mocked

Package client imports 20 packages (graph) and is imported by 6 packages. Updated 2017-06-26. Refresh now. Tools for package owners.