Documentation ¶
Index ¶
- Variables
- type Auth
- type Authorizer
- type MockAuth
- type MockQueue
- func (m *MockQueue) CancelTask(taskID string) (*tcqueue.TaskStatusResponse, error)
- func (m *MockQueue) ClaimTask(taskID, runID string, payload *tcqueue.TaskClaimRequest) (*tcqueue.TaskClaimResponse, error)
- func (m *MockQueue) ClaimWork(provisionerID, workerType string, payload *tcqueue.ClaimWorkRequest) (*tcqueue.ClaimWorkResponse, error)
- func (m *MockQueue) CreateArtifact(taskID, runID, name string, payload *tcqueue.PostArtifactRequest) (*tcqueue.PostArtifactResponse, error)
- func (m *MockQueue) ExpectRedirectArtifact(taskID string, runID int, name string) <-chan string
- func (m *MockQueue) ExpectS3Artifact(taskID string, runID int, name string) <-chan []byte
- func (m *MockQueue) GetArtifact_SignedURL(taskID, runID, name string, duration time.Duration) (*url.URL, error)
- func (m *MockQueue) PollTaskUrls(provisionerID, workerType string) (*tcqueue.PollTaskUrlsResponse, error)
- func (m *MockQueue) ReclaimTask(taskID, runID string) (*tcqueue.TaskReclaimResponse, error)
- func (m *MockQueue) ReportCompleted(taskID, runID string) (*tcqueue.TaskStatusResponse, error)
- func (m *MockQueue) ReportException(taskID, runID string, payload *tcqueue.TaskExceptionRequest) (*tcqueue.TaskStatusResponse, error)
- func (m *MockQueue) ReportFailed(taskID, runID string) (*tcqueue.TaskStatusResponse, error)
- func (m *MockQueue) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (m *MockQueue) Status(taskID string) (*tcqueue.TaskStatusResponse, error)
- type Queue
Constants ¶
This section is empty.
Variables ¶
var PostAnyArtifactRequest = mock.MatchedBy(func(i interface{}) bool { _, ok := i.(*tcqueue.PostArtifactRequest) return ok })
PostAnyArtifactRequest matches if tcqueue.PostArtifactRequest is called
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
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 ¶
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
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
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
type Queue ¶
type Queue interface { Status(string) (*tcqueue.TaskStatusResponse, error) ReportCompleted(string, string) (*tcqueue.TaskStatusResponse, error) ReportException(string, string, *tcqueue.TaskExceptionRequest) (*tcqueue.TaskStatusResponse, error) ReportFailed(string, string) (*tcqueue.TaskStatusResponse, error) ClaimTask(string, string, *tcqueue.TaskClaimRequest) (*tcqueue.TaskClaimResponse, error) ClaimWork(provisionerID, workerType string, payload *tcqueue.ClaimWorkRequest) (*tcqueue.ClaimWorkResponse, error) ReclaimTask(string, string) (*tcqueue.TaskReclaimResponse, error) PollTaskUrls(string, string) (*tcqueue.PollTaskUrlsResponse, error) CancelTask(string) (*tcqueue.TaskStatusResponse, error) CreateArtifact(string, string, string, *tcqueue.PostArtifactRequest) (*tcqueue.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