Skip to content

Commit

Permalink
nit: clean up test variable names (#4281)
Browse files Browse the repository at this point in the history
SetupTelemetry returns TestTelemetry, the variable set didn't reflect this.
  • Loading branch information
Alex Boten authored Oct 27, 2021
1 parent ea8b4f4 commit 1662562
Show file tree
Hide file tree
Showing 9 changed files with 100 additions and 100 deletions.
10 changes: 5 additions & 5 deletions exporter/exporterhelper/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,16 @@ func TestLogsExporter_WithRecordLogs_ReturnError(t *testing.T) {
}

func TestLogsExporter_WithRecordEnqueueFailedMetrics(t *testing.T) {
set, err := obsreporttest.SetupTelemetry()
tt, err := obsreporttest.SetupTelemetry()
require.NoError(t, err)
defer set.Shutdown(context.Background())
defer tt.Shutdown(context.Background())

rCfg := DefaultRetrySettings()
qCfg := DefaultQueueSettings()
qCfg.NumConsumers = 1
qCfg.QueueSize = 2
wantErr := errors.New("some-error")
te, err := NewLogsExporter(&fakeLogsExporterConfig, set.ToExporterCreateSettings(), newPushLogsData(wantErr), WithRetry(rCfg), WithQueue(qCfg))
te, err := NewLogsExporter(&fakeLogsExporterConfig, tt.ToExporterCreateSettings(), newPushLogsData(wantErr), WithRetry(rCfg), WithQueue(qCfg))
require.NoError(t, err)
require.NotNil(t, te)

Expand Down Expand Up @@ -205,9 +205,9 @@ func newPushLogsData(retError error) consumerhelper.ConsumeLogsFunc {
}

func checkRecordedMetricsForLogsExporter(t *testing.T, le component.LogsExporter, wantError error) {
set, err := obsreporttest.SetupTelemetry()
tt, err := obsreporttest.SetupTelemetry()
require.NoError(t, err)
defer set.Shutdown(context.Background())
defer tt.Shutdown(context.Background())

ld := testdata.GenerateLogsTwoLogRecordsSameResource()
const numBatches = 7
Expand Down
10 changes: 5 additions & 5 deletions exporter/exporterhelper/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,16 @@ func TestMetricsExporter_WithRecordMetrics_ReturnError(t *testing.T) {
}

func TestMetricsExporter_WithRecordEnqueueFailedMetrics(t *testing.T) {
set, err := obsreporttest.SetupTelemetry()
tt, err := obsreporttest.SetupTelemetry()
require.NoError(t, err)
defer set.Shutdown(context.Background())
defer tt.Shutdown(context.Background())

rCfg := DefaultRetrySettings()
qCfg := DefaultQueueSettings()
qCfg.NumConsumers = 1
qCfg.QueueSize = 2
wantErr := errors.New("some-error")
te, err := NewMetricsExporter(&fakeMetricsExporterConfig, set.ToExporterCreateSettings(), newPushMetricsData(wantErr), WithRetry(rCfg), WithQueue(qCfg))
te, err := NewMetricsExporter(&fakeMetricsExporterConfig, tt.ToExporterCreateSettings(), newPushMetricsData(wantErr), WithRetry(rCfg), WithQueue(qCfg))
require.NoError(t, err)
require.NotNil(t, te)

Expand Down Expand Up @@ -206,9 +206,9 @@ func newPushMetricsData(retError error) consumerhelper.ConsumeMetricsFunc {
}

func checkRecordedMetricsForMetricsExporter(t *testing.T, me component.MetricsExporter, wantError error) {
set, err := obsreporttest.SetupTelemetry()
tt, err := obsreporttest.SetupTelemetry()
require.NoError(t, err)
defer set.Shutdown(context.Background())
defer tt.Shutdown(context.Background())

md := testdata.GenerateMetricsTwoMetrics()
const numBatches = 7
Expand Down
6 changes: 3 additions & 3 deletions exporter/exporterhelper/obsreport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ import (
)

func TestExportEnqueueFailure(t *testing.T) {
set, err := obsreporttest.SetupTelemetry()
tt, err := obsreporttest.SetupTelemetry()
require.NoError(t, err)
defer set.Shutdown(context.Background())
defer tt.Shutdown(context.Background())

exporter := config.NewComponentID("fakeExporter")

insts := newInstruments(metric.NewRegistry())
obsrep := newObsExporter(obsreport.ExporterSettings{
Level: configtelemetry.LevelNormal,
ExporterID: exporter,
ExporterCreateSettings: set.ToExporterCreateSettings(),
ExporterCreateSettings: tt.ToExporterCreateSettings(),
}, insts)

logRecords := int64(7)
Expand Down
6 changes: 3 additions & 3 deletions exporter/exporterhelper/queued_retry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,13 +300,13 @@ func TestQueuedRetry_DropOnFull(t *testing.T) {
}

func TestQueuedRetryHappyPath(t *testing.T) {
set, err := obsreporttest.SetupTelemetry()
tt, err := obsreporttest.SetupTelemetry()
require.NoError(t, err)
defer set.Shutdown(context.Background())
defer tt.Shutdown(context.Background())

qCfg := DefaultQueueSettings()
rCfg := DefaultRetrySettings()
be := newBaseExporter(&defaultExporterCfg, set.ToExporterCreateSettings(), fromOptions(WithRetry(rCfg), WithQueue(qCfg)), "", nopRequestUnmarshaler())
be := newBaseExporter(&defaultExporterCfg, tt.ToExporterCreateSettings(), fromOptions(WithRetry(rCfg), WithQueue(qCfg)), "", nopRequestUnmarshaler())
ocs := newObservabilityConsumerSender(be.qrSender.consumerSender)
be.qrSender.consumerSender = ocs
require.NoError(t, be.Start(context.Background(), componenttest.NewNopHost()))
Expand Down
10 changes: 5 additions & 5 deletions exporter/exporterhelper/traces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,16 @@ func TestTracesExporter_WithRecordMetrics_ReturnError(t *testing.T) {
}

func TestTracesExporter_WithRecordEnqueueFailedMetrics(t *testing.T) {
set, err := obsreporttest.SetupTelemetry()
tt, err := obsreporttest.SetupTelemetry()
require.NoError(t, err)
defer set.Shutdown(context.Background())
defer tt.Shutdown(context.Background())

rCfg := DefaultRetrySettings()
qCfg := DefaultQueueSettings()
qCfg.NumConsumers = 1
qCfg.QueueSize = 2
wantErr := errors.New("some-error")
te, err := NewTracesExporter(&fakeTracesExporterConfig, set.ToExporterCreateSettings(), newTraceDataPusher(wantErr), WithRetry(rCfg), WithQueue(qCfg))
te, err := NewTracesExporter(&fakeTracesExporterConfig, tt.ToExporterCreateSettings(), newTraceDataPusher(wantErr), WithRetry(rCfg), WithQueue(qCfg))
require.NoError(t, err)
require.NotNil(t, te)

Expand Down Expand Up @@ -206,9 +206,9 @@ func newTraceDataPusher(retError error) consumerhelper.ConsumeTracesFunc {
}

func checkRecordedMetricsForTracesExporter(t *testing.T, te component.TracesExporter, wantError error) {
set, err := obsreporttest.SetupTelemetry()
tt, err := obsreporttest.SetupTelemetry()
require.NoError(t, err)
defer set.Shutdown(context.Background())
defer tt.Shutdown(context.Background())

td := testdata.GenerateTracesTwoSpansSameResource()
const numBatches = 7
Expand Down
Loading

0 comments on commit 1662562

Please sign in to comment.