Skip to content

Commit

Permalink
upgrade(collector) change NewNopCreateSettings to NewNopSettings
Browse files Browse the repository at this point in the history
  • Loading branch information
nslaughter committed Aug 14, 2024
1 parent cc1fef6 commit 7de1658
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 19 deletions.
4 changes: 2 additions & 2 deletions collector/processor/coldstartprocessor/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestNewFactory(t *testing.T) {
cfg := factory.CreateDefaultConfig()
_, err := factory.CreateTracesProcessor(
context.Background(),
processortest.NewNopCreateSettings(),
processortest.NewNopSettings(),
cfg,
consumertest.NewNop(),
)
Expand All @@ -55,7 +55,7 @@ func TestNewFactory(t *testing.T) {
factory := NewFactory()
_, err := factory.CreateTracesProcessor(
context.Background(),
processortest.NewNopCreateSettings(),
processortest.NewNopSettings(),
nil,
consumertest.NewNop(),
)
Expand Down
6 changes: 3 additions & 3 deletions collector/processor/coldstartprocessor/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func TestProcessor(t *testing.T) {
c, err := newColdstartProcessor(
nil,
nil,
processortest.NewNopCreateSettings(),
processortest.NewNopSettings(),
)
require.NoError(t, err)
td, err := c.processTraces(context.Background(), tc.input)
Expand All @@ -148,7 +148,7 @@ func TestMultipleProcessTraces(t *testing.T) {
c, err := newColdstartProcessor(
nil,
nil,
processortest.NewNopCreateSettings(),
processortest.NewNopSettings(),
)
require.NoError(t, err)
expected := ptrace.NewTraces()
Expand Down Expand Up @@ -180,7 +180,7 @@ func TestMultipleProcessTraces(t *testing.T) {
c, err = newColdstartProcessor(
nil,
nil,
processortest.NewNopCreateSettings(),
processortest.NewNopSettings(),
)
require.NoError(t, err)
input = ptrace.NewTraces()
Expand Down
4 changes: 2 additions & 2 deletions collector/processor/decoupleprocessor/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestNewFactory(t *testing.T) {
cfg := factory.CreateDefaultConfig()
_, err := factory.CreateTracesProcessor(
context.Background(),
processortest.NewNopCreateSettings(),
processortest.NewNopSettings(),
cfg,
consumertest.NewNop(),
)
Expand All @@ -58,7 +58,7 @@ func TestNewFactory(t *testing.T) {
factory := NewFactory()
_, err := factory.CreateTracesProcessor(
context.Background(),
processortest.NewNopCreateSettings(),
processortest.NewNopSettings(),
nil,
consumertest.NewNop(),
)
Expand Down
17 changes: 9 additions & 8 deletions collector/processor/decoupleprocessor/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package decoupleprocessor
import (
"context"
"errors"
"sync"
"testing"
"time"

"github.com/open-telemetry/opentelemetry-lambda/collector/lambdalifecycle"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/client"
"go.opentelemetry.io/collector/processor/processortest"
"sync"
"testing"
"time"
)

type MockLifecycleNotifier struct {
Expand Down Expand Up @@ -104,7 +105,7 @@ func Test_newDecoupleProcessor(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
lambdalifecycle.SetNotifier(tt.notifier)

dp, err := newDecoupleProcessor(tt.args.cfg, tt.args.consumer, processortest.NewNopCreateSettings())
dp, err := newDecoupleProcessor(tt.args.cfg, tt.args.consumer, processortest.NewNopSettings())
if tt.wantErr {
require.Error(t, err)
} else {
Expand All @@ -125,13 +126,13 @@ func TestLifecycle(t *testing.T) {
lambdalifecycle.SetNotifier(notifier)

t.Run("create and otelcol shutdown only", func(t *testing.T) {
dp, err := newDecoupleProcessor(config, consumer, processortest.NewNopCreateSettings())
dp, err := newDecoupleProcessor(config, consumer, processortest.NewNopSettings())
require.NoError(t, err)
require.NoError(t, dp.shutdown(context.Background()))
})

t.Run("full lifecycle", func(t *testing.T) {
dp, err := newDecoupleProcessor(config, consumer, processortest.NewNopCreateSettings())
dp, err := newDecoupleProcessor(config, consumer, processortest.NewNopSettings())
require.NoError(t, err)

dp.FunctionInvoked()
Expand All @@ -142,7 +143,7 @@ func TestLifecycle(t *testing.T) {
})

t.Run("full lifecycle with data from function", func(t *testing.T) {
dp, err := newDecoupleProcessor(config, consumer, processortest.NewNopCreateSettings())
dp, err := newDecoupleProcessor(config, consumer, processortest.NewNopSettings())
require.NoError(t, err)

dp.FunctionInvoked()
Expand All @@ -164,7 +165,7 @@ func TestLifecycle(t *testing.T) {
})

t.Run("full lifecycle with data before shutdown", func(t *testing.T) {
dp, err := newDecoupleProcessor(config, consumer, processortest.NewNopCreateSettings())
dp, err := newDecoupleProcessor(config, consumer, processortest.NewNopSettings())
require.NoError(t, err)

dp.FunctionInvoked()
Expand Down
4 changes: 2 additions & 2 deletions collector/receiver/telemetryapireceiver/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestNewFactory(t *testing.T) {
cfg := factory.CreateDefaultConfig()
_, err := factory.CreateTracesReceiver(
context.Background(),
receivertest.NewNopCreateSettings(),
receivertest.NewNopSettings(),
cfg,
consumertest.NewNop(),
)
Expand All @@ -66,7 +66,7 @@ func TestNewFactory(t *testing.T) {
factory := NewFactory("test")
_, err := factory.CreateTracesReceiver(
context.Background(),
receivertest.NewNopCreateSettings(),
receivertest.NewNopSettings(),
nil,
consumertest.NewNop(),
)
Expand Down
4 changes: 2 additions & 2 deletions collector/receiver/telemetryapireceiver/receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func TestHandler(t *testing.T) {
r, err := newTelemetryAPIReceiver(
&Config{},
&consumer,
receivertest.NewNopCreateSettings(),
receivertest.NewNopSettings(),
)
require.NoError(t, err)
req := httptest.NewRequest("POST",
Expand Down Expand Up @@ -149,7 +149,7 @@ func TestCreatePlatformInitSpan(t *testing.T) {
r, err := newTelemetryAPIReceiver(
&Config{},
nil,
receivertest.NewNopCreateSettings(),
receivertest.NewNopSettings(),
)
require.NoError(t, err)
td, err := r.createPlatformInitSpan(tc.start, tc.end)
Expand Down

0 comments on commit 7de1658

Please sign in to comment.