Add more tests to OpenTelemetryResourceAttributesTests
Add tests for decoding percent-encoded strings with non-ASCII characters and multi-byte sequences. See gh-44944 Signed-off-by: Dmytro Nosan <dimanosan@gmail.com>
This commit is contained in:
parent
db3208460d
commit
094c962bbc
|
@ -117,6 +117,22 @@ class OpenTelemetryResourceAttributesTests {
|
|||
.containsEntry("key", value);
|
||||
}
|
||||
|
||||
@Test
|
||||
void otelResourceAttributeValuesShouldBePercentDecodedWhenStringContainsNonAscii() {
|
||||
this.environmentVariables.put("OTEL_RESOURCE_ATTRIBUTES", "key=%20\u015bp\u0159\u00ec\u0144\u0121%20");
|
||||
assertThat(getAttributes()).hasSize(2)
|
||||
.containsEntry("service.name", "unknown_service")
|
||||
.containsEntry("key", " śpřìńġ ");
|
||||
}
|
||||
|
||||
@Test
|
||||
void otelResourceAttributeValuesShouldBePercentDecodedWhenMultiByteSequences() {
|
||||
this.environmentVariables.put("OTEL_RESOURCE_ATTRIBUTES", "key=T%C5%8Dky%C5%8D");
|
||||
assertThat(getAttributes()).hasSize(2)
|
||||
.containsEntry("service.name", "unknown_service")
|
||||
.containsEntry("key", "Tōkyō");
|
||||
}
|
||||
|
||||
@Test
|
||||
void illegalArgumentExceptionShouldBeThrownWhenDecodingIllegalHexCharPercentEncodedValue() {
|
||||
this.environmentVariables.put("OTEL_RESOURCE_ATTRIBUTES", "key=abc%ß");
|
||||
|
|
Loading…
Reference in New Issue