Skip to content

Commit cd0d671

Browse files
committed
test(logging): fix missing exception in clientLevelFailureAttributes tests
Changed the endpoint for `testHttpJson_clientLevelFailureAttributes` and `testGrpc_clientLevelFailureAttributes` to `localhost:1` instead of `DEFAULT_HTTPJSON_ENDPOINT` and `DEFAULT_GRPC_ENDPOINT`. Since the showcase server is running during integration tests, sending an empty `EchoRequest` to the default endpoint succeeds without throwing an `ApiException`, causing the `assertThrows` assertion to fail. By pointing to a bad endpoint, we ensure a network exception is always thrown and the client-level failure attributes are properly populated and logged.
1 parent 483e589 commit cd0d671

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

sdk-platform-java/java-showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/logging/ITActionableErrorsLogging.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ void testHttpJson_clientLevelFailureAttributes() throws Exception {
216216
.build());
217217
stubSettingsBuilder.setTracerFactory(new LoggingTracerFactory());
218218
stubSettingsBuilder.setCredentialsProvider(NoCredentialsProvider.create());
219-
stubSettingsBuilder.setEndpoint(TestClientInitializer.DEFAULT_HTTPJSON_ENDPOINT);
219+
stubSettingsBuilder.setEndpoint("localhost:1");
220220

221221
try (com.google.showcase.v1beta1.stub.EchoStub stub = stubSettingsBuilder.build().createStub();
222222
EchoClient client = EchoClient.create(stub)) {
@@ -268,7 +268,7 @@ void testGrpc_clientLevelFailureAttributes() throws Exception {
268268
.build());
269269
stubSettingsBuilder.setTracerFactory(new LoggingTracerFactory());
270270
stubSettingsBuilder.setCredentialsProvider(NoCredentialsProvider.create());
271-
stubSettingsBuilder.setEndpoint(TestClientInitializer.DEFAULT_GRPC_ENDPOINT);
271+
stubSettingsBuilder.setEndpoint("localhost:1");
272272

273273
try (com.google.showcase.v1beta1.stub.EchoStub stub = stubSettingsBuilder.build().createStub();
274274
EchoClient client = EchoClient.create(stub)) {

0 commit comments

Comments
 (0)