Documentation ¶
Index ¶
- func EntityMetricIs(e *integration.Entity, metricName string, metricValue interface{}) bool
- func EntityMetricTypeIs(e *integration.Entity, metricName string, metricType metric.SourceType) bool
- type Asserter
- func (a Asserter) Assert(t *testing.T)
- func (a Asserter) Excluding(excludeFuncs ...exclude.Func) Asserter
- func (a Asserter) ExcludingGroups(groupNames ...string) Asserter
- func (a Asserter) On(entities []*integration.Entity) Asserter
- func (a Asserter) Silently() Asserter
- func (a Asserter) Using(groups definition.SpecGroups) Asserter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EntityMetricIs ¶
func EntityMetricIs(e *integration.Entity, metricName string, metricValue interface{}) bool
EntityMetricIs returns true if the specified entity has a metric named metricName equal to metricValue.
func EntityMetricTypeIs ¶
func EntityMetricTypeIs(e *integration.Entity, metricName string, metricType metric.SourceType) bool
EntityMetricTypeIs returns true if supplied entity has metric named metricName with type _similar_ to metricType.
Types ¶
type Asserter ¶
type Asserter struct {
// contains filtered or unexported fields
}
Asserter is a helper for checking whether an integration contains all the metrics defined in a specGroup. It provides a chainable API, with each call returning a copy of the asserter. This way, successive calls to the chainable methods do not modify the previous Asserter, allowing to reuse the chain as a test fans out. Asserter is safe to use concurrently.
func (Asserter) Assert ¶
Assert checks whether all metrics defined in the supplied groups are present, and fails the test if any is not. Assert will fail the test if:
- No entity at all exists with a type matching a specGroup, unless this specGroup is ignored using ExcludingGroups.
- Any entity whose type matches a specGroup lacks any metric defined in the specGroup, unless any Func returns true for that particular groupName, metric, and entity.
func (Asserter) Excluding ¶
Excluding returns an asserter that will not fail for a missing metric for which any of the supplied Func return true. For ignoring whole spec groups, use ExcludingGroups instead. Missing metrics are still logged, unless Silently is used.
func (Asserter) ExcludingGroups ¶
ExcludingGroups returns an asserter configured to completely exclude the supplied groups. Unlike Excluding, ExcludingGroups will ignore the group _before_ checking if there are any entities at all matching the group, an scenario that would make the asserter fail if the group is not excluded this way.
func (Asserter) On ¶
func (a Asserter) On(entities []*integration.Entity) Asserter
On returns an asserter configured to check for existence on the supplied entities.
func (Asserter) Silently ¶
Silently returns an asserter that will not log optional or excepted metrics
func (Asserter) Using ¶
func (a Asserter) Using(groups definition.SpecGroups) Asserter
Using returns an asserter that will use the supplied specGroups to assert entities.