Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
VihasMakwana committed Oct 28, 2024
1 parent 8059a83 commit dd8e814
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
14 changes: 7 additions & 7 deletions exporter/loadbalancingexporter/log_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,14 +302,14 @@ func TestConsumeLogs_ConcurrentResolverChange(t *testing.T) {
consumeStarted := make(chan struct{})
consumeDone := make(chan struct{})

// imitate a slow exporter
te := &mockLogsExporter{Component: mockComponent{}}
te.consumelogsfn = func(_ context.Context, _ plog.Logs) error {
close(consumeStarted)
time.Sleep(50 * time.Millisecond)
return te.consumeErr
}
componentFactory := func(_ context.Context, _ string) (component.Component, error) {
// imitate a slow exporter
te := &mockLogsExporter{Component: mockComponent{}}
te.consumelogsfn = func(_ context.Context, _ plog.Logs) error {
close(consumeStarted)
time.Sleep(50 * time.Millisecond)
return te.consumeErr
}
return te, nil
}
lb, err := newLoadBalancer(ts.Logger, simpleConfig(), componentFactory, tb)
Expand Down
14 changes: 7 additions & 7 deletions exporter/loadbalancingexporter/metrics_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -553,14 +553,14 @@ func TestConsumeMetrics_ConcurrentResolverChange(t *testing.T) {
consumeStarted := make(chan struct{})
consumeDone := make(chan struct{})

// imitate a slow exporter
te := &mockMetricsExporter{Component: mockComponent{}}
te.ConsumeMetricsFn = func(_ context.Context, _ pmetric.Metrics) error {
close(consumeStarted)
time.Sleep(50 * time.Millisecond)
return te.consumeErr
}
componentFactory := func(_ context.Context, _ string) (component.Component, error) {
// imitate a slow exporter
te := &mockMetricsExporter{Component: mockComponent{}}
te.ConsumeMetricsFn = func(_ context.Context, _ pmetric.Metrics) error {
close(consumeStarted)
time.Sleep(50 * time.Millisecond)
return te.consumeErr
}
return te, nil
}
lb, err := newLoadBalancer(ts.Logger, simpleConfig(), componentFactory, tb)
Expand Down
12 changes: 6 additions & 6 deletions exporter/loadbalancingexporter/trace_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,13 @@ func TestConsumeTraces_ConcurrentResolverChange(t *testing.T) {
consumeDone := make(chan struct{})

// imitate a slow exporter
te := &mockTracesExporter{Component: mockComponent{}}
te.ConsumeTracesFn = func(_ context.Context, _ ptrace.Traces) error {
close(consumeStarted)
time.Sleep(50 * time.Millisecond)
return te.consumeErr
}
componentFactory := func(_ context.Context, _ string) (component.Component, error) {
te := &mockTracesExporter{Component: mockComponent{}}
te.ConsumeTracesFn = func(_ context.Context, _ ptrace.Traces) error {
close(consumeStarted)
time.Sleep(50 * time.Millisecond)
return te.consumeErr
}
return te, nil
}
lb, err := newLoadBalancer(ts.Logger, simpleConfig(), componentFactory, tb)
Expand Down

0 comments on commit dd8e814

Please sign in to comment.