From 30c5958155c2cdfc7a06d836448e041ca3fe4e57 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 10 Apr 2024 11:55:35 -0700 Subject: [PATCH] Add TestRecordDroppedAttributes --- sdk/log/record_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sdk/log/record_test.go b/sdk/log/record_test.go index 3aef28d68c22..388b75e0eb13 100644 --- a/sdk/log/record_test.go +++ b/sdk/log/record_test.go @@ -190,3 +190,17 @@ func TestRecordClone(t *testing.T) { return assert.Truef(t, kv.Equal(attr1), "%v != %v", kv, attr1) }) } + +func TestRecordDroppedAttributes(t *testing.T) { + for i := 1; i < attributesInlineCount*5; i++ { + r := new(Record) + r.attributeCountLimit = 1 + + attrs := make([]log.KeyValue, i) + r.AddAttributes(attrs...) + assert.Equalf(t, i-1, r.DroppedAttributes(), "%d: AddAttributes", i) + + r.SetAttributes(attrs...) + assert.Equalf(t, i-1, r.DroppedAttributes(), "%d: SetAttributes", i) + } +}