Skip to content

Commit

Permalink
[fix][jaeger-v2] Fix non-determinstic test in utf-8 sanitizer (#6095)
Browse files Browse the repository at this point in the history
  • Loading branch information
mahadzaryab1 authored Oct 16, 2024
1 parent 35d4279 commit b26e414
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions cmd/jaeger/internal/sanitizer/utf8_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,21 +282,26 @@ func TestUTF8Sanitizer_SanitizesMultipleAttributesWithInvalidKeys(t *testing.T)

sanitizer := NewUTF8Sanitizer()
sanitized := sanitizer(traces)
value, ok := sanitized.
got := sanitized.
ResourceSpans().
At(0).
Resource().
Attributes().
Attributes()
require.Equal(t, 2, got.Len())

expectedValues := []pcommon.Value{
getBytesValueFromString(fmt.Sprintf("%s:v1", k1)),
getBytesValueFromString(fmt.Sprintf("%s:v2", k2)),
}
value, ok := got.
Get("invalid-tag-key-1")
require.True(t, ok)
require.EqualValues(t, getBytesValueFromString(fmt.Sprintf("%s:v1", k1)), value)
require.Contains(t, expectedValues, value)
checked := value

value, ok = sanitized.
ResourceSpans().
At(0).
Resource().
Attributes().
value, ok = got.
Get("invalid-tag-key-2")
require.True(t, ok)
require.EqualValues(t, getBytesValueFromString(fmt.Sprintf("%s:v2", k2)), value)
require.NotEqual(t, checked, value)
require.Contains(t, expectedValues, value)
}

0 comments on commit b26e414

Please sign in to comment.