taskcluster-worker: github.com/taskcluster/taskcluster-worker/runtime/mocks Index | Files

package mocks

import "github.com/taskcluster/taskcluster-worker/runtime/mocks"

Package mocks contains mock implementations of various interfaces useful for writing unit-tests.

Index

Package Files

doc.go mockmonitor.go

type MockMonitor Uses

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

MockMonitor implements runtime.Monitor for use in unit tests.

func NewMockMonitor Uses

func NewMockMonitor(panicOnError bool) *MockMonitor

NewMockMonitor returns a Monitor that prints all messages using util.Debug() meaning that you must set environment variable DEBUG='monitor' to see the messages.

If panicOnError is set this will panic if Error() or reportError() is called. This is often useful for testing components that takes a Monitor as argument.

func (*MockMonitor) CapturePanic Uses

func (m *MockMonitor) CapturePanic(fn func()) (incidentID string)

CapturePanic recovers from panic in fn and returns incidentID, if any

func (*MockMonitor) Count Uses

func (m *MockMonitor) Count(name string, value float64)

Count incrments counter by name with given value

func (*MockMonitor) Debug Uses

func (m *MockMonitor) Debug(a ...interface{})

Debug writes a debug message

func (*MockMonitor) Debugf Uses

func (m *MockMonitor) Debugf(f string, a ...interface{})

Debugf writes debug message labelled as Debug

func (*MockMonitor) Debugln Uses

func (m *MockMonitor) Debugln(a ...interface{})

Debugln writes a debug message

func (*MockMonitor) Error Uses

func (m *MockMonitor) Error(a ...interface{})

Error writes debug message labelled as Error, and panics if panicOnError was set

func (*MockMonitor) Errorf Uses

func (m *MockMonitor) Errorf(f string, a ...interface{})

Errorf writes debug message labelled as Error, and panics if panicOnError was set

func (*MockMonitor) Errorln Uses

func (m *MockMonitor) Errorln(a ...interface{})

Errorln writes debug message labelled as Error, and panics if panicOnError was set

func (*MockMonitor) HasCounter Uses

func (m *MockMonitor) HasCounter(name string) bool

HasCounter returns true if a counter with given name has been reported

func (*MockMonitor) HasMeasure Uses

func (m *MockMonitor) HasMeasure(name string) bool

HasMeasure returns true if a measure with given name has been reported

func (*MockMonitor) Info Uses

func (m *MockMonitor) Info(a ...interface{})

Info writes debug message labelled as Info

func (*MockMonitor) Infof Uses

func (m *MockMonitor) Infof(f string, a ...interface{})

Infof writes debug message labelled as Info

func (*MockMonitor) Infoln Uses

func (m *MockMonitor) Infoln(a ...interface{})

Infoln writes debug message labelled as Info

func (*MockMonitor) Measure Uses

func (m *MockMonitor) Measure(name string, value ...float64)

Measure records values for given name

func (*MockMonitor) Panic Uses

func (m *MockMonitor) Panic(a ...interface{})

Panic writes debug message labelled as Panic, and panics

func (*MockMonitor) Panicf Uses

func (m *MockMonitor) Panicf(f string, a ...interface{})

Panicf writes debug message labelled as Panic, and panics

func (*MockMonitor) Panicln Uses

func (m *MockMonitor) Panicln(a ...interface{})

Panicln writes debug message labelled as Panic, and panics

func (*MockMonitor) Print Uses

func (m *MockMonitor) Print(a ...interface{})

Print writes debug message labelled as Print

func (*MockMonitor) Printf Uses

func (m *MockMonitor) Printf(f string, a ...interface{})

Printf writes debug message labelled as Print

func (*MockMonitor) Println Uses

func (m *MockMonitor) Println(a ...interface{})

Println writes debug message labelled as Print

func (*MockMonitor) ReportError Uses

func (m *MockMonitor) ReportError(err error, message ...interface{}) string

ReportError records an error, and panics if panicOnError was set

func (*MockMonitor) ReportWarning Uses

func (m *MockMonitor) ReportWarning(err error, message ...interface{}) string

ReportWarning logs a warning

func (*MockMonitor) Time Uses

func (m *MockMonitor) Time(name string, fn func())

Time measures and records the execution time of fn

func (*MockMonitor) Warn Uses

func (m *MockMonitor) Warn(a ...interface{})

Warn writes debug message labelled as Warn

func (*MockMonitor) Warnf Uses

func (m *MockMonitor) Warnf(f string, a ...interface{})

Warnf writes debug message labelled as Warn

func (*MockMonitor) Warnln Uses

func (m *MockMonitor) Warnln(a ...interface{})

Warnln writes debug message labelled as Warn

func (*MockMonitor) WithPrefix Uses

func (m *MockMonitor) WithPrefix(prefix string) runtime.Monitor

WithPrefix creates a new child Monitor with given prefix

func (*MockMonitor) WithTag Uses

func (m *MockMonitor) WithTag(key, value string) runtime.Monitor

WithTag creates a new child Monitor with given tag

func (*MockMonitor) WithTags Uses

func (m *MockMonitor) WithTags(tags map[string]string) runtime.Monitor

WithTags creates a new child Monitor with given tags

Package mocks imports 9 packages (graph) and is imported by 4 packages. Updated 2017-04-24. Refresh now. Tools for package owners.