• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  *  http://aws.amazon.com/apache2.0
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 
16 package software.amazon.awssdk.testutils.service;
17 
18 import reactor.blockhound.BlockHound;
19 import reactor.blockhound.integration.BlockHoundIntegration;
20 
21 /**
22  * Implements {@link BlockHoundIntegration} to explicitly allow SDK calls that are known to be blocking. Some calls (with an
23  * associated tracking issue) may wrongly block, but we allow-list them so that existing integration tests will continue to pass
24  * and so that we preserve visibility on future regression detection.
25  * <p>
26  * https://github.com/reactor/BlockHound/blob/master/docs/custom_integrations.md
27  */
28 public class BlockHoundAllowlist implements BlockHoundIntegration {
29     @Override
applyTo(BlockHound.Builder builder)30     public void applyTo(BlockHound.Builder builder) {
31         // https://github.com/aws/aws-sdk-java-v2/issues/2145
32         builder.allowBlockingCallsInside(
33             "software.amazon.awssdk.http.nio.netty.internal.BetterSimpleChannelPool",
34             "close"
35         );
36 
37         // https://github.com/aws/aws-sdk-java-v2/issues/2360
38         builder.allowBlockingCallsInside(
39             "software.amazon.awssdk.auth.credentials.InstanceProfileCredentialsProvider",
40             "getToken"
41         );
42     }
43 }
44