|
24 | 24 | import static io.opentelemetry.semconv.incubating.RpcIncubatingAttributes.RPC_SYSTEM;
|
25 | 25 | import static java.util.Arrays.asList;
|
26 | 26 | import static org.assertj.core.api.Assertions.assertThat;
|
| 27 | +import static org.assertj.core.api.Assertions.assertThatThrownBy; |
27 | 28 | import static org.assertj.core.api.Assertions.catchThrowable;
|
28 | 29 |
|
29 | 30 | import io.opentelemetry.api.trace.SpanKind;
|
| 31 | +import io.opentelemetry.context.Context; |
30 | 32 | import io.opentelemetry.sdk.testing.assertj.AttributeAssertion;
|
31 | 33 | import io.opentelemetry.sdk.trace.data.StatusData;
|
32 | 34 | import io.opentelemetry.testing.internal.armeria.common.HttpData;
|
|
56 | 58 | import software.amazon.awssdk.core.ResponseInputStream;
|
57 | 59 | import software.amazon.awssdk.core.async.AsyncResponseTransformer;
|
58 | 60 | import software.amazon.awssdk.core.exception.SdkClientException;
|
| 61 | +import software.amazon.awssdk.core.exception.SdkException; |
59 | 62 | import software.amazon.awssdk.core.retry.RetryPolicy;
|
60 | 63 | import software.amazon.awssdk.http.apache.ApacheHttpClient;
|
61 | 64 | import software.amazon.awssdk.regions.Region;
|
@@ -696,4 +699,24 @@ void testTimeoutAndRetryErrorsAreNotCaptured() {
|
696 | 699 | equalTo(stringKey("aws.agent"), "java-aws-sdk"),
|
697 | 700 | equalTo(stringKey("aws.bucket.name"), "somebucket"))));
|
698 | 701 | }
|
| 702 | + |
| 703 | + // regression test for |
| 704 | + // https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/13124 |
| 705 | + // verify that scope is not leaked on exception |
| 706 | + @Test |
| 707 | + void testS3ListNullBucket() { |
| 708 | + S3ClientBuilder builder = S3Client.builder(); |
| 709 | + configureSdkClient(builder); |
| 710 | + S3Client client = |
| 711 | + builder |
| 712 | + .endpointOverride(clientUri) |
| 713 | + .region(Region.AP_NORTHEAST_1) |
| 714 | + .credentialsProvider(CREDENTIALS_PROVIDER) |
| 715 | + .build(); |
| 716 | + |
| 717 | + assertThatThrownBy(() -> client.listObjectsV2(b -> b.bucket(null))) |
| 718 | + .isInstanceOf(SdkException.class); |
| 719 | + |
| 720 | + assertThat(Context.current()).isEqualTo(Context.root()); |
| 721 | + } |
699 | 722 | }
|
0 commit comments