mirror of https://github.com/knative/pkg.git
Fix metrics test reentrance (#1680)
if we clean the view we get success. Also verify initial size is 0
This commit is contained in:
parent
2ee0e98803
commit
b0307fc6d2
|
|
@ -402,7 +402,13 @@ func TestMetricFetch(t *testing.T) {
|
|||
TagKeys: []tag.Key{tagKey},
|
||||
}
|
||||
|
||||
m := GetMetric("count")
|
||||
if len(m) != 0 {
|
||||
t.Errorf("Unexpected number of found metrics (%d): %+v", len(m), m)
|
||||
}
|
||||
|
||||
view.Register(countView)
|
||||
t.Cleanup(func() { view.Unregister(countView) })
|
||||
|
||||
ctx, err := tag.New(context.Background(), tag.Upsert(tagKey, "alpha"))
|
||||
if err != nil {
|
||||
|
|
@ -420,8 +426,8 @@ func TestMetricFetch(t *testing.T) {
|
|||
}
|
||||
stats.Record(ctx, count.M(20))
|
||||
EnsureRecorded()
|
||||
m := GetMetric("count")
|
||||
|
||||
m = GetMetric("count")
|
||||
if len(m) != 1 {
|
||||
t.Errorf("Unexpected number of found metrics (%d): %+v", len(m), m)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue