2222import java .util .concurrent .ExecutionException ;
2323import java .util .concurrent .ExecutorService ;
2424import java .util .concurrent .Executors ;
25+ import org .junit .jupiter .api .RepeatedTest ;
2526import org .junit .jupiter .api .Test ;
2627import software .amazon .awssdk .auth .credentials .AnonymousCredentialsProvider ;
2728import software .amazon .awssdk .awscore .interceptor .TraceIdExecutionInterceptor ;
@@ -311,35 +312,4 @@ public void traceIdInterceptorWithExecutiveServicePreservesTraceId() {
311312 }
312313 });
313314 }
314-
315- @ Test
316- public void traceIdInterceptorWithRunAsyncDoesNotPreservesTraceId () throws Exception {
317- EnvironmentVariableHelper .run (env -> {
318- env .set ("AWS_LAMBDA_FUNCTION_NAME" , "foo" );
319-
320- SdkInternalThreadLocal .put ("AWS_LAMBDA_X_TRACE_ID" , "SdkInternalThreadLocal-trace-123" );
321- try (MockSyncHttpClient mockHttpClient = new MockSyncHttpClient ();
322- ProtocolRestJsonClient client = ProtocolRestJsonClient .builder ()
323- .region (Region .US_WEST_2 )
324- .credentialsProvider (AnonymousCredentialsProvider .create ())
325- .httpClient (mockHttpClient )
326- .build ()) {
327-
328- mockHttpClient .stubNextResponse (HttpExecuteResponse .builder ()
329- .response (SdkHttpResponse .builder ().statusCode (200 ).build ())
330- .responseBody (AbortableInputStream .create (new StringInputStream ("{}" )))
331- .build ());
332-
333- CompletableFuture .runAsync (client ::allTypes ).get ();
334-
335- List <SdkHttpRequest > requests = mockHttpClient .getRequests ();
336- assertThat (requests .get (0 ).firstMatchingHeader ("X-Amzn-Trace-Id" )).isEmpty ();
337-
338- } catch (InterruptedException | ExecutionException e ) {
339- throw new RuntimeException (e );
340- } finally {
341- SdkInternalThreadLocal .clear ();
342- }
343- });
344- }
345315}
0 commit comments