Version: v0.1.20 Latest Latest

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

Go to latest
Published: Jul 3, 2018 License: MPL-2.0 Imports: 20 Imported by: 0




This section is empty.


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

PostAnyArtifactRequest matches if tcqueue.PostArtifactRequest is called

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

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


This section is empty.


type Auth

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

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

type Authorizer

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

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

type MockAuth struct {

MockAuth is a mock implementation of Auth for testing.

func (*MockAuth) SentryDSN

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

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

func (*MockAuth) StatsumToken

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

StatsumToken is a mock implementation of StatsumToken that calls into Mock

type MockQueue

type MockQueue struct {

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

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

CancelTask is a mock implementation of

func (*MockQueue) ClaimTask

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

ClaimTask is a mock implementation of

func (*MockQueue) ClaimWork

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

ClaimWork is a mock implementation of

func (*MockQueue) CreateArtifact

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

CreateArtifact is a mock implementation of

func (*MockQueue) ExpectRedirectArtifact

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

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

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

GetArtifact_SignedURL is a mock implementation of

func (*MockQueue) PollTaskUrls

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

PollTaskUrls is a mock implementation of

func (*MockQueue) ReclaimTask

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

ReclaimTask is a mock implementation of

func (*MockQueue) ReportCompleted

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

ReportCompleted is a mock implementation of

func (*MockQueue) ReportException

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

ReportException is a mock implementation of

func (*MockQueue) ReportFailed

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

ReportFailed is a mock implementation of

func (*MockQueue) ServeHTTP

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

ServeHTTP handles a queue request by calling the mock implemetation

func (*MockQueue) Status

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

Status is a mock implementation of

type Queue

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto