@@ -87,7 +87,7 @@ func TestCounter(t *testing.T) {
8787mfs , err := registry .Gather ()
8888var buf bytes.Buffer
8989enc := expfmt .NewEncoder (& buf , "text/plain; version=0.0.4; charset=utf-8" )
90- assert .Equalf (t , test .expectedMetricCount , len ( mfs ) , "Got %v metrics, Want: %v metrics" , len (mfs ), test .expectedMetricCount )
90+ assert .Lenf (t , mfs , test .expectedMetricCount , "Got %v metrics, Want: %v metrics" , len (mfs ), test .expectedMetricCount )
9191assert .Nil (t , err , "Gather failed %v" , err )
9292for _ , metric := range mfs {
9393err := enc .Encode (metric )
@@ -186,12 +186,12 @@ func TestCounterVec(t *testing.T) {
186186registry .MustRegister (c )
187187c .WithLabelValues ("1" , "2" ).Inc ()
188188mfs , err := registry .Gather ()
189- assert .Equalf (t , test .expectedMetricFamilyCount , len ( mfs ) , "Got %v metric families, Want: %v metric families" , len (mfs ), test .expectedMetricFamilyCount )
189+ assert .Lenf (t , mfs , test .expectedMetricFamilyCount , "Got %v metric families, Want: %v metric families" , len (mfs ), test .expectedMetricFamilyCount )
190190assert .Nil (t , err , "Gather failed %v" , err )
191191
192192// this no-opts here when there are no metric families (i.e. when the metric is hidden)
193193for _ , mf := range mfs {
194- assert .Equalf (t , 1 , len ( mf .GetMetric ()) , "Got %v metrics, wanted 1 as the count" , len (mf .GetMetric ()))
194+ assert .Lenf (t , mf .GetMetric (), 1 , "Got %v metrics, wanted 1 as the count" , len (mf .GetMetric ()))
195195assert .Equalf (t , test .expectedHelp , mf .GetHelp (), "Got %s as help message, want %s" , mf .GetHelp (), test .expectedHelp )
196196}
197197
@@ -203,7 +203,7 @@ func TestCounterVec(t *testing.T) {
203203
204204// this no-opts here when there are no metric families (i.e. when the metric is hidden)
205205for _ , mf := range mfs {
206- assert .Equalf (t , 3 , len ( mf .GetMetric ()) , "Got %v metrics, wanted 3 as the count" , len (mf .GetMetric ()))
206+ assert .Lenf (t , mf .GetMetric (), 3 , "Got %v metrics, wanted 3 as the count" , len (mf .GetMetric ()))
207207}
208208})
209209}
0 commit comments