Skip to content

Commit

Permalink
fix: update GrpcStorageOptions to attempt direct path by default (#2715)
Browse files Browse the repository at this point in the history
Update our tests to not attempt direct path, as we do not always run in gce.
  • Loading branch information
BenWhitehead authored and lqiu96 committed Sep 23, 2024
1 parent 66cba11 commit 9133155
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ public Duration getTerminationAwaitDuration() {
/** @since 2.14.0 This new api is in preview and is subject to breaking changes. */
@BetaApi
public boolean isAttemptDirectPath() {
return false;
return true;
}

/** @since 2.41.0 This new api is in preview and is subject to breaking changes. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ static FakeServer of(StorageGrpc.StorageImplBase service) throws IOException {
.setCredentials(NoCredentials.getInstance())
.setGrpcInterceptorProvider(GrpcPlainRequestLoggingInterceptor.getInterceptorProvider())
.setEnableGrpcClientMetrics(false)
.setAttemptDirectPath(false)
.build();
return new FakeServer(server, grpcStorageOptions);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public void grpc() throws Exception {
.setCredentials(NoCredentials.getInstance())
.setProjectId("test-project-id")
.setEnableGrpcClientMetrics(false)
.setAttemptDirectPath(false)
.build();

Storage service1 = options.getService();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ private Storage newStorage(boolean forTest) {
builder =
StorageOptions.grpc()
.setHost(testBench.getGRPCBaseUri())
.setEnableGrpcClientMetrics(false);
.setEnableGrpcClientMetrics(false)
.setAttemptDirectPath(false);
break;
default:
throw new IllegalStateException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public void setUp() throws Exception {
StorageOptions.grpc()
.setGrpcInterceptorProvider(() -> ImmutableList.of(requestAuditing))
.setEnableGrpcClientMetrics(false)
.setAttemptDirectPath(false)
.build()
.getService();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ public void canary_happyPath_http() throws Exception {

@Test
public void canary_happyPath_grpc() throws Exception {
assertBehaviorOfPrimaryStorageActions(StorageOptions.grpc().build().getService());
assertBehaviorOfPrimaryStorageActions(
StorageOptions.grpc()
// TODO https://github.com/googleapis/java-storage/issues/2716
.setAttemptDirectPath(false)
.build()
.getService());
}

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

0 comments on commit 9133155

Please sign in to comment.