testutil

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2015 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLocalHost added in v0.1.4

func GetLocalHost() string

GetLocalHost returns the DOCKER_HOST environment variable, parsing out any scheme or ports so that only the IP address is returned.

func MockBatchPoints added in v0.1.7

func MockBatchPoints() client.BatchPoints

MockBatchPoints returns a mock BatchPoints object for using in unit tests of telegraf output sinks.

Types

type Accumulator

type Accumulator struct {
	Points []*Point
}

Accumulator defines a mocked out accumulator

func (*Accumulator) Add

func (a *Accumulator) Add(measurement string, value interface{}, tags map[string]string)

Add adds a measurement point to the accumulator

func (*Accumulator) AddValuesWithTime

func (a *Accumulator) AddValuesWithTime(
	measurement string,
	values map[string]interface{},
	tags map[string]string,
	timestamp time.Time,
)

AddValuesWithTime adds a measurement point with a specified timestamp.

func (*Accumulator) CheckTaggedValue

func (a *Accumulator) CheckTaggedValue(
	measurement string,
	val interface{},
	tags map[string]string,
) bool

CheckTaggedValue calls ValidateTaggedValue

func (*Accumulator) CheckValue

func (a *Accumulator) CheckValue(measurement string, val interface{}) bool

CheckValue checks that the accumulators point for the given measurement is the same as the given value.

func (*Accumulator) Get

func (a *Accumulator) Get(measurement string) (*Point, bool)

Get gets the specified measurement point from the accumulator

func (*Accumulator) HasFloatValue

func (a *Accumulator) HasFloatValue(measurement string) bool

HasFloatValue returns true if the given measurement has a float value

func (*Accumulator) HasIntValue

func (a *Accumulator) HasIntValue(measurement string) bool

HasIntValue returns true if the measurement has an Int value

func (*Accumulator) HasUIntValue added in v0.1.4

func (a *Accumulator) HasUIntValue(measurement string) bool

HasUIntValue returns true if the measurement has a UInt value

func (*Accumulator) ValidateTaggedValue

func (a *Accumulator) ValidateTaggedValue(
	measurement string,
	val interface{},
	tags map[string]string,
) error

ValidateTaggedValue validates that the given measurement and value exist in the accumulator and with the given tags.

func (*Accumulator) ValidateValue

func (a *Accumulator) ValidateValue(measurement string, val interface{}) error

ValidateValue calls ValidateTaggedValue

type Point

type Point struct {
	Measurement string
	Tags        map[string]string
	Values      map[string]interface{}
	Time        time.Time
}

Point defines a single point measurement

Jump to

Keyboard shortcuts

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