File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
test/Voxel.MiddyNet.Tracing.ApiGatewayMiddleware.Tests Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 5
5
using NSubstitute ;
6
6
using Xunit ;
7
7
using FluentAssertions ;
8
+ using Voxel . MiddyNet . Tracing . Core ;
8
9
9
10
namespace Voxel . MiddyNet . Tracing . ApiGatewayMiddleware . Tests
10
11
{
@@ -16,6 +17,7 @@ public class ApiGatewayTracingMiddlewareShould
16
17
private const string TraceparentHeaderValue = "00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01" ;
17
18
private const string TracestateHeaderValue = "congo=ucfJifl5GOE" ;
18
19
private const string TraceIdHeaderValue = "0af7651916cd43dd8448eb211c80319c" ;
20
+ private const string TraceContextKey = "TraceContext" ;
19
21
20
22
[ Fact ]
21
23
public async Task EnrichLoggerWithTraceContext ( )
@@ -55,12 +57,11 @@ public async Task EnrichContextWithTraceContext()
55
57
56
58
await middleware . Before ( apiGatewayEvent , context ) ;
57
59
58
- context . AdditionalContext . Should ( ) . ContainKey ( TraceparentHeaderName ) ;
59
- context . AdditionalContext [ TraceparentHeaderName ] . Should ( ) . Be ( TraceparentHeaderValue ) ;
60
- context . AdditionalContext . Should ( ) . ContainKey ( TracestateHeaderName ) ;
61
- context . AdditionalContext [ TracestateHeaderName ] . Should ( ) . Be ( TracestateHeaderValue ) ;
62
- context . AdditionalContext . Should ( ) . ContainKey ( TraceIdHeaderName ) ;
63
- context . AdditionalContext [ TraceIdHeaderName ] . Should ( ) . Be ( TraceIdHeaderValue ) ;
60
+ context . AdditionalContext . Should ( ) . ContainKey ( TraceContextKey ) ;
61
+ var traceContext = context . AdditionalContext [ TraceContextKey ] as TraceContext ;
62
+ traceContext . TraceParent . Should ( ) . Be ( TraceparentHeaderValue ) ;
63
+ traceContext . TraceState . Should ( ) . Be ( TracestateHeaderValue ) ;
64
+ traceContext . TraceId . Should ( ) . Be ( TraceIdHeaderValue ) ;
64
65
}
65
66
}
66
67
}
You can’t perform that action at this time.
0 commit comments