@@ -24,7 +24,6 @@ import (
24
24
25
25
"github.com/prometheus/common/model"
26
26
"github.com/prometheus/otlptranslator"
27
- "github.com/stretchr/testify/assert"
28
27
"github.com/stretchr/testify/require"
29
28
"go.opentelemetry.io/collector/pdata/pcommon"
30
29
"go.opentelemetry.io/collector/pdata/pmetric"
@@ -380,8 +379,8 @@ func TestConvertBucketsLayout(t *testing.T) {
380
379
for scaleDown , wantLayout := range tt .wantLayout {
381
380
t .Run (fmt .Sprintf ("%s-scaleby-%d" , tt .name , scaleDown ), func (t * testing.T ) {
382
381
gotSpans , gotDeltas := convertBucketsLayout (tt .buckets ().BucketCounts ().AsRaw (), tt .buckets ().Offset (), scaleDown , true )
383
- assert .Equal (t , wantLayout .wantSpans , gotSpans )
384
- assert .Equal (t , wantLayout .wantDeltas , gotDeltas )
382
+ require .Equal (t , wantLayout .wantSpans , gotSpans )
383
+ require .Equal (t , wantLayout .wantDeltas , gotDeltas )
385
384
})
386
385
}
387
386
}
@@ -569,13 +568,13 @@ func TestExponentialToNativeHistogram(t *testing.T) {
569
568
validateExponentialHistogramCount (t , tt .exponentialHist ()) // Sanity check.
570
569
got , annots , err := exponentialToNativeHistogram (tt .exponentialHist ())
571
570
if tt .wantErrMessage != "" {
572
- assert .ErrorContains (t , err , tt .wantErrMessage )
571
+ require .ErrorContains (t , err , tt .wantErrMessage )
573
572
return
574
573
}
575
574
576
575
require .NoError (t , err )
577
576
require .Empty (t , annots )
578
- assert .Equal (t , tt .wantNativeHist (), got )
577
+ require .Equal (t , tt .wantNativeHist (), got )
579
578
validateNativeHistogramCount (t , got )
580
579
})
581
580
}
@@ -617,7 +616,7 @@ func validateNativeHistogramCount(t *testing.T, h prompb.Histogram) {
617
616
prevBucket += delta
618
617
actualCount += uint64 (prevBucket )
619
618
}
620
- assert .Equal (t , want , actualCount , "native histogram count mismatch" )
619
+ require .Equal (t , want , actualCount , "native histogram count mismatch" )
621
620
}
622
621
623
622
func TestPrometheusConverter_addExponentialHistogramDataPoints (t * testing.T ) {
@@ -774,8 +773,8 @@ func TestPrometheusConverter_addExponentialHistogramDataPoints(t *testing.T) {
774
773
require .NoError (t , err )
775
774
require .Empty (t , annots )
776
775
777
- assert .Equal (t , tt .wantSeries (), converter .unique )
778
- assert .Empty (t , converter .conflicts )
776
+ require .Equal (t , tt .wantSeries (), converter .unique )
777
+ require .Empty (t , converter .conflicts )
779
778
})
780
779
}
781
780
}
@@ -814,7 +813,7 @@ func TestConvertExplicitHistogramBucketsToNHCBLayout(t *testing.T) {
814
813
},
815
814
{
816
815
name : "trailing empty buckets" ,
817
- buckets : []uint64 {0 , 0 , 1 , 1 , 2 , 3 , 0 , 0 }, //TODO: add tests for 3 trailing buckets
816
+ buckets : []uint64 {0 , 0 , 1 , 1 , 2 , 3 , 0 , 0 }, // TODO: add tests for 3 trailing buckets
818
817
wantLayout : expectedBucketLayout {
819
818
wantSpans : []prompb.BucketSpan {
820
819
{
@@ -880,8 +879,8 @@ func TestConvertExplicitHistogramBucketsToNHCBLayout(t *testing.T) {
880
879
bucketCounts := buckets [offset :]
881
880
882
881
gotSpans , gotDeltas := convertBucketsLayout (bucketCounts , int32 (offset ), 0 , false )
883
- assert .Equal (t , tt .wantLayout .wantSpans , gotSpans )
884
- assert .Equal (t , tt .wantLayout .wantDeltas , gotDeltas )
882
+ require .Equal (t , tt .wantLayout .wantSpans , gotSpans )
883
+ require .Equal (t , tt .wantLayout .wantDeltas , gotDeltas )
885
884
})
886
885
}
887
886
}
@@ -975,13 +974,13 @@ func TestHistogramToCustomBucketsHistogram(t *testing.T) {
975
974
validateHistogramCount (t , tt .hist ())
976
975
got , annots , err := explicitHistogramToCustomBucketsHistogram (tt .hist ())
977
976
if tt .wantErrMessage != "" {
978
- assert .ErrorContains (t , err , tt .wantErrMessage )
977
+ require .ErrorContains (t , err , tt .wantErrMessage )
979
978
return
980
979
}
981
980
982
981
require .NoError (t , err )
983
982
require .Empty (t , annots )
984
- assert .Equal (t , tt .wantNativeHist (), got )
983
+ require .Equal (t , tt .wantNativeHist (), got )
985
984
validateNativeHistogramCount (t , got )
986
985
})
987
986
}
@@ -1143,8 +1142,8 @@ func TestPrometheusConverter_addCustomBucketsHistogramDataPoints(t *testing.T) {
1143
1142
require .NoError (t , err )
1144
1143
require .Empty (t , annots )
1145
1144
1146
- assert .Equal (t , tt .wantSeries (), converter .unique )
1147
- assert .Empty (t , converter .conflicts )
1145
+ require .Equal (t , tt .wantSeries (), converter .unique )
1146
+ require .Empty (t , converter .conflicts )
1148
1147
})
1149
1148
}
1150
1149
}
0 commit comments