Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;

import fixture.s3.S3HttpHandler;
Expand Down Expand Up @@ -234,9 +237,13 @@ public void testRequestStats() throws Exception {
* S3RepositoryPlugin that allows to disable chunked encoding and to set a low threshold between single upload and multipart upload.
*/
public static class TestS3RepositoryPlugin extends S3RepositoryPlugin {

public TestS3RepositoryPlugin(final Settings settings, final Path configPath) {
super(settings, configPath);
super(
settings,
configPath,
new S3Service(configPath, Executors.newSingleThreadScheduledExecutor()),
new S3AsyncService(configPath, Executors.newSingleThreadScheduledExecutor())
);
}

@Override
Expand All @@ -246,6 +253,13 @@ public List<Setting<?>> getSettings() {
return settings;
}

@Override
public void close() throws IOException {
super.close();
Stream.of(service.getClientExecutorService(), s3AsyncService.getClientExecutorService())
.forEach(e -> assertTrue(ThreadPool.terminate(e, 5, TimeUnit.SECONDS)));
}

@Override
protected S3Repository createRepository(
RepositoryMetadata metadata,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,4 +455,9 @@
releaseCachedClients();

}

@Nullable
ScheduledExecutorService getClientExecutorService() {
return clientExecutorService;

Check warning on line 461 in plugins/repository-s3/src/main/java/org/opensearch/repositories/s3/S3AsyncService.java

View check run for this annotation

Codecov / codecov/patch

plugins/repository-s3/src/main/java/org/opensearch/repositories/s3/S3AsyncService.java#L461

Added line #L461 was not covered by tests
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -527,4 +527,9 @@
public void close() {
releaseCachedClients();
}

@Nullable
ScheduledExecutorService getClientExecutorService() {
return clientExecutorService;

Check warning on line 533 in plugins/repository-s3/src/main/java/org/opensearch/repositories/s3/S3Service.java

View check run for this annotation

Codecov / codecov/patch

plugins/repository-s3/src/main/java/org/opensearch/repositories/s3/S3Service.java#L533

Added line #L533 was not covered by tests
}
}
Loading