(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func TestLabelBuilder(t *testing.T) { |
| 11 | builder := NewLabelBuilder(0, 0, newTestDrainSanitizer(SpanNameSanitizationDisabled), newTestLabelLimiter()) |
| 12 | builder.Add("name", "value") |
| 13 | lbls, ok := builder.CloseAndBuildLabels() |
| 14 | |
| 15 | assert.True(t, ok) |
| 16 | assert.Equal(t, labels.FromStrings("name", "value"), lbls) |
| 17 | |
| 18 | // Using the builder after calling Labels() will panic to prevent memory |
| 19 | // corruption. |
| 20 | assert.Panics(t, func() { |
| 21 | builder.Add("test", "test") |
| 22 | }) |
| 23 | } |
| 24 | |
| 25 | func TestLabelBuilder_MaxLabelNameLength(t *testing.T) { |
| 26 | builder := NewLabelBuilder(10, 10, newTestDrainSanitizer(SpanNameSanitizationDisabled), newTestLabelLimiter()) |
nothing calls this directly
no test coverage detected