From 32888908c1ffa00a3fc245649f119c4b5f9b6a3d Mon Sep 17 00:00:00 2001 From: Cindy Peng <148148319+cindy-peng@users.noreply.github.com> Date: Mon, 13 Jan 2025 12:21:34 -0800 Subject: [PATCH] Add test --- .../cloud/datastore/DatastoreOptionsTest.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreOptionsTest.java b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreOptionsTest.java index aff771383..9d644bdac 100644 --- a/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreOptionsTest.java +++ b/google-cloud-datastore/src/test/java/com/google/cloud/datastore/DatastoreOptionsTest.java @@ -103,6 +103,23 @@ public void testDatastore() { assertSame(datastoreRpc, options.build().getRpc()); } + @Test + public void testGrpcDefaultChannelConfigurations() { + DatastoreOptions datastoreOptions = + DatastoreOptions.newBuilder() + .setServiceRpcFactory(datastoreRpcFactory) + .setProjectId(PROJECT_ID) + .setDatabaseId(DATABASE_ID) + .setTransportOptions(GrpcTransportOptions.newBuilder().build()) + .setCredentials(NoCredentials.getInstance()) + .setHost("http://localhost:" + PORT) + .build(); + ChannelPoolSettings channelPoolSettings = ((InstantiatingGrpcChannelProvider) datastoreOptions.getTransportChannelProvider()).getChannelPoolSettings(); + assertEquals(channelPoolSettings.getInitialChannelCount(), 1); + assertEquals(channelPoolSettings.getMinChannelCount(), 1); + assertEquals(channelPoolSettings.getMaxChannelCount(), 4); + } + @Test public void testCustomChannelAndCredentials() { InstantiatingGrpcChannelProvider channelProvider =