client

package
v0.1.20 Latest Latest
Warning

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

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

This section is empty.

Types

type Auth added in v0.0.11

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 added in v0.1.3

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 added in v0.1.3

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 added in v0.0.11

type MockAuth struct {
	mock.Mock
}

MockAuth is a mock implementation of Auth for testing.

func (*MockAuth) SentryDSN added in v0.0.11

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

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

func (*MockAuth) StatsumToken added in v0.0.11

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 {
	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

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

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

func (*MockQueue) ClaimTask

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

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

func (*MockQueue) ClaimWork added in v0.1.0

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

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

func (*MockQueue) CreateArtifact

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

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

func (*MockQueue) ExpectRedirectArtifact added in v0.0.5

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 added in v0.0.5

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 added in v0.1.3

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/tcqueue.GetArtifact_SignedURL

func (*MockQueue) PollTaskUrls

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

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

func (*MockQueue) ReclaimTask

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

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

func (*MockQueue) ReportCompleted

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

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

func (*MockQueue) ReportException

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

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

func (*MockQueue) ReportFailed

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

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

func (*MockQueue) ServeHTTP added in v0.1.0

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

ServeHTTP handles a queue request by calling the mock implemetation

func (*MockQueue) Status added in v0.1.0

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

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

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
y or Y : Canonical URL