Skip to content
This repository was archived by the owner on Jul 1, 2022. It is now read-only.

Commit b6a145f

Browse files
committed
Fix padding with zeros in test
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
1 parent 12e0522 commit b6a145f

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

jaeger-core/src/test/java/io/jaegertracing/internal/propagation/TraceContextCodecTest.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,19 +74,16 @@ public void testInjectWith64bit() {
7474
long traceIdLow = 1;
7575
long spanId = 2;
7676
long parentId = 3;
77-
long traceIdHigh = 0L;
77+
long traceIdHigh = 0;
7878
JaegerSpanContext spanContext = new JaegerSpanContext(traceIdHigh, traceIdLow, spanId, parentId, (byte) 0);
7979

8080
traceContextCodec.inject(spanContext, textMap);
81-
8281
assertEquals(1, carrier.size());
8382

84-
String traceContextHeader = carrier.get(TRACE_PARENT);
85-
assertNotNull(traceContextHeader);
86-
assertTrue(traceContextHeader.contains("0000000000000001"));
87-
//For 64 bit traces, we need to pad the left side with a random number to conform with the specification.
88-
//It should not contain all zeros.
89-
assertTrue(traceContextHeader.contains("00000000000000000000000000000001"));
83+
String traceParent = carrier.get(TRACE_PARENT);
84+
assertEquals("00-00000000000000000000000000000001-0000000000000002-00", traceParent);
85+
JaegerSpanContext extractedContext = traceContextCodec.extract(textMap);
86+
assertEquals("1:2:0:0", extractedContext.toString());
9087
}
9188

9289
@Test
@@ -104,7 +101,6 @@ public void testNoTraceHeader() {
104101
assertNull(spanContext);
105102
}
106103

107-
108104
@Test
109105
public void testInvalidParentId() {
110106
TextMapAdapter textMap = new TextMapAdapter(new HashMap<>());

0 commit comments

Comments
 (0)