mock

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2018 License: MIT Imports: 5 Imported by: 0 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

Index

Constants

This section is empty.

Variables

View Source
var (
	// Now is the date used in all stub date fields.
	Now = time.Now()
	// StubProject is a Project stub.
	StubProject = &brigade.Project{
		ID:           "project-id",
		Name:         "project-name",
		SharedSecret: "shared-secre3t",
		Secrets:      map[string]string{"key": "value"},
	}
	// StubWorker is a stub Worker. It is used in StubBuild, too.
	StubWorker = &brigade.Worker{
		ID:        "worker-id",
		BuildID:   "build-id",
		ProjectID: "project-id",
		StartTime: Now,
		EndTime:   Now,
		ExitCode:  0,
		Status:    brigade.JobSucceeded,
	}
	// StubBuild is a stub Build.
	StubBuild = &brigade.Build{
		ID:        "build-id",
		ProjectID: "project-id",
		Revision: &brigade.Revision{
			Commit: "commit",
		},
		Type:     "type",
		Provider: "provider",
		Payload:  []byte("payload"),
		Script:   []byte("script"),
		Worker:   StubWorker,
	}
	// StubJob is a stub Job.
	StubJob = &brigade.Job{
		ID:           "job-id",
		Name:         "job-name",
		Image:        "image",
		CreationTime: Now,
		StartTime:    Now,
		EndTime:      Now,
		ExitCode:     0,
		Status:       brigade.JobSucceeded,
	}
	// StubLogData is string data representing a log
	StubLogData = "Hello World"
)

Functions

This section is empty.

Types

type Store

type Store struct {
	// Project is the project you want returned.
	Project *brigade.Project
	// Build is the build you want returned.
	Build *brigade.Build
	// Job is the job you want returned.
	Job *brigade.Job
	// Worker is the worker you want returned.
	Worker *brigade.Worker
	// LogData is the log data you want returned.
	LogData string
}

Store implements the storage.Storage interface, but returns mock data.

func New

func New() *Store

New returns a new Store with the default stubs.

func (*Store) CreateBuild

func (s *Store) CreateBuild(b *brigade.Build) error

CreateBuild fakes a new build.

func (*Store) GetBuild

func (s *Store) GetBuild(id string) (*brigade.Build, error)

GetBuild gets the mock Build

func (*Store) GetBuildJobs

func (s *Store) GetBuildJobs(b *brigade.Build) ([]*brigade.Job, error)

GetBuildJobs gets the mock job wrapped in a slice.

func (*Store) GetBuilds

func (s *Store) GetBuilds() ([]*brigade.Build, error)

GetBuilds returns the mock build wrapped in a slice.

func (*Store) GetJob

func (s *Store) GetJob(id string) (*brigade.Job, error)

GetJob gets the mock job.

func (*Store) GetJobLog

func (s *Store) GetJobLog(j *brigade.Job) (string, error)

GetJobLog gets the mock log data

func (*Store) GetJobLogStream

func (s *Store) GetJobLogStream(j *brigade.Job) (io.ReadCloser, error)

GetJobLogStream gets the mock log data as a readcloser

func (*Store) GetProject

func (s *Store) GetProject(id string) (*brigade.Project, error)

GetProject returns the Project

func (*Store) GetProjectBuilds

func (s *Store) GetProjectBuilds(p *brigade.Project) ([]*brigade.Build, error)

GetProjectBuilds returns the mock Build wrapped in a slice.

func (*Store) GetProjects

func (s *Store) GetProjects() ([]*brigade.Project, error)

GetProjects gets the mock project wrapped as a slice of projects.

func (*Store) GetWorker

func (s *Store) GetWorker(bid string) (*brigade.Worker, error)

GetWorker gets the mock worker.

func (*Store) GetWorkerLog

func (s *Store) GetWorkerLog(w *brigade.Worker) (string, error)

GetWorkerLog gets the mock log data.

func (*Store) GetWorkerLogStream

func (s *Store) GetWorkerLogStream(w *brigade.Worker) (io.ReadCloser, error)

GetWorkerLogStream gets a readcloser of the mock log data.

Jump to

Keyboard shortcuts

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