Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Commit

Permalink
add instrumentation test helpers
Browse files Browse the repository at this point in the history
[#75375442]

Signed-off-by: Joseph Rodriguez <jrodriguez@pivotallabs.com>
  • Loading branch information
Johannes Petzold committed Aug 8, 2014
1 parent 74a795a commit 5c258c6
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions cfcomponent/instrumentation/testhelpers/testhelpers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package testhelpers

import "github.com/cloudfoundry/loggregatorlib/cfcomponent/instrumentation"
import . "github.com/onsi/gomega"

func MetricValue(instrumentable instrumentation.Instrumentable, name string) interface{} {
for _, metric := range instrumentable.Emit().Metrics {
if metric.Name == name {
return metric.Value
}
}
return nil
}

func EventuallyExpectMetric(instrumentable instrumentation.Instrumentable, name string, value uint64) {
Eventually(func() interface{} {
return MetricValue(instrumentable, name)
}).Should(Equal(value))
}

0 comments on commit 5c258c6

Please sign in to comment.