Skip to content

Commit

Permalink
remove un-needed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dineshg13 committed Feb 4, 2024
1 parent 5ef1dc8 commit 3b5ad49
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 31 deletions.
10 changes: 3 additions & 7 deletions connector/datadogconnector/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,8 @@ func getTraceAgentCfg(cfg TracesConfig) *traceconfig.AgentConfig {
// Start implements the component.Component interface.
func (c *connectorImp) Start(_ context.Context, _ component.Host) error {
c.logger.Info("Starting datadogconnector")
if c.metricsConsumer != nil {
c.agent.Start()
go c.run()
}
c.agent.Start()
go c.run()
return nil
}

Expand All @@ -110,9 +108,7 @@ func (c *connectorImp) Capabilities() consumer.Capabilities {
}

func (c *connectorImp) ConsumeTraces(ctx context.Context, traces ptrace.Traces) error {
if c.metricsConsumer != nil {
c.agent.Ingest(ctx, traces)
}
c.agent.Ingest(ctx, traces)
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion connector/datadogconnector/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ func createTracesToMetricsConnector(_ context.Context, params connector.CreateSe
return c, nil
}

func createTracesToTracesConnector(_ context.Context, params connector.CreateSettings, cfg component.Config, nextConsumer consumer.Traces) (connector.Traces, error) {
func createTracesToTracesConnector(_ context.Context, params connector.CreateSettings, _ component.Config, nextConsumer consumer.Traces) (connector.Traces, error) {
return newTraceToTraceConnector(params.Logger, nextConsumer), nil
}
23 changes: 0 additions & 23 deletions internal/datadog/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/DataDog/datadog-agent/pkg/trace/testutil"
"github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/metrics"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/pdata/pcommon"
)

func TestTraceAgentConfig(t *testing.T) {
Expand Down Expand Up @@ -79,26 +78,4 @@ loop:
// of groups
require.Len(t, stats.Stats[0].Stats[0].Stats, traces.SpanCount())
require.Len(t, a.TraceWriter.In, 0) // the trace writer channel should've been drained

// Check that the payload is labeled
val, ok := traces.ResourceSpans().At(0).Resource().Attributes().Get(keyStatsComputed)
require.True(t, ok)
require.Equal(t, pcommon.ValueTypeBool, val.Type())
require.True(t, val.Bool())

// Ingest again
a.Ingest(ctx, traces)
timeout = time.After(500 * time.Millisecond)
loop2:
for {
select {
case stats = <-out:
if len(stats.Stats) != 0 {
t.Fatal("got payload when none was expected")
}
case <-timeout:
// We got no stats (expected), thus we end the test
break loop2
}
}
}

0 comments on commit 3b5ad49

Please sign in to comment.