Permalink
Browse files

registry: add a basic test to detect v2 metrics

  • Loading branch information...
1 parent 964431a commit 4a78504a4cd6b3b24d22b6a8c78a4d6c34b6cd10 @suyash suyash committed Aug 5, 2016
Showing with 16 additions and 0 deletions.
  1. +16 −0 registry_test.go
View
@@ -128,3 +128,19 @@ func TestStringInstanceConstruction(t *testing.T) {
t.Errorf("Expected Value Count to be 3, got %v", r.ValuesCount())
}
}
+
+func TestMMVV2MetricRegistration(t *testing.T) {
+ r := NewPCPRegistry()
+
+ m, err := NewPCPSingletonMetric(10, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz", Int32Type, CounterSemantics, OneUnit)
+ if err != nil {
+ t.Errorf("cannot create metric, error: %v", err)
+ return
+ }
+
+ r.AddMetric(m)
+
+ if r.stringcount != 1 {
+ t.Errorf("expected the metric name to be registered in the strings section")
+ }
+}

0 comments on commit 4a78504

Please sign in to comment.