Skip to content

Commit

Permalink
test: disable grpc client side metrics for tests (#2683)
Browse files Browse the repository at this point in the history
Our test suite creates thousands of instances of storage clients, the vast majority against test bench and non-directpath. Explicitly disable grpc client metrics to avoid the bootstrapping overhead and permission failures that happen.
  • Loading branch information
BenWhitehead authored Aug 23, 2024
1 parent 742514b commit 53fbba7
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ static FakeServer of(StorageGrpc.StorageImplBase service) throws IOException {
.setProjectId("test-proj")
.setCredentials(NoCredentials.getInstance())
.setGrpcInterceptorProvider(GrpcPlainRequestLoggingInterceptor.getInterceptorProvider())
.setEnableGrpcClientMetrics(false)
.build();
return new FakeServer(server, grpcStorageOptions);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public void grpc() throws Exception {
.setHost(testBench.getGRPCBaseUri())
.setCredentials(NoCredentials.getInstance())
.setProjectId("test-project-id")
.setEnableGrpcClientMetrics(false)
.build();

Storage service1 = options.getService();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,10 @@ private Storage newStorage(boolean forTest) {
builder = StorageOptions.http().setHost(testBench.getBaseUri());
break;
case GRPC:
builder = StorageOptions.grpc().setHost(testBench.getGRPCBaseUri());
builder =
StorageOptions.grpc()
.setHost(testBench.getGRPCBaseUri())
.setEnableGrpcClientMetrics(false);
break;
default:
throw new IllegalStateException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public void setUp() throws Exception {
storage =
StorageOptions.grpc()
.setGrpcInterceptorProvider(() -> ImmutableList.of(requestAuditing))
.setEnableGrpcClientMetrics(false)
.build()
.getService();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ public void clientShouldConstructCleanly_http() throws Exception {
@Test
public void clientShouldConstructCleanly_grpc() throws Exception {
StorageOptions options =
StorageOptions.grpc().setCredentials(credentials).setAttemptDirectPath(false).build();
StorageOptions.grpc()
.setCredentials(credentials)
.setAttemptDirectPath(false)
.setEnableGrpcClientMetrics(false)
.build();
doTest(options);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ static BackendResources of(Backend backend) {
optionsBuilder
.setGrpcInterceptorProvider(
GrpcPlainRequestLoggingInterceptor.getInterceptorProvider())
.setEnableGrpcClientMetrics(false)
.build();
return new StorageInstance(built, protectedBucketNames);
});
Expand Down

0 comments on commit 53fbba7

Please sign in to comment.