From 6a2fb81548063a95bcb3239ee699d8346ef9eccd Mon Sep 17 00:00:00 2001 From: constanca Date: Fri, 6 Dec 2024 20:09:01 +0100 Subject: [PATCH] Remove unused test function --- .../unmarshaler/auto/unmarshaller_test.go | 27 ------------------- .../otlpmetricstream/unmarshaler_test.go | 26 +++--------------- 2 files changed, 4 insertions(+), 49 deletions(-) diff --git a/receiver/awsfirehosereceiver/internal/unmarshaler/auto/unmarshaller_test.go b/receiver/awsfirehosereceiver/internal/unmarshaler/auto/unmarshaller_test.go index ada8178f86af..ffc36c01293e 100644 --- a/receiver/awsfirehosereceiver/internal/unmarshaler/auto/unmarshaller_test.go +++ b/receiver/awsfirehosereceiver/internal/unmarshaler/auto/unmarshaller_test.go @@ -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" @@ -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 -} diff --git a/receiver/awsfirehosereceiver/internal/unmarshaler/otlpmetricstream/unmarshaler_test.go b/receiver/awsfirehosereceiver/internal/unmarshaler/otlpmetricstream/unmarshaler_test.go index 0f5a1ee3c905..3edff7005b82 100644 --- a/receiver/awsfirehosereceiver/internal/unmarshaler/otlpmetricstream/unmarshaler_test.go +++ b/receiver/awsfirehosereceiver/internal/unmarshaler/otlpmetricstream/unmarshaler_test.go @@ -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()) }) } }