Skip to content

Commit

Permalink
[chore][exporter/datadog] Replace internal testutil (#34158)
Browse files Browse the repository at this point in the history
`exporter/datadogexporter/internal/testutil` was copied to
`github.com/DataDog/datadog-agent/comp/otelcol/otlp/testutil` in
DataDog/datadog-agent#27681 so that it can be
used in Agent. This PR cleans up the internal fork and uses
`github.com/DataDog/datadog-agent/comp/otelcol/otlp/testutil` in both
repos.
  • Loading branch information
songy23 authored Jul 19, 2024
1 parent d865b6e commit fbdcea4
Show file tree
Hide file tree
Showing 22 changed files with 37 additions and 634 deletions.
2 changes: 1 addition & 1 deletion cmd/otelcontribcol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ require (
github.com/ovh/go-ovh v1.5.1 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/paulmach/orb v0.11.1 // indirect
github.com/pelletier/go-toml v1.9.3 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/philhofer/fwd v1.1.3-0.20240612014219-fbbf4953d986 // indirect
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
Expand Down
7 changes: 4 additions & 3 deletions cmd/otelcontribcol/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion connector/datadogconnector/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ require (
github.com/openshift/api v3.9.0+incompatible // indirect
github.com/openshift/client-go v0.0.0-20210521082421-73d9475a9142 // indirect
github.com/outcaste-io/ristretto v0.2.1 // indirect
github.com/pelletier/go-toml v1.2.0 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/philhofer/fwd v1.1.2 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
Expand Down
9 changes: 4 additions & 5 deletions connector/datadogconnector/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion exporter/datadogexporter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"testing"
"time"

"github.com/DataDog/datadog-agent/comp/otelcol/otlp/testutil"
"github.com/DataDog/opentelemetry-mapping-go/pkg/inframetadata"
"github.com/DataDog/opentelemetry-mapping-go/pkg/inframetadata/payload"
"github.com/stretchr/testify/assert"
Expand All @@ -27,7 +28,6 @@ import (
"go.uber.org/zap/zaptest"

"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/metadata"
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/testutil"
)

var _ inframetadata.Pusher = (*testPusher)(nil)
Expand Down
5 changes: 3 additions & 2 deletions exporter/datadogexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ require (
github.com/DataDog/datadog-agent/comp/otelcol/logsagentpipeline/logsagentpipelineimpl v0.56.0-rc.4
github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/exporter/logsagentexporter v0.56.0-rc.4
github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/metricsclient v0.56.0-rc.4
github.com/DataDog/datadog-agent/comp/otelcol/otlp/testutil v0.57.0-devel.0.20240718200853-81bf3b2e412d
github.com/DataDog/datadog-agent/comp/trace/compression/impl-gzip v0.56.0-rc.4
github.com/DataDog/datadog-agent/pkg/config/model v0.56.0-rc.4
github.com/DataDog/datadog-agent/pkg/config/setup v0.56.0-rc.4
Expand All @@ -34,7 +35,7 @@ require (
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/logs v0.17.0
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/metrics v0.17.0
github.com/DataDog/opentelemetry-mapping-go/pkg/quantile v0.17.0
github.com/DataDog/sketches-go v1.4.6
github.com/DataDog/sketches-go v1.4.6 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.24.0
github.com/aws/aws-sdk-go v1.53.16
github.com/cenkalti/backoff/v4 v4.3.0
Expand Down Expand Up @@ -269,7 +270,7 @@ require (
github.com/outcaste-io/ristretto v0.2.1 // indirect
github.com/ovh/go-ovh v1.5.1 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/pelletier/go-toml v1.2.0 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/philhofer/fwd v1.1.2 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/pkg/errors v0.9.1 // indirect
Expand Down
9 changes: 4 additions & 5 deletions exporter/datadogexporter/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion exporter/datadogexporter/integrationtest/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datado
go 1.21.0

require (
github.com/DataDog/datadog-agent/comp/otelcol/otlp/testutil v0.57.0-devel.0.20240718200853-81bf3b2e412d
github.com/DataDog/datadog-agent/pkg/proto v0.56.0-rc.4
github.com/open-telemetry/opentelemetry-collector-contrib/connector/datadogconnector v0.105.0
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter v0.105.0
Expand Down Expand Up @@ -186,7 +187,7 @@ require (
github.com/openshift/client-go v0.0.0-20210521082421-73d9475a9142 // indirect
github.com/outcaste-io/ristretto v0.2.1 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/pelletier/go-toml v1.2.0 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/philhofer/fwd v1.1.3-0.20240612014219-fbbf4953d986 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
Expand Down
9 changes: 4 additions & 5 deletions exporter/datadogexporter/integrationtest/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"testing"
"time"

"github.com/DataDog/datadog-agent/comp/otelcol/otlp/testutil"
pb "github.com/DataDog/datadog-agent/pkg/proto/pbgo/trace"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -41,7 +42,6 @@ import (

"github.com/open-telemetry/opentelemetry-collector-contrib/connector/datadogconnector"
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter"
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/testutil"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"testing"
"time"

"github.com/DataDog/datadog-agent/comp/otelcol/otlp/testutil"
"github.com/DataDog/opentelemetry-mapping-go/pkg/inframetadata"
"github.com/DataDog/opentelemetry-mapping-go/pkg/inframetadata/payload"
"github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes"
Expand All @@ -27,8 +28,6 @@ import (
"go.opentelemetry.io/collector/pdata/pcommon"
conventions "go.opentelemetry.io/collector/semconv/v1.6.1"
"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/testutil"
)

var (
Expand Down
6 changes: 5 additions & 1 deletion exporter/datadogexporter/internal/logs/package_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@ import (
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
// We have to ignore seelog because of upstream issue
// https://github.com/cihub/seelog/issues/182
goleak.VerifyTestMain(m,
goleak.IgnoreAnyFunction("github.com/cihub/seelog.(*asyncLoopLogger).processQueue"),
)
}
3 changes: 1 addition & 2 deletions exporter/datadogexporter/internal/logs/sender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ import (
"testing"
"time"

"github.com/DataDog/datadog-agent/comp/otelcol/otlp/testutil"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
"github.com/stretchr/testify/assert"
"go.opentelemetry.io/collector/config/confighttp"
"go.opentelemetry.io/collector/config/configtls"
"go.uber.org/zap/zaptest"

"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/testutil"
)

func TestSubmitLogs(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ import (
"context"
"testing"

"github.com/DataDog/datadog-agent/comp/otelcol/otlp/testutil"
"github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes"
"github.com/stretchr/testify/assert"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/pdata/pmetric"
conventions "go.opentelemetry.io/collector/semconv/v1.6.1"
"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/testutil"
)

func TestZorkianRunningMetrics(t *testing.T) {
Expand Down
3 changes: 1 addition & 2 deletions exporter/datadogexporter/internal/metrics/consumer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"context"
"testing"

"github.com/DataDog/datadog-agent/comp/otelcol/otlp/testutil"
"github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes"
"github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes/source"
"github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/metrics"
Expand All @@ -17,8 +18,6 @@ import (
"go.opentelemetry.io/collector/pdata/pmetric"
conventions "go.opentelemetry.io/collector/semconv/v1.6.1"
"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/testutil"
)

type testProvider string
Expand Down
Loading

0 comments on commit fbdcea4

Please sign in to comment.