Skip to content

Commit

Permalink
Add Test For Non String Attribute
Browse files Browse the repository at this point in the history
Signed-off-by: Mahad Zaryab <[email protected]>
  • Loading branch information
mahadzaryab1 committed Oct 12, 2024
1 parent 8212eb2 commit aad0bc5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions cmd/jaeger/internal/sanitizer/utf8_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,3 +210,22 @@ func TestUTF8Sanitizer_RemovesInvalidKeys(t *testing.T) {
Get(invalidUTF8())
require.False(t, ok)
}

func TestUTF8Sanitizer_DoesNotSanitizesNonStringAttribute(t *testing.T) {
traces := ptrace.NewTraces()
traces.
ResourceSpans().
AppendEmpty().
Resource().
Attributes().PutInt("key", 1)
sanitizer := NewUTF8Sanitizer()
sanitized := sanitizer(traces)
value, ok := sanitized.
ResourceSpans().
At(0).
Resource().
Attributes().
Get("key")
require.True(t, ok)
require.EqualValues(t, 1, value.Int())
}

0 comments on commit aad0bc5

Please sign in to comment.