Skip to content

Commit

Permalink
refactor: Update item creation in batch_test.go
Browse files Browse the repository at this point in the history
  • Loading branch information
samcm committed Nov 28, 2024
1 parent 1c7de24 commit 0d290bf
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions pkg/processor/batch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,11 @@ func TestAsyncNewBatchItemProcessorWithOptions(t *testing.T) {
time.Sleep(10 * time.Millisecond)
}

if err := ssp.Write(context.Background(), []*TestItem{{
name: "test",
}}); err != nil {
item := TestItem{
name: "test" + strconv.Itoa(i),
}

if err := ssp.Write(context.Background(), []*TestItem{&item}); err != nil {
t.Errorf("%s: Error writing to BatchItemProcessor", option.name)
}
}
Expand Down Expand Up @@ -788,7 +790,6 @@ func TestBatchItemProcessorQueueSize(t *testing.T) {
func TestBatchItemProcessorNilItem(t *testing.T) {
te := testBatchExporter[TestItem]{}

metrics := NewMetrics("test")
bsp, err := NewBatchItemProcessor[TestItem](
&te,
"processor",
Expand All @@ -798,7 +799,6 @@ func TestBatchItemProcessorNilItem(t *testing.T) {
WithMaxExportBatchSize(5),
WithWorkers(1),
WithShippingMethod(ShippingMethodSync),
WithMetrics(metrics),
)
require.NoError(t, err)

Expand All @@ -821,7 +821,6 @@ func TestBatchItemProcessorNilItem(t *testing.T) {
}

func TestBatchItemProcessorNilExporter(t *testing.T) {
metrics := NewMetrics("test")
bsp, err := NewBatchItemProcessor[TestItem](
nil,
"processor",
Expand All @@ -831,7 +830,6 @@ func TestBatchItemProcessorNilExporter(t *testing.T) {
WithMaxExportBatchSize(5),
WithWorkers(1),
WithShippingMethod(ShippingMethodSync),
WithMetrics(metrics),
)
require.NoError(t, err)

Expand All @@ -843,7 +841,6 @@ func TestBatchItemProcessorNilExporter(t *testing.T) {
}

func TestBatchItemProcessorNilExporterAfterProcessing(t *testing.T) {
metrics := NewMetrics("test")
exporter := &testBatchExporter[TestItem]{}
bsp, err := NewBatchItemProcessor[TestItem](
exporter,
Expand All @@ -854,7 +851,6 @@ func TestBatchItemProcessorNilExporterAfterProcessing(t *testing.T) {
WithMaxExportBatchSize(5),
WithWorkers(1),
WithShippingMethod(ShippingMethodAsync),
WithMetrics(metrics),
)
require.NoError(t, err)

Expand Down Expand Up @@ -882,7 +878,6 @@ func TestBatchItemProcessorNilExporterAfterProcessing(t *testing.T) {
}

func TestBatchItemProcessorNilItemAfterQueue(t *testing.T) {
metrics := NewMetrics("test")
exporter := &testBatchExporter[TestItem]{}
bsp, err := NewBatchItemProcessor[TestItem](
exporter,
Expand All @@ -893,7 +888,6 @@ func TestBatchItemProcessorNilItemAfterQueue(t *testing.T) {
WithMaxExportBatchSize(5),
WithWorkers(1),
WithShippingMethod(ShippingMethodAsync),
WithMetrics(metrics),
)
require.NoError(t, err)

Expand Down

0 comments on commit 0d290bf

Please sign in to comment.