Skip to content

Commit

Permalink
Remove unused test function
Browse files Browse the repository at this point in the history
  • Loading branch information
constanca-m committed Dec 6, 2024
1 parent 5a842e8 commit 6a2fb81
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@ import (
"os"
"path/filepath"
"testing"
"time"

"github.com/gogo/protobuf/proto"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/pdata/pcommon"
"go.opentelemetry.io/collector/pdata/pmetric/pmetricotlp"
"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/compression"
Expand Down Expand Up @@ -113,26 +109,3 @@ func TestUnmarshal_CW(t *testing.T) {
}

}

func createMetricRecord() []byte {
er := pmetricotlp.NewExportRequest()
rsm := er.Metrics().ResourceMetrics().AppendEmpty()
sm := rsm.ScopeMetrics().AppendEmpty().Metrics().AppendEmpty()
sm.SetName("TestMetric")
dp := sm.SetEmptySummary().DataPoints().AppendEmpty()
dp.SetCount(1)
dp.SetSum(1)
qv := dp.QuantileValues()
min := qv.AppendEmpty()
min.SetQuantile(0)
min.SetValue(0)
max := qv.AppendEmpty()
max.SetQuantile(1)
max.SetValue(1)
dp.SetTimestamp(pcommon.NewTimestampFromTime(time.Now()))

temp, _ := er.MarshalProto()
record := proto.EncodeVarint(uint64(len(temp)))
record = append(record, temp...)
return record
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,28 +98,10 @@ func TestUnmarshal(t *testing.T) {
for name, testCase := range testCases {
t.Run(name, func(t *testing.T) {
got, err := unmarshaler.Unmarshal(testCase.records)
if testCase.wantErr != nil {
require.Error(t, err)
require.Equal(t, testCase.wantErr, err)
} else {
require.NoError(t, err)
require.NotNil(t, got)
require.Equal(t, testCase.wantResourceCount, got.ResourceMetrics().Len())
gotMetricCount := 0
gotDatapointCount := 0
for i := 0; i < got.ResourceMetrics().Len(); i++ {
rm := got.ResourceMetrics().At(i)
require.Equal(t, 1, rm.ScopeMetrics().Len())
ilm := rm.ScopeMetrics().At(0)
gotMetricCount += ilm.Metrics().Len()
for j := 0; j < ilm.Metrics().Len(); j++ {
metric := ilm.Metrics().At(j)
gotDatapointCount += metric.Summary().DataPoints().Len()
}
}
require.Equal(t, testCase.wantMetricCount, gotMetricCount)
require.Equal(t, testCase.wantDatapointCount, gotDatapointCount)
}
require.NoError(t, err)
require.Equal(t, testCase.wantResourceCount, got.ResourceMetrics().Len())
require.Equal(t, testCase.wantMetricCount, got.MetricCount())
require.Equal(t, testCase.wantDatapointCount, got.DataPointCount())
})
}
}

0 comments on commit 6a2fb81

Please sign in to comment.