Skip to content

Commit 3f4d49c

Browse files
dmathieuMrAlias
andauthored
Fix flaky canceled context in otelconf/trace test (#8250)
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
1 parent 3ce5839 commit 3f4d49c

File tree

6 files changed

+6
-6
lines changed

6 files changed

+6
-6
lines changed

otelconf/log_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ func Test_otlpGRPCLogExporter(t *testing.T) {
854854
}
855855

856856
assert.EventuallyWithT(t, func(collect *assert.CollectT) {
857-
assert.NoError(collect, exporter.Export(t.Context(), []sdklog.Record{
857+
assert.NoError(collect, exporter.Export(context.Background(), []sdklog.Record{ //nolint:usetesting // required to avoid getting a canceled context.
858858
logFactory.NewRecord(),
859859
}))
860860
}, 10*time.Second, 1*time.Second)

otelconf/metric_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1557,7 +1557,7 @@ func Test_otlpGRPCMetricExporter(t *testing.T) {
15571557
require.NoError(t, err)
15581558

15591559
assert.EventuallyWithT(t, func(collect *assert.CollectT) {
1560-
assert.NoError(collect, exporter.Export(t.Context(), &metricdata.ResourceMetrics{
1560+
assert.NoError(collect, exporter.Export(context.Background(), &metricdata.ResourceMetrics{ //nolint:usetesting // required to avoid getting a canceled context.
15611561
Resource: res,
15621562
ScopeMetrics: []metricdata.ScopeMetrics{
15631563
{

otelconf/trace_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,7 @@ func Test_otlpGRPCTraceExporter(t *testing.T) {
10261026
}
10271027

10281028
assert.EventuallyWithT(t, func(collect *assert.CollectT) {
1029-
assert.NoError(collect, exporter.ExportSpans(t.Context(), input.Snapshots()))
1029+
assert.NoError(collect, exporter.ExportSpans(context.Background(), input.Snapshots())) //nolint:usetesting // required to avoid getting a canceled context.
10301030
}, 10*time.Second, 1*time.Second)
10311031
})
10321032
}

otelconf/v0.3.0/log_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@ func Test_otlpGRPCLogExporter(t *testing.T) {
880880
}
881881

882882
assert.EventuallyWithT(t, func(collect *assert.CollectT) {
883-
assert.NoError(collect, exporter.Export(t.Context(), []sdklog.Record{
883+
assert.NoError(collect, exporter.Export(context.Background(), []sdklog.Record{ //nolint:usetesting // required to avoid getting a canceled context.
884884
logFactory.NewRecord(),
885885
}))
886886
}, 10*time.Second, 1*time.Second)

otelconf/v0.3.0/metric_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1708,7 +1708,7 @@ func Test_otlpGRPCMetricExporter(t *testing.T) {
17081708
require.NoError(t, err)
17091709

17101710
assert.EventuallyWithT(t, func(collect *assert.CollectT) {
1711-
assert.NoError(collect, exporter.Export(t.Context(), &metricdata.ResourceMetrics{
1711+
assert.NoError(collect, exporter.Export(context.Background(), &metricdata.ResourceMetrics{ //nolint:usetesting // required to avoid getting a canceled context.
17121712
Resource: res,
17131713
ScopeMetrics: []metricdata.ScopeMetrics{
17141714
{

otelconf/v0.3.0/trace_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,7 @@ func Test_otlpGRPCTraceExporter(t *testing.T) {
10261026
}
10271027

10281028
assert.EventuallyWithT(t, func(collect *assert.CollectT) {
1029-
assert.NoError(collect, exporter.ExportSpans(t.Context(), input.Snapshots()))
1029+
assert.NoError(collect, exporter.ExportSpans(context.Background(), input.Snapshots())) //nolint:usetesting // required to avoid getting a canceled context.
10301030
}, 10*time.Second, 1*time.Second)
10311031
})
10321032
}

0 commit comments

Comments
 (0)