fakequeue

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2018 License: MPL-2.0 Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package fakequeue provides a fake implementation of taskcluster-queue in golang, The FakeQueue server stores tasks in-memory, it doesn't validate authentication, but implements most end-points correctly.

The aim of this package is to facilitate integration tests to be executed without dependency on a production deployment of taskcluster-queue. Running integration tests against production is important, but also slow, so being able run them locally without credentials is very nice.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeQueue

type FakeQueue struct {
	// contains filtered or unexported fields
}

FakeQueue is a taskcluster-queue implementation with certain limitations:

  • No validation of authentication or authenorization
  • Data stored in-memory

The FakeQueue supports the following end-points:

  • task
  • status
  • createTask
  • cancelTask
  • claimWork
  • claimTask
  • reclaimTask
  • reportCompleted
  • reportFailed
  • reportException
  • createArtifact
  • getArtifact
  • getLatestArtifact
  • listLatestArtifact
  • pendingTasks

func New

func New() *FakeQueue

New returns a new FakeQueue

func (*FakeQueue) ServeHTTP

func (q *FakeQueue) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Listener

type Listener interface {
	// WaitForTask returns a channel that gets a nil message when taskID is
	// resolved, or an error if listening fails.
	WaitForTask(taskID string) <-chan error
}

Listener provides and interface that allows waiting for task resolution.

This is not intended to be a generic pulse listening interface, it's intended to the minimum subset required to write integration test. This way we can implement it using Pulse/AMQP for integration testing and using FakeQueue for testing without credentials.

func NewFakeQueueListener

func NewFakeQueueListener(q *FakeQueue) Listener

NewFakeQueueListener returns a Listener implementation that waits for tasks to be resolved in the FakeQueue given.

func NewPulseListener

func NewPulseListener(username, password string) (Listener, error)

NewPulseListener creates a listener implementation for production queue using pulse.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL