mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2024-12-04 09:43:23 +02:00
Update tests
This commit is contained in:
parent
891d16dd15
commit
ab19dddd0f
@ -69,30 +69,26 @@ type testOption struct {
|
||||
wantNumSpans int
|
||||
wantBatchCount int
|
||||
genNumSpans int
|
||||
waitTime time.Duration
|
||||
parallel bool
|
||||
}
|
||||
|
||||
func TestNewBatchSpanProcessorWithOptions(t *testing.T) {
|
||||
schDelay := 200 * time.Millisecond
|
||||
waitTime := schDelay + 100*time.Millisecond
|
||||
options := []testOption{
|
||||
{
|
||||
name: "default BatchSpanProcessorOptions",
|
||||
wantNumSpans: 2048,
|
||||
wantNumSpans: 2053,
|
||||
wantBatchCount: 4,
|
||||
genNumSpans: 2053,
|
||||
waitTime: 5100 * time.Millisecond,
|
||||
},
|
||||
{
|
||||
name: "non-default ScheduledDelayMillis",
|
||||
o: []sdktrace.BatchSpanProcessorOption{
|
||||
sdktrace.WithScheduleDelayMillis(schDelay),
|
||||
},
|
||||
wantNumSpans: 2048,
|
||||
wantNumSpans: 2053,
|
||||
wantBatchCount: 4,
|
||||
genNumSpans: 2053,
|
||||
waitTime: waitTime,
|
||||
},
|
||||
{
|
||||
name: "non-default MaxQueueSize and ScheduledDelayMillis",
|
||||
@ -100,10 +96,9 @@ func TestNewBatchSpanProcessorWithOptions(t *testing.T) {
|
||||
sdktrace.WithScheduleDelayMillis(schDelay),
|
||||
sdktrace.WithMaxQueueSize(200),
|
||||
},
|
||||
wantNumSpans: 200,
|
||||
wantNumSpans: 205,
|
||||
wantBatchCount: 1,
|
||||
genNumSpans: 205,
|
||||
waitTime: waitTime,
|
||||
},
|
||||
{
|
||||
name: "non-default MaxQueueSize, ScheduledDelayMillis and MaxExportBatchSize",
|
||||
@ -112,10 +107,9 @@ func TestNewBatchSpanProcessorWithOptions(t *testing.T) {
|
||||
sdktrace.WithMaxQueueSize(205),
|
||||
sdktrace.WithMaxExportBatchSize(20),
|
||||
},
|
||||
wantNumSpans: 205,
|
||||
wantNumSpans: 210,
|
||||
wantBatchCount: 11,
|
||||
genNumSpans: 210,
|
||||
waitTime: waitTime,
|
||||
},
|
||||
{
|
||||
name: "blocking option",
|
||||
@ -128,7 +122,6 @@ func TestNewBatchSpanProcessorWithOptions(t *testing.T) {
|
||||
wantNumSpans: 205,
|
||||
wantBatchCount: 11,
|
||||
genNumSpans: 205,
|
||||
waitTime: waitTime,
|
||||
},
|
||||
{
|
||||
name: "parallel span generation",
|
||||
@ -136,10 +129,9 @@ func TestNewBatchSpanProcessorWithOptions(t *testing.T) {
|
||||
sdktrace.WithScheduleDelayMillis(schDelay),
|
||||
sdktrace.WithMaxQueueSize(200),
|
||||
},
|
||||
wantNumSpans: 200,
|
||||
wantNumSpans: 205,
|
||||
wantBatchCount: 1,
|
||||
genNumSpans: 205,
|
||||
waitTime: waitTime,
|
||||
parallel: true,
|
||||
},
|
||||
{
|
||||
@ -152,7 +144,6 @@ func TestNewBatchSpanProcessorWithOptions(t *testing.T) {
|
||||
wantNumSpans: 2000,
|
||||
wantBatchCount: 10,
|
||||
genNumSpans: 2000,
|
||||
waitTime: waitTime,
|
||||
parallel: true,
|
||||
},
|
||||
}
|
||||
@ -168,8 +159,6 @@ func TestNewBatchSpanProcessorWithOptions(t *testing.T) {
|
||||
|
||||
generateSpan(t, option.parallel, tr, option)
|
||||
|
||||
time.Sleep(option.waitTime)
|
||||
|
||||
tp.UnregisterSpanProcessor(ssp)
|
||||
|
||||
gotNumOfSpans := te.len()
|
||||
@ -182,8 +171,6 @@ func TestNewBatchSpanProcessorWithOptions(t *testing.T) {
|
||||
t.Errorf("%s: number batches: got %+v, want >= %+v\n", option.name, gotBatchCount, option.wantBatchCount)
|
||||
t.Errorf("Batches %v\n", te.sizes)
|
||||
}
|
||||
|
||||
tp.UnregisterSpanProcessor(ssp)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user