Skip to content

Commit

Permalink
Fix failures in S3RepositoryThirdPartyTests
Browse files Browse the repository at this point in the history
Signed-off-by: Ashish Singh <[email protected]>
  • Loading branch information
ashking94 committed Dec 18, 2024
1 parent 49d893f commit 81e356d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class AmazonAsyncS3Reference extends RefCountedReleasable<AmazonAsyncS3Wi

private static final Logger logger = LogManager.getLogger(AmazonAsyncS3Reference.class);

AmazonAsyncS3Reference(AmazonAsyncS3WithCredentials client, Runnable onClose) {
AmazonAsyncS3Reference(AmazonAsyncS3WithCredentials client) {
super("AWS_S3_CLIENT", client, () -> {
client.client().close();
client.priorityClient().close();
Expand All @@ -38,7 +38,6 @@ public class AmazonAsyncS3Reference extends RefCountedReleasable<AmazonAsyncS3Wi
logger.error("Exception while closing AwsCredentialsProvider", e);
}
}
onClose.run();
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,7 @@ public AmazonAsyncS3Reference client(
}

final AmazonAsyncS3Reference clientReference = new AmazonAsyncS3Reference(
buildClient(clientSettings, urgentExecutorBuilder, priorityExecutorBuilder, normalExecutorBuilder),
() -> {
urgentExecutorBuilder.getAsyncTransferEventLoopGroup().close();
priorityExecutorBuilder.getAsyncTransferEventLoopGroup().close();
normalExecutorBuilder.getAsyncTransferEventLoopGroup().close();
}
buildClient(clientSettings, urgentExecutorBuilder, priorityExecutorBuilder, normalExecutorBuilder)
);
clientReference.incRef();
clientsCache = MapBuilder.newMapBuilder(clientsCache).put(clientSettings, clientReference).immutableMap();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,5 +387,8 @@ public void reload(Settings settings) {
public void close() throws IOException {
service.close();
s3AsyncService.close();
urgentExecutorBuilder.getAsyncTransferEventLoopGroup().close();
priorityExecutorBuilder.getAsyncTransferEventLoopGroup().close();
normalExecutorBuilder.getAsyncTransferEventLoopGroup().close();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public AmazonAsyncS3Reference client(
AsyncExecutorContainer priorityExecutorBuilder,
AsyncExecutorContainer normalExecutorBuilder
) {
return new AmazonAsyncS3Reference(AmazonAsyncS3WithCredentials.create(asyncClient, asyncClient, asyncClient, null), () -> {});
return new AmazonAsyncS3Reference(AmazonAsyncS3WithCredentials.create(asyncClient, asyncClient, asyncClient, null));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1136,8 +1136,7 @@ public void testReadBlobAsyncMultiPart() throws Exception {

final S3AsyncClient s3AsyncClient = mock(S3AsyncClient.class);
final AmazonAsyncS3Reference amazonAsyncS3Reference = new AmazonAsyncS3Reference(
AmazonAsyncS3WithCredentials.create(s3AsyncClient, s3AsyncClient, s3AsyncClient, null),
() -> {}
AmazonAsyncS3WithCredentials.create(s3AsyncClient, s3AsyncClient, s3AsyncClient, null)
);

final S3BlobStore blobStore = mock(S3BlobStore.class);
Expand Down Expand Up @@ -1195,8 +1194,7 @@ public void testReadBlobAsyncSinglePart() throws Exception {

final S3AsyncClient s3AsyncClient = mock(S3AsyncClient.class);
final AmazonAsyncS3Reference amazonAsyncS3Reference = new AmazonAsyncS3Reference(
AmazonAsyncS3WithCredentials.create(s3AsyncClient, s3AsyncClient, s3AsyncClient, null),
() -> {}
AmazonAsyncS3WithCredentials.create(s3AsyncClient, s3AsyncClient, s3AsyncClient, null)
);
final S3BlobStore blobStore = mock(S3BlobStore.class);
final BlobPath blobPath = new BlobPath();
Expand Down Expand Up @@ -1251,8 +1249,7 @@ public void testReadBlobAsyncFailure() throws Exception {

final S3AsyncClient s3AsyncClient = mock(S3AsyncClient.class);
final AmazonAsyncS3Reference amazonAsyncS3Reference = new AmazonAsyncS3Reference(
AmazonAsyncS3WithCredentials.create(s3AsyncClient, s3AsyncClient, s3AsyncClient, null),
() -> {}
AmazonAsyncS3WithCredentials.create(s3AsyncClient, s3AsyncClient, s3AsyncClient, null)
);

final S3BlobStore blobStore = mock(S3BlobStore.class);
Expand Down Expand Up @@ -1295,8 +1292,7 @@ public void testReadBlobAsyncOnCompleteFailureMissingData() throws Exception {

final S3AsyncClient s3AsyncClient = mock(S3AsyncClient.class);
final AmazonAsyncS3Reference amazonAsyncS3Reference = new AmazonAsyncS3Reference(
AmazonAsyncS3WithCredentials.create(s3AsyncClient, s3AsyncClient, s3AsyncClient, null),
() -> {}
AmazonAsyncS3WithCredentials.create(s3AsyncClient, s3AsyncClient, s3AsyncClient, null)
);

final S3BlobStore blobStore = mock(S3BlobStore.class);
Expand Down

0 comments on commit 81e356d

Please sign in to comment.